Documentation ¶
Index ¶
- func ComputeBucketKeyString[R RootKey, K Key](elemCount uint64, rootKey R, key K) string
- func ComputeBucketKeyStringWithSeparator[R RootKey, K Key](elemCount uint64, rootKey R, key K, separator string) string
- func NewBucketUnmarshaler[T Value](unmarshaler item.Unmarshaler[T]) func(data []byte) (Bucket[T], error)
- type Bucket
- type BucketKey
- type FillKey
- type Filler
- type HashRange
- type Key
- type Map
- type MapOption
- type Option
- type RootKey
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeBucketKeyString ¶
ComputeBucketKeyString ...
func ComputeBucketKeyStringWithSeparator ¶
func ComputeBucketKeyStringWithSeparator[R RootKey, K Key]( elemCount uint64, rootKey R, key K, separator string, ) string
ComputeBucketKeyStringWithSeparator ...
func NewBucketUnmarshaler ¶
func NewBucketUnmarshaler[T Value]( unmarshaler item.Unmarshaler[T], ) func(data []byte) (Bucket[T], error)
NewBucketUnmarshaler ...
Types ¶
type BucketKey ¶
BucketKey ...
type Filler ¶
type Filler[T any, R any] func(ctx context.Context, rootKey R, hashRange HashRange) func() ([]T, error)
Filler ...
func NewMultiGetFiller ¶
func NewMultiGetFiller[T any, R comparable, K Key]( multiGetFunc func(ctx context.Context, keys []FillKey[R]) ([]T, error), getRootKey func(v T) R, getKey func(v T) K, ) Filler[T, R]
NewMultiGetFiller converts from function often using SELECT WHERE IN into a Filler[T, R] that allow to be passed to New
type HashRange ¶
HashRange for range of value [begin, end] includes both ends More specific: begin <= h <= end For each hash value h
type Map ¶
Map ...
func New ¶
func New[T Value, R RootKey, K Key]( pipeline memproxy.Pipeline, unmarshaler item.Unmarshaler[T], filler Filler[T, R], getKeyFunc func(v T) K, options ...MapOption, ) *Map[T, R, K]
New ...
func (*Map[T, R, K]) Get ¶
func (m *Map[T, R, K]) Get( ctx context.Context, elemCount uint64, rootKey R, key K, ) func() (Option[T], error)
Get from Map The elemCount need *NOT* be exact, but *MUST* be monotonically increasing Otherwise Map can return incorrect values
func (*Map[T, R, K]) GetItemStats ¶
GetItemStats returns the underlining item stats
type RootKey ¶
type RootKey interface { item.Key // AvgBucketSizeLog returns the logarithm base 2 of expected average size per bucket // values should be between [0, 8] // value = 0 => average 1 element per bucket // value = 3 => average 8 elements per bucket AvgBucketSizeLog() uint8 }
RootKey constraints
Click to show internal directories.
Click to hide internal directories.