Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedRandomIdGenerator ¶ added in v3.3.0
type BufferedRandomIdGenerator struct {
// contains filtered or unexported fields
}
BufferedRandomIdGenerator is used to fetch random generator ids while avoiding a mutex. The random ids are prefetched ina single goroutine in the background. You have to call close to stop this goroutine.
func NewBufferedRandomIdGenerator ¶
func NewBufferedRandomIdGenerator(idLength int, bufferSize int) *BufferedRandomIdGenerator
NewBufferedRandomIdGenerator instantiates a new generator with the given buffer size. The BufferedRandomIdGenerator has to be closed to avoid leaking the prefetch go routine.
func (*BufferedRandomIdGenerator) Close ¶ added in v3.3.0
func (gen *BufferedRandomIdGenerator) Close() error
Close stops the background prefetch process. Does not error.
func (*BufferedRandomIdGenerator) GetRandomId ¶ added in v3.3.0
func (gen *BufferedRandomIdGenerator) GetRandomId() string
GetRandomId returns a prefetched random id. Blocks till one is received.
Click to show internal directories.
Click to hide internal directories.