sharding

package
v2.0.0-...-acbaf60 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigDB = "config"

	SettingsCol   = "settings"
	ShardCol      = "shards"
	ChunkCol      = "chunks"
	CollectionCol = "collections"

	HashedShard = "hashed"
	RangedShard = "ranged"
)

Variables

This section is empty.

Functions

func GetBalancerStatusByUrl

func GetBalancerStatusByUrl(csUrl string) (bool, error)

get balancer status from config server

func GetColShardType

func GetColShardType(conn *utils.MongoCommunityConn, namespace string) ([]string, string, error)

input given namespace, return all keys and shard type(range or hashed)

func TestSharding

func TestSharding(t *testing.T)

Types

type ChunkRange

type ChunkRange struct {
	// the minimum/maximum of the chunk range of multiple columns shard key has multiple values
	Mins []interface{}
	Maxs []interface{}
}

type DBChunkMap

type DBChunkMap map[string]*ShardCollection

type ShardCollection

type ShardCollection struct {
	Chunks []*ChunkRange
	// shard key may have multiple columns, for example {a:1, b:1, c:1}
	Keys      []string
	ShardType string
}

type ShardCollectionSpec

type ShardCollectionSpec struct {
	Ns     string
	Key    bson.D
	Unique bool
}

type ShardingChunkMap

type ShardingChunkMap map[string]map[string]*ShardCollection

{replset: {namespace: []ChunkRange} }

func GetChunkMapByUrl

func GetChunkMapByUrl(csUrl string) (ShardingChunkMap, error)

Jump to

Keyboard shortcuts

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