id

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

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
	RootPath  string
	AllocPath string // AllocPath specifies path to the persistent window boundary.
	Label     string // 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.

Jump to

Keyboard shortcuts

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