Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-02-08add Shuffle method to RandomSami Hiltunen
Adds Shuffle method to Random interface for shuffling a slice. While not in use yet, the method is required for selecting random host nodes when a repository is being created. NewLockedRandom implements a mutex protected wrapper for Random. Currently it was implemented with a function wrapper. As we need more than one method now, this commit changes the implementation in to a struct and adds the Shuffle method on it. The interface is also implemented by mockRandom which is used for mocking out a Random during tests. mockRandom also gains the Shuffle function so it implements the updated interface.
2020-11-17add a concurrency safe wrapper for RandomSami Hiltunen
This commit moves Random to it's own file and introduces a wrapper to make Random safe for concurrent use. The global random in Go is safe for concurrent use but random instances created otherwise are not. Adding a locked wrapper allows us to inject a random in to per repository router and have it provide safe safe access as the global.