Documentation
¶
Overview ¶
Package daemondata implements daemon journaled data
import "opensvc.com/opensvc/daemon/daemondata" cmdC, cancel := daemondata.Start(context.Background()) defer cancel() dataBus := daemondata.New(cmdC)
status := dataBus.ClusterData() // retrieve daemon data bus.ApplyFull("remote-1", remoteNodeStatus) bus.ApplyPatch("remote-1", patchMsg) bus.CommitPending(context.Background()) status = bus.ClusterData() localNodeStatus := bus.GetLocalNodeStatus()
Index ¶
- Variables
- func BusFromContext(ctx context.Context) chan<- Caller
- func ContextWithBus(parent context.Context, cmd chan<- Caller) context.Context
- func PropagationInterval() time.Duration
- func Start(parent context.Context, drainDuration time.Duration, subQS pubsub.QueueSizer) (chan<- Caller, chan<- *hbtype.Msg, context.CancelFunc)
- type Caller
- type HbMessageType
- type T
Constants ¶
This section is empty.
Variables ¶
var (
ErrDrained = errors.New("drained command")
)
Functions ¶
func BusFromContext ¶
BusFromContext function returns the command chan stored in the context
func ContextWithBus ¶
ContextWithBus function returns copy of parent, including the daemon data command chan.
func PropagationInterval ¶
Types ¶
type Caller ¶
type Caller interface { SetError(error) // contains filtered or unexported methods }
Caller defines interface to implement for daemondata loop cmd processing the function will hold the daemondata loop while running
err := Caller.call(ctx, d) Caller.SetError(err)
type HbMessageType ¶
type T ¶
type T struct {
// contains filtered or unexported fields
}
T struct holds a daemondata manager cmdC to submit orders
func FromContext ¶
func (T) ClusterData ¶
func (t T) ClusterData() *clusterdump.Data
ClusterData returns deep copy of status
func (T) ClusterNodeData ¶
ClusterNodeData returns deep copy of cluster node data for node n. It returns nil when node n is not found in cluster data.
func (T) DaemonRefresh ¶
func (t T) DaemonRefresh()
DaemonRefresh updates the private dataset of a daemon subsystem (scheduler, dns, ...)
func (T) DropPeerNode ¶
DropPeerNode is a public method to drop peer node from t. It uses private call to func (d *data) dropPeer. It is used by a node stale detector to call drop peer on stale <peer> detection.
func (T) GetHbMessageType ¶
func (t T) GetHbMessageType() HbMessageType
GetHbMessageType returns either "undef", "ping", "full" or "patch" Used by nmon start up to determine if rejoin can be skipped.
func (T) SetHBSendQ ¶
SetHBSendQ defines daemondata hbSendQ. The hbSendQ is used during queueNewHbMsg to push heartbeat message to this queue, see usage example for hb msgToTx multiplexer Example:
msgC := make(chan hbtype.Msg) SetHBSendQ(msgC) // inform daemondata we are listening on this queue defer SetHBSendQ(nil) // inform daemondata, we are not anymore reading on this queue for { select { case msg := <- msgC: ... case <-ctx.Done(): return } }