Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultLabel is the default label for id allocator. DefaultLabel label = "idalloc" // KeyspaceLabel is the label for keyspace id allocator. KeyspaceLabel label = "keyspace-idAlloc" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator interface { // SetBase set base id SetBase(newBase uint64) error // Alloc allocs a unique id. Alloc() (uint64, error) // Rebase resets the base for the allocator from the persistent window boundary, // which also resets the end of the allocator. (base, end) is the range that can // be allocated in memory. Rebase() error }
Allocator is the allocator to generate unique ID.
func NewAllocator ¶
func NewAllocator(params *AllocatorParams) Allocator
NewAllocator creates a new ID Allocator.
type AllocatorParams ¶
type AllocatorParams struct { Client *clientv3.Client Label label // Label used to label metrics and logs. Member string // Member value, used to check if current pd leader. Step uint64 // Step size of each persistent window boundary increment, default 1000. }
AllocatorParams are parameters needed to create a new ID Allocator.
Click to show internal directories.
Click to hide internal directories.