Documentation ¶
Index ¶
- Constants
- func AddNode(oldPartionTable *[]VNode, assignNumbVNodes int, newNodeId string, ...) (*[]VNode, error)
- func GenerateNewPartitionTable(assignNumbVNodes int, nodeId string, nodeIp string, nodePort string) *[]VNode
- func GenerateUUID() string
- func GetHash(s []byte) uint64
- func GetHashForString(s string) uint64
- func GetRandom(max int) int
- func OrderInReverse(m *map[string]int) []string
- func PrintDataSyncTasks(tasks []DataSyncTask)
- func PrintDistribution(vnodes []VNode)
- func PrintReplicastDistribution(vnodes []VNode)
- func PrintVnodes(vnodes []VNode)
- func RemoveNode(oldPartionTable *[]VNode, oldNodeId string) *[]VNode
- func UpdateReplication(nodesInClusterReplicationLoad *map[string]int, nodeId string, ...)
- func VNodeToString(v VNode) string
- type DataSyncAction
- type DataSyncTask
- type DataSyncTaskStatus
- type HashLocation
- type PartitionTable
- type VNode
Constants ¶
View Source
const PT_KEY_NAME = "partitionTable"
View Source
const REPLICATION_FACTOR = 3
do not change this without extensive testing
Variables ¶
This section is empty.
Functions ¶
func GenerateUUID ¶
func GenerateUUID() string
func GetHashForString ¶
func OrderInReverse ¶
func PrintDataSyncTasks ¶
func PrintDataSyncTasks(tasks []DataSyncTask)
func PrintDistribution ¶
func PrintDistribution(vnodes []VNode)
************** FUNCTIONS USED DURING DEV *************************************************
func PrintReplicastDistribution ¶
func PrintReplicastDistribution(vnodes []VNode)
func PrintVnodes ¶
func PrintVnodes(vnodes []VNode)
func RemoveNode ¶
func UpdateReplication ¶
func VNodeToString ¶
Types ¶
type DataSyncAction ¶
type DataSyncAction uint8
const ( SendData DataSyncAction = iota SendDataForReplication DeleteData )
func (DataSyncAction) String ¶
func (s DataSyncAction) String() string
type DataSyncTask ¶
type DataSyncTask struct { ID string StartToken uint64 EndToken uint64 Status DataSyncTaskStatus FromNodeId string ToNodeId string VNodeId string Action DataSyncAction Progress uint64 //to save which data have been already sent ProgressCollection string //to save at which collection the progress is PartionTableTimestamp uint64 Error error }
type DataSyncTaskStatus ¶
type DataSyncTaskStatus uint8
const ( NewTask DataSyncTaskStatus = iota Streaming SuspendedForError CompletedMessageNotSent Completed )
func (DataSyncTaskStatus) String ¶
func (s DataSyncTaskStatus) String() string
type HashLocation ¶
type PartitionTable ¶
func InitEmptyPartitionTable ¶
func InitEmptyPartitionTable() *PartitionTable
func InitPartitionTable ¶
func InitPartitionTable(nodes []VNode, timstamp int64) *PartitionTable
func LoadFromDb ¶
func LoadFromDb(systemDb *storage.Collection) (*PartitionTable, error)
func (*PartitionTable) CalculateDataSyncTasks ¶
func (pt *PartitionTable) CalculateDataSyncTasks(nodeId string, newPartitionTable *PartitionTable) []DataSyncTask
func (*PartitionTable) GetLocation ¶
func (pt *PartitionTable) GetLocation(hash uint64) HashLocation
func (*PartitionTable) PrintToStdOut ¶
func (pt *PartitionTable) PrintToStdOut()
func (*PartitionTable) SaveToDb ¶
func (pt *PartitionTable) SaveToDb(systemDb *storage.Collection) error
type VNode ¶
type VNode struct { StartToken uint64 `json:"startToken"` //included in this vnode ring EndToken uint64 `json:"endToken"` //included in this vnode ring NodeId string `json:"nodeId"` NodeIp string `json:"nodeIp"` NodePort string `json:"nodePort"` ReplicatedTo []string `json:"replicatedTo"` VNodeID string `json:"vNodeId"` PrevNodeID string `json:"prevVNodeId"` //the node that previously owned this vnode PrevReplicatedTo []string `json:"prevReplicatedTo"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.