idalloc

package
v2.6.6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMAllocator

func NewMAllocator(allocator Allocator) allocator.Interface

Types

type Allocator

type Allocator interface {
	// Allocate allocates a timestamp.
	Allocate(ctx context.Context) (uint64, error)

	// BarrierUtil make a barrier, next allocate call will generate id greater than barrier.
	BarrierUntil(ctx context.Context, barrier uint64) error

	// Sync expire the local allocator messages,
	// syncs the local allocator and remote allocator.
	Sync()

	// SyncIfExpired syncs the local allocator and remote allocator if the duration since last sync operation is greater than expire.
	SyncIfExpired(expire time.Duration)
}

func NewIDAllocator

func NewIDAllocator(mix *syncutil.Future[types.MixCoordClient]) Allocator

NewIDAllocator creates a new allocator.

func NewTSOAllocator

func NewTSOAllocator(mix *syncutil.Future[types.MixCoordClient]) Allocator

NewTSOAllocator creates a new allocator.

Jump to

Keyboard shortcuts

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