util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterStores

type ClusterStores struct {
	Working StoreSlice
	Expired StoreSlice
}

ClusterStores collects stores by their status.

func NewClusterStores

func NewClusterStores() *ClusterStores

func (*ClusterStores) ExpiredStores

func (cs *ClusterStores) ExpiredStores() StoreSlice

ExpiredStores returns all recorded expired stores. NB: the returned order isn't deterministic.

func (*ClusterStores) RegisterExpired

func (cs *ClusterStores) RegisterExpired(store *Store)

RegisterExpired collects expired stores.

func (*ClusterStores) RegisterWorking

func (cs *ClusterStores) RegisterWorking(store *Store)

RegisterWorking collects working stores.

func (*ClusterStores) WorkingStores

func (cs *ClusterStores) WorkingStores() StoreSlice

WorkingStores returns all recorded working stores. NB: the returned order isn't deterministic.

type ExcludedFilter

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

func NewExcludedFilter

func NewExcludedFilter(stores ...string) *ExcludedFilter

func (*ExcludedFilter) Filter

func (e *ExcludedFilter) Filter(store *Store) bool

type Filter

type Filter func(store *Store) bool

func (Filter) Filter

func (f Filter) Filter(store *Store) bool

type IDAllocator

type IDAllocator interface {
	// Next returns `false` when IDAllocator was exhausted temporarily.
	Next() (uint64, bool)
}

IDAllocator is used to fetch new replica ID.

type IFilter

type IFilter interface {
	Filter(store *Store) bool
}

IFilter filter interface

type Store

type Store struct {
	ID       string
	Length   int
	Capacity int
}

Store records metadata for tn store.

func FilterStore

func FilterStore(stores []*Store, filters []IFilter) (candidates []*Store)

FilterStore filters store according to Filters

func NewStore

func NewStore(storeID string, length int, capacity int) *Store

type StoreSlice

type StoreSlice []*Store

func (StoreSlice) Contains

func (ss StoreSlice) Contains(storeID string) bool

type TestIDAllocator

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

func NewTestIDAllocator

func NewTestIDAllocator(startFrom uint64) *TestIDAllocator

func (*TestIDAllocator) Next

func (a *TestIDAllocator) Next() (uint64, bool)

Jump to

Keyboard shortcuts

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