Documentation ¶
Index ¶
- Variables
- func DecodeRev(b service.Revision) (uint64, error)
- func EncodeRev(revNum uint64) service.Revision
- func WaitForWantedNodes(cfg cbgt.Cfg, wantedNodes []string, cancelCh <-chan struct{}, secs int) ([]string, error)
- type Ctl
- func (ctl *Ctl) ChangeTopology(changeTopology *CtlChangeTopology, cb CtlOnProgressFunc) (topology *CtlTopology, err error)
- func (ctl *Ctl) GetTopology() *CtlTopology
- func (ctl *Ctl) IndexDefsChanged() (err error)
- func (ctl *Ctl) Stop() error
- func (ctl *Ctl) StopChangeTopology(rev string)
- func (ctl *Ctl) WaitGetTopology(haveRev string, cancelCh <-chan struct{}) (*CtlTopology, error)
- type CtlChangeTopology
- type CtlMgr
- func (m *CtlMgr) CancelTask(taskId string, taskRev service.Revision) error
- func (m *CtlMgr) GetCurrentTopology(haveTopologyRev service.Revision, cancelCh service.Cancel) (*service.Topology, error)
- func (m *CtlMgr) GetNodeInfo() (*service.NodeInfo, error)
- func (m *CtlMgr) GetTaskList(haveTasksRev service.Revision, cancelCh service.Cancel) (*service.TaskList, error)
- func (m *CtlMgr) PrepareTopologyChange(change service.TopologyChange) error
- func (m *CtlMgr) Shutdown() error
- func (m *CtlMgr) StartTopologyChange(change service.TopologyChange) error
- type CtlNode
- type CtlOnProgressFunc
- type CtlOptions
- type CtlTopology
Constants ¶
This section is empty.
Variables ¶
var ErrCtlCanceled = service.ErrCanceled
var ErrCtlWrongRev = service.ErrConflict
Functions ¶
func WaitForWantedNodes ¶
func WaitForWantedNodes(cfg cbgt.Cfg, wantedNodes []string, cancelCh <-chan struct{}, secs int) ( []string, error)
WaitForWantedNodes blocks until the nodeDefsWanted in the cfg is equal to or a superset of the provided wantedNodes, and returns the "nodes to remove" (actualWantedNodes SET-DIFFERENCE wantedNodes).
Types ¶
type Ctl ¶
type Ctl struct {
// contains filtered or unexported fields
}
An Ctl might be in the midst of controlling a replan/rebalance, where ctl.ctlDoneCh will be non-nil.
If we're in the midst of a replan/rebalance, and another topology change request comes in, we stop any existing work and then start off a new replan/rebalance, because the new topology change request will have the latest, wanted topology. This might happen if some stopChangeTopology request or signal got lost somewhere.
func (*Ctl) ChangeTopology ¶
func (ctl *Ctl) ChangeTopology(changeTopology *CtlChangeTopology, cb CtlOnProgressFunc) (topology *CtlTopology, err error)
ChangeTopology starts an asynchonous change topology operation, if there's no input error. ChangeTopology also synchronously stops any previous, inflight change topology operation, if any, before kicking off the new change topology operation.
func (*Ctl) GetTopology ¶
func (ctl *Ctl) GetTopology() *CtlTopology
GetTopology retrieves the current topology.
func (*Ctl) IndexDefsChanged ¶
When the index definitions have changed, our approach is to run the planner, but only for brand new indexes that don't have any pindexes yet.
func (*Ctl) StopChangeTopology ¶
StopChangeTopology synchronously stops a current change topology operation.
func (*Ctl) WaitGetTopology ¶
func (ctl *Ctl) WaitGetTopology(haveRev string, cancelCh <-chan struct{}) ( *CtlTopology, error)
WaitGetTopology is like GetTopology() but will synchronously block until there's a rev change.
type CtlChangeTopology ¶
type CtlChangeTopology struct { Rev string // Works as CAS, so use the last Topology response’s Rev. // Use Mode of "failover-hard" for hard failover. // Use Mode of "failover-graceful" for graceful failover. // Use Mode of "rebalance" for rebalance-style, clean and safe topology change. Mode string // The MemberNodeUUIDs are the service nodes that should remain in // the service cluster after the topology change is finished. // When Mode is a variant of failover, then there should not be // any new nodes added to the MemberNodes (only service node // removal is allowed on failover). MemberNodeUUIDs []string }
type CtlMgr ¶
type CtlMgr struct {
// contains filtered or unexported fields
}
CtlMgr implements the cbauth/service.Manager interface and provides the adapter or glue between ns-server's service API and cbgt's Ctl implementation.
func (*CtlMgr) CancelTask ¶
func (*CtlMgr) GetCurrentTopology ¶
func (*CtlMgr) GetTaskList ¶
func (*CtlMgr) PrepareTopologyChange ¶
func (m *CtlMgr) PrepareTopologyChange( change service.TopologyChange) error
func (*CtlMgr) StartTopologyChange ¶
func (m *CtlMgr) StartTopologyChange(change service.TopologyChange) error
type CtlNode ¶
type CtlOnProgressFunc ¶
type CtlOnProgressFunc func( maxNodeLen, maxPIndexLen int, seenNodes map[string]bool, seenNodesSorted []string, seenPIndexes map[string]bool, seenPIndexesSorted []string, progressEntries map[string]map[string]map[string]*rebalance.ProgressEntry, errs []error, ) string
CtlOnProgressFunc defines the callback func signature that's invoked during change topology operations.
type CtlOptions ¶
type CtlTopology ¶
type CtlTopology struct { // Rev is a CAS opaque identifier. Any change to any CtlTopology // field will mean a Rev change. Rev string // MemberNodes lists what the service thinks are the currently // "confirmed in" service nodes in the system. MemberNodes field // can change during the midst of a topology change, but it is // service specific on when and how MemberNodes will change and // stabilize. MemberNodes []CtlNode // PrevWarnings holds the warnings from the previous operations // and topology changes. NOTE: If the service manager (i.e., Ctl) // restarts, it may "forget" its previous PrevWarnings // field value (as perhaps it was only tracked in memory). PrevWarnings map[string][]string // PrevErrs holds the errors from the previous operations and // topology changes. NOTE: If the service manager (i.e., Ctl) // restarts, it may "forget" its previous PrevErrs field value // (as perhaps it was only tracked in memory). PrevErrs []error // ChangeTopology will be non-nil when a service topology change // is in progress. ChangeTopology *CtlChangeTopology }