Versions in this module Expand all Collapse all v0 v0.3.1 Sep 13, 2023 v0.3.0 Sep 12, 2023 v0.2.0 Jul 16, 2023 Changes in this version + const MetadataPrefix + type FailoverTask struct + Cluster string + Err string + FinishTime int64 + Namespace string + Node metadata.NodeInfo + ProbeCount int + QueuedTime int64 + ShardIdx int + StartTime int64 + Status int + Type int type MigrationTask + Slot int + SourceNode *metadata.NodeInfo + TargetNode *metadata.NodeInfo type Storage + func (s *Storage) AddMigratingTask(ctx context.Context, task *MigrationTask) error + func (s *Storage) GetMigratingTask(ctx context.Context, ns, cluster string) (*MigrationTask, error) + func (s *Storage) RemoveMigratingTask(ctx context.Context, ns, cluster string) error v0.1.0 May 14, 2023 Changes in this version + const CommandAddSlots + const CommandCreate + const CommandMigrateSlots + const CommandRemove + const CommandRemoveSlots + const CommandUpdate + const NamespacePrefix + var ErrNoLeaderOrNotReady = errors.New("the current node role isn't leader or the state is NOT ready") + type Command int + type Event struct + Cluster string + Command Command + Data interface{} + Namespace string + NodeID string + Shard int + Type EventType + type EventType int + const EventCluster + const EventNamespace + const EventNode + const EventShard + type FailOverTask struct + Cluster string + Err string + FinishTime int64 + Namespace string + Node metadata.NodeInfo + ProbeCount int + QueuedTime int64 + ShardIdx int + StartTime int64 + Status int + Type int + type MigrationTask struct + Cluster string + ErrorDetail string + FinishTime int64 + MigratingSlot int + Namespace string + PendingTime int64 + PlanSlots []metadata.SlotRange + Source int + StartTime int64 + Status int + SubID uint64 + Target int + TaskID uint64 + type Storage struct + func NewStorage(persist persistence.Persistence) (*Storage, error) + func (s *Storage) AddFailOverHistory(ctx context.Context, task *FailOverTask) error + func (s *Storage) AddMigrateHistory(ctx context.Context, task *MigrationTask) error + func (s *Storage) AddMigrateTask(ctx context.Context, task *MigrationTask) error + func (s *Storage) AddPendingMigrateTask(ctx context.Context, ns, cluster string, tasks []*MigrationTask) error + func (s *Storage) AddShardSlots(ctx context.Context, ns, cluster string, shardIdx int, ...) error + func (s *Storage) Close() error + func (s *Storage) ClusterNodesCounts(ctx context.Context, ns, cluster string) (int, error) + func (s *Storage) CreateCluster(ctx context.Context, ns string, clusterInfo *metadata.Cluster) error + func (s *Storage) CreateNamespace(ctx context.Context, ns string) error + func (s *Storage) CreateNode(ctx context.Context, ns, cluster string, shardIdx int, node *metadata.NodeInfo) error + func (s *Storage) CreateShard(ctx context.Context, ns, cluster string, shard *metadata.Shard) error + func (s *Storage) EmitEvent(event Event) + func (s *Storage) GetClusterInfo(ctx context.Context, ns, cluster string) (*metadata.Cluster, error) + func (s *Storage) GetFailOverHistory(ctx context.Context, ns, cluster string) ([]*FailOverTask, error) + func (s *Storage) GetFailOverTask(ctx context.Context, ns, cluster string) (*FailOverTask, error) + func (s *Storage) GetMasterNode(ctx context.Context, ns, cluster string, shardIdx int) (metadata.NodeInfo, error) + func (s *Storage) GetMigrateHistory(ctx context.Context, ns, cluster string) ([]*MigrationTask, error) + func (s *Storage) GetMigrateTask(ctx context.Context, ns, cluster string) (*MigrationTask, error) + func (s *Storage) GetPendingMigrateTasks(ctx context.Context, ns, cluster string) ([]*MigrationTask, error) + func (s *Storage) GetShard(ctx context.Context, ns, cluster string, shardIdx int) (*metadata.Shard, error) + func (s *Storage) HasSlot(ctx context.Context, ns, cluster string, shardIdx, slot int) (bool, error) + func (s *Storage) IsClusterExists(ctx context.Context, ns, cluster string) (bool, error) + func (s *Storage) IsLeader() bool + func (s *Storage) IsMigrateHistoryExists(ctx context.Context, task *MigrationTask) (bool, error) + func (s *Storage) IsMigrateTaskExists(ctx context.Context, ns, cluster string, taskID uint64) (bool, error) + func (s *Storage) IsNamespaceExists(ctx context.Context, ns string) (bool, error) + func (s *Storage) IsReady() bool + func (s *Storage) Leader() string + func (s *Storage) LeaderChange() <-chan bool + func (s *Storage) ListCluster(ctx context.Context, ns string) ([]string, error) + func (s *Storage) ListNamespace(ctx context.Context) ([]string, error) + func (s *Storage) ListNodes(ctx context.Context, ns, cluster string, shardIdx int) ([]metadata.NodeInfo, error) + func (s *Storage) ListShard(ctx context.Context, ns, cluster string) ([]metadata.Shard, error) + func (s *Storage) Load(ctx context.Context) error + func (s *Storage) Notify() <-chan Event + func (s *Storage) PromoteNewMaster(ctx context.Context, ns, cluster string, shardIdx int, oldMasterNodeID string) error + func (s *Storage) RemoveCluster(ctx context.Context, ns, cluster string) error + func (s *Storage) RemoveNamespace(ctx context.Context, ns string) error + func (s *Storage) RemoveNode(ctx context.Context, ns, cluster string, shardIdx int, nodeID string) error + func (s *Storage) RemovePendingMigrateTask(ctx context.Context, task *MigrationTask) error + func (s *Storage) RemoveShard(ctx context.Context, ns, cluster string, shardIdx int) error + func (s *Storage) RemoveShardSlots(ctx context.Context, ns, cluster string, shardIdx int, ...) error + func (s *Storage) Stop() error + func (s *Storage) UpdateCluster(ctx context.Context, ns string, clusterInfo *metadata.Cluster) error + func (s *Storage) UpdateFailOverTask(ctx context.Context, task *FailOverTask) error + func (s *Storage) UpdateMigrateSlotInfo(ctx context.Context, ns, cluster string, sourceIdx, targetIdx, slot int) error + func (s *Storage) UpdateNode(ctx context.Context, ns, cluster string, shardIdx int, node *metadata.NodeInfo) error