keygen

package
v0.0.0-...-5c487ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key string

Key represents unique identifier

type KeyFetcher

type KeyFetcher interface {
	FetchKeys(maxCount int) ([]Key, error)
}

KeyFetcher fetches keys in batch

type KeyFetcherFake

type KeyFetcherFake struct {
	// contains filtered or unexported fields
}

KeyFetcherFake represents an in memory key generator

func NewKeyFetcherFake

func NewKeyFetcherFake(availableKeys []Key) KeyFetcherFake

NewKeyFetcherFake creates fake key generator

func (*KeyFetcherFake) FetchKeys

func (k *KeyFetcherFake) FetchKeys(maxCount int) ([]Key, error)

FetchKeys returns keys from the buffer

type KeyGenerator

type KeyGenerator struct {
	// contains filtered or unexported fields
}

KeyGenerator fetches unique keys in batch from key generation service and buffer them in memory for fast response.

func NewKeyGenerator

func NewKeyGenerator(bufferSize int, keyFetcher KeyFetcher) (KeyGenerator, error)

NewKeyGenerator creates KeyGenerator

func (KeyGenerator) NewKey

func (r KeyGenerator) NewKey() (Key, error)

NewKey produces a unique key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL