Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDHTNotInitialised = errors.New("dht is not initialised") ErrReplicasLessThanNodes = errors.New("replicas are lesser than physical nodes") )
Functions ¶
func InitialiseDHT ¶
func InitialiseDHT(shardCount int, seedNodes []string, replication int) (map[ShardID]ShardLocation, error)
Initialise creates a new distributed hash table from the inputs. Should be called only from bootstrap mode or while creating a new cluster.
Types ¶
type DHT ¶
type DHT interface { // GetLocation returns the location of the leader and follower slot and corresponding node GetShard(key string) (ShardLocation, error) GetLeaderShardsForNode(nodeID NodeID) []ShardID GetAllShardsForNode(nodeID NodeID) []ShardID // Load loads data from an already existing configuration. // This must be taken called after confirmation from the master Load(shards map[ShardID]ShardLocation) // Snapshot returns the current node vs slot ids map Snapshot() map[ShardID]ShardLocation }
DHT contains the location of a given key in a distributed data system.
type ShardLocation ¶
Click to show internal directories.
Click to hide internal directories.