Documentation ¶
Overview ¶
Package cluster exports an asynchronously updated model of the swarm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosing = errors.New("closing")
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface { // Context returns a context that SHALL expire before a call // to Stop() returns. Context() context.Context // Tick returns a channel that receives the current time // at regular intervals. Implementations SHOULD select a // tick interval that is smaller than the minimum expected // TTL for the cluster. Implementations MUST NOT close the // channel returned by Tick until c.Context() has expired. // Closing the channel returned by Tick() is OPTIONAL. Tick() <-chan time.Time // Stop closes the context returned by Context() and frees // all resources. Relay is guaranteed not to call Start() // after Stop() returns. Relay MAY however call Context() // after Stop() has returned. Stop() }
Clock tracks the passage of time, allowing Router to update its internal state and free resources when the clock has stopped. Clock's methods MUST be safe for concurrent access.
type Constraint ¶
type Constraint func(ConstraintStruct) error
type ConstraintStruct ¶
type ConstraintStruct = api.View_Constraint
type Iterator ¶
Iterator is a stateful object that enumerates routing records. See casm.Iterator() for important information on lifetime and error handling.
func (Iterator) Err ¶
Err reports any error encountered during iteration. Next will always return nil when Err() != nil.
type Query ¶
type Query func(QueryParams) error
func NewQuery ¶
func NewQuery(s Selector, cs ...Constraint) Query
type QueryParams ¶
type QueryParams interface { NewSelector() (api.View_Selector, error) NewConstraints(int32) (api.View_Constraint_List, error) }
type RecordBinder ¶
type RecordBinder interface {
BindRecord(api.View_Record) error
}
type Router ¶
type Router struct { Topic Topic Log log.Logger TTL time.Duration Meta pulse.Preparer Clock Clock RoutingTable RoutingTable // contains filtered or unexported fields }
Router is a peer participating in the cluster membership protocol. It maintains a global view of the cluster with PA/EL guarantees, and periodically announces its presence to others.
type RoutingTable ¶
type RoutingTable interface { Advance(time.Time) Upsert(routing.Record) (created bool) Snapshot() routing.Snapshot }
RoutingTable tracks the liveness of cluster peers and provides a simple API for querying routing information.
type Selector ¶
type Selector func(SelectorStruct) error
type SelectorStruct ¶
type SelectorStruct = api.View_Selector
type View ¶
func (View) Iter ¶
Iter returns an iterator that ranges over records matching the supplied query. Callers MUST call the ReleaseFunc when finished with the iterator. Callers MUST NOT call methods on the iterator after calling the ReleaseFunc.