Documentation
¶
Index ¶
- Variables
- type ClusterMember
- type ClusteredRegistry
- func (c *ClusteredRegistry) Close()
- func (c *ClusteredRegistry) GetNode(id string) (*NodeDescriptor, error)
- func (c *ClusteredRegistry) GetNodes() ([]*NodeDescriptor, error)
- func (c *ClusteredRegistry) NewNode(addr string) (Node, error)
- func (c *ClusteredRegistry) Owner(token []byte) string
- func (c *ClusteredRegistry) WatchNodes(ctx context.Context) <-chan []*NodeDescriptor
- type Node
- type NodeAddress
- type NodeDescriptor
- type Observer
- type Reader
- type Watcher
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNodeNotFound = errors.New("endpoint not found")
)
Functions ¶
This section is empty.
Types ¶
type ClusterMember ¶
type ClusterMember struct {
// contains filtered or unexported fields
}
func (*ClusterMember) Deregister ¶
func (c *ClusterMember) Deregister(ctx context.Context) error
func (*ClusterMember) GetWeight ¶
func (c *ClusterMember) GetWeight() uint32
func (*ClusterMember) ID ¶
func (c *ClusterMember) ID() string
func (*ClusterMember) SetWeight ¶
func (c *ClusterMember) SetWeight(weight uint32) error
type ClusteredRegistry ¶
type ClusteredRegistry struct {
// contains filtered or unexported fields
}
func NewClusteredRegistry ¶
func NewClusteredRegistry(cluster cluster.Cluster) *ClusteredRegistry
func (*ClusteredRegistry) Close ¶
func (c *ClusteredRegistry) Close()
func (*ClusteredRegistry) GetNode ¶
func (c *ClusteredRegistry) GetNode(id string) (*NodeDescriptor, error)
func (*ClusteredRegistry) GetNodes ¶
func (c *ClusteredRegistry) GetNodes() ([]*NodeDescriptor, error)
func (*ClusteredRegistry) Owner ¶
func (c *ClusteredRegistry) Owner(token []byte) string
func (*ClusteredRegistry) WatchNodes ¶
func (c *ClusteredRegistry) WatchNodes(ctx context.Context) <-chan []*NodeDescriptor
type Node ¶
type Node interface { // ID returns the Nodes ID. ID() string // Register registers the endpoint with zero weighting. // // The endpoint should be visible to other processes after registering. Register(ctx context.Context) error // Deregister removes the endpoint from the registry. // // The endpoint should not be visible to other processes after de-registering. Deregister(ctx context.Context) error // SetWeight sets the weight (without delay) of the endpoint. SetWeight(weight uint32) error // GetWeight returns the current weight of the endpoint. GetWeight() uint32 }
type NodeAddress ¶
type NodeDescriptor ¶
type NodeDescriptor struct { ID string `json:"id"` Address NodeAddress `json:"address"` Weight uint32 `json:"weight,omitempty"` }
type Reader ¶
type Reader interface { // GetNode returns the node descriptor corresponding to the id. // // If there is no endpoint registered with the provided ID, ErrNodeNotFound is returned. GetNode(id string) (*NodeDescriptor, error) // GetNodes returns the set of services that are currently registered. GetNodes() ([]*NodeDescriptor, error) // Owner returns the Node.ID of the node that owns the specified token. // // If no owner exists, an empty string is returned. Owner(token []byte) string }
type Watcher ¶
type Watcher interface { // WatchNodes returns a channel that emits the entire set of nodes when // a change occurs. The channel is closed when the observer is closed, // or when the provided context is cancelled. WatchNodes(ctx context.Context) <-chan []*NodeDescriptor }
Click to show internal directories.
Click to hide internal directories.