Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteBusWatchLoop ¶
func ExecuteBusWatchLoop( ctx context.Context, b bus.Bus, engineID string, write bool, objLoop *WatchLoop, ) error
ExecuteBusWatchLoop executes an existing WatchLoop with a Bus engine.
func WaitForObjectRev ¶
func WaitForObjectRev( ctx context.Context, le *logrus.Entry, ws world.WorldState, objKey string, rev uint64, ) (world.ObjectState, error)
WaitForObjectRev waits for the object to exist equal at or greater than the given rev. If rev=0, waits for the object to exist at any rev.
Types ¶
type WatchLoop ¶
type WatchLoop struct {
// contains filtered or unexported fields
}
WatchLoop is a utility for building Controllers which bind to world state, running reconciliation loops until the world reaches a desired state.
func NewBusWatchLoop ¶
func NewBusWatchLoop( ctx context.Context, le *logrus.Entry, b bus.Bus, engineID string, write bool, objectKey string, handler WatchLoopHandler, ) (*WatchLoop, *world.BusEngine, world.WorldState)
NewBusWatchLoop constructs a new BusEngine which attaches to an engine running on a controller bus.
func NewWatchLoop ¶
func NewWatchLoop( le *logrus.Entry, objectKey string, handler WatchLoopHandler, ) *WatchLoop
NewWatchLoop constructs a new Control Loop which looks up an Engine on the Bus and calls the Callback when the state changes.
objectKey may be empty le may be nil
type WatchLoopHandler ¶
type WatchLoopHandler = func( ctx context.Context, le *logrus.Entry, world world.WorldState, obj world.ObjectState, rootRef *bucket.ObjectRef, objRev uint64, ) (waitForChanges bool, err error)
WatchLoopHandler is the callback function for the WatchLoop. le may be nil
func NewWaitForStateHandler ¶
func NewWaitForStateHandler( cb func( ctx context.Context, ws world.WorldState, obj world.ObjectState, rootCs *block.Cursor, rev uint64, ) (bool, error), ) WatchLoopHandler
NewWaitForStateHandler constructs a WatchLoopHandler to wait for a state.