sharding

package
v0.0.0-rc11 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnShardingKeyGen

func ColumnShardingKeyGen(col string) func(row abstract.ChangeItem) string

func GetShardIndexUserMapping

func GetShardIndexUserMapping(cfg model.ChSinkParams) map[string]int

Types

type ShardID

type ShardID int

type ShardMap

type ShardMap[T any] map[ShardID]T

func ShardsFromSinkParams

func ShardsFromSinkParams(shards map[string][]string) ShardMap[[]string]

func (ShardMap[T]) Shard

func (s ShardMap[T]) Shard(id ShardID) T

func (ShardMap[T]) Shards

func (s ShardMap[T]) Shards() []ShardID

type Sharder

type Sharder func(row abstract.ChangeItem) ShardID

func CHSharder

func CHSharder(cfg model.ChSinkParams, transferID string) Sharder

func ConstSharder

func ConstSharder() Sharder

func KeyGenHashHandler

func KeyGenHashHandler(keygen func(row abstract.ChangeItem) string, shardCnt int) Sharder

func KeyGenUserMappingHandler

func KeyGenUserMappingHandler(keygen func(row abstract.ChangeItem) string, mapping map[string]int, shardsCnt int) Sharder

func RoundRobinSharder

func RoundRobinSharder(shardCnt int) Sharder

type Shards

type Shards[T any] interface {
	Shard(id ShardID) T
	Shards() []ShardID
}

Jump to

Keyboard shortcuts

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