Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MurmurHash3Sum ¶
func NewLockedRand ¶
NewLockedRand is just like NewRand except the returned value uses a mutex to enable safe usage from concurrent goroutines.
Despite having mutex overhead, this is better than using the global rand because you don't have to worry about other code linked into the same program that might be abusing the global rand:
- It is possible for code to call rand.Seed, which could cause issues with the quality of the pseudo-random number sequence.
- It is possible for code to make *heavy* use of the global rand, which can mean extensive lock contention on its mutex, which will slow down clients trying to generate a random number.
By creating a new locked *rand.Rand, nothing else will be using it and contending over the mutex except other code that has access to the same instance.
func NewMurmurHash3 ¶
Types ¶
type Clock ¶
type Clock interface { After(d time.Duration) <-chan time.Time Sleep(d time.Duration) Now() time.Time Since(t time.Time) time.Duration NewTicker(d time.Duration) Ticker NewTimer(d time.Duration) Timer AfterFunc(d time.Duration, f func()) Timer }
Clock is an interface that is compatible with the jonboulle/clockwork package. The intent is that clockwork package only be a dependency for tests, not for non-test code.
func NewRealClock ¶
func NewRealClock() Clock
NewRealClock returns a Clock implementation where all methods delegate to the corresponding function in the time package.
type MurmurHash3 ¶
type MurmurHash3 struct {
// contains filtered or unexported fields
}
func (*MurmurHash3) BlockSize ¶
func (h *MurmurHash3) BlockSize() int
func (*MurmurHash3) Reset ¶
func (h *MurmurHash3) Reset()
func (*MurmurHash3) Size ¶
func (h *MurmurHash3) Size() int
func (*MurmurHash3) Sum ¶
func (h *MurmurHash3) Sum(b []byte) []byte
func (*MurmurHash3) Sum32 ¶
func (h *MurmurHash3) Sum32() uint32
type Ticker ¶
Ticker is an interface covering the behavior of a time.Ticker.
Directories
¶
Path | Synopsis |
---|---|
Package balancertesting provides some helper functions and types that can be useful when testing custom load balancer implementations.
|
Package balancertesting provides some helper functions and types that can be useful when testing custom load balancer implementations. |
Package clocktest exists to allow interoperability with our Clock interface and the Clockwork FakeClock.
|
Package clocktest exists to allow interoperability with our Clock interface and the Clockwork FakeClock. |
Package conns contains internal helpers relating to conn.Conns values.
|
Package conns contains internal helpers relating to conn.Conns values. |