shard

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckReplica

func CheckReplica(shardConfigs []*ShardConfig, expectedReplica uint) bool

Types

type ShardConfig

type ShardConfig struct {
	ShardId  uint64 `json:"shardId"`
	NumShard uint64 `json:"numShard"`
}

func (*ShardConfig) IsValid

func (config *ShardConfig) IsValid() bool

type ShardedNode

type ShardedNode struct {
	URL    string      `json:"url"`
	Config ShardConfig `json:"config"`
	// Latency RPC latency in milli seconds.
	Latency int64 `json:"latency"`
	// Since last updated timestamp.
	Since int64 `json:"since"`
}

func Select

func Select(nodes []*ShardedNode, expectedReplica uint, random bool) ([]*ShardedNode, bool)

select a set of given sharded node and make the data is replicated at least expctedReplica times return the selected nodes and if selection is successful

Jump to

Keyboard shortcuts

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