id

package
v1.0.0-alpha02 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTxnPutEndID         = coderr.NewCodeError(coderr.Internal, "put end id in txn")
	ErrAllocID             = coderr.NewCodeError(coderr.Internal, "alloc id")
	ErrCollectID           = coderr.NewCodeError(coderr.Internal, "collect invalid id")
	ErrCollectNotSupported = coderr.NewCodeError(coderr.Internal, "collect is not supported")
)

Functions

This section is empty.

Types

type Allocator

type Allocator interface {
	// Alloc allocs a unique id.
	Alloc(ctx context.Context) (uint64, error)

	// Collect collect unused id to reused in alloc
	Collect(ctx context.Context, id uint64) error
}

Allocator defines the id allocator on the ceresdb cluster meta info.

func NewAllocatorImpl

func NewAllocatorImpl(kv clientv3.KV, key string, allocStep uint) Allocator

func NewReusableAllocatorImpl added in v0.4.0

func NewReusableAllocatorImpl(existIDs []uint64, minID uint64) Allocator

type AllocatorImpl

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

func (*AllocatorImpl) Alloc

func (a *AllocatorImpl) Alloc(ctx context.Context) (uint64, error)

func (*AllocatorImpl) Collect added in v0.4.0

func (a *AllocatorImpl) Collect(_ context.Context, _ uint64) error

type OrderedList added in v0.4.0

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

func (*OrderedList) FindMinHoleValueAndIndex added in v0.4.0

func (l *OrderedList) FindMinHoleValueAndIndex(min uint64) (uint64, int)

FindMinHoleValueAndIndex Find the minimum hole value and its index. If the list is empty, then return min value and 0 as index; If no hole is found, then return the `last_value + 1` in the list and l.Len() as the index;

func (*OrderedList) Insert added in v0.4.0

func (l *OrderedList) Insert(v uint64, i int)

Insert the value at the idx whose correctness should be ensured by the caller.

func (*OrderedList) Remove added in v0.4.0

func (l *OrderedList) Remove(v uint64) int

type ReusableAllocatorImpl added in v0.4.0

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

func (*ReusableAllocatorImpl) Alloc added in v0.4.0

func (*ReusableAllocatorImpl) Collect added in v0.4.0

func (a *ReusableAllocatorImpl) Collect(_ context.Context, id uint64) error

Jump to

Keyboard shortcuts

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