Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MasterCfg ¶
type MasterCfg struct { // basic Ctx context.Context TTL int64 // masterController elect keepalive ttl Node models.Node Repo state.Repository // factory DiscoveryFactory discovery.Factory RepoFactory state.RepositoryFactory }
MasterCfg represents the config for masterController creating
type MasterController ¶
type MasterController interface { // Start starts master do election master, if success build master context, // starts state machine do cluster coordinate such metadata, cluster state etc. Start() error // IsMaster returns current node if is master IsMaster() bool // GetMaster returns the current master info GetMaster() *models.Master // Stop stops master if current node is master, cleanup master context and stops state machine Stop() // FlushDatabase submits the coordinator task for flushing memory database by cluster and database name FlushDatabase(cluster string, databaseName string) error // GetStateManager returns master's state manager. GetStateManager() masterpkg.StateManager // WatchMasterElected adds callback after master finished election. WatchMasterElected(fn func(master *models.Master)) }
MasterController represents all metadata/state controller, only has one active master in broker cluster. MasterController will control all storage cluster metadata, update state, then notify each broker node.
func NewMasterController ¶
func NewMasterController(cfg *MasterCfg) MasterController
NewMasterController create MasterController for current node
Click to show internal directories.
Click to hide internal directories.