Documentation ¶
Index ¶
- func Register(ctx context.Context, session *concurrency.Session, name string, ...) ([]*pb.Endpoint, error)
- type EndpointRegistration
- type EndpointSet
- func (n *EndpointSet) Delete(k string)
- func (n *EndpointSet) Endpoints() []*pb.Endpoint
- func (n *EndpointSet) GetEndpoint(name string) (*pb.Endpoint, bool)
- func (n *EndpointSet) RandomEndpoint() *pb.Endpoint
- func (n *EndpointSet) RandomEndpointExcluding(name string) *pb.Endpoint
- func (n *EndpointSet) Reset(m map[string]string)
- func (n *EndpointSet) Set(k, v string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EndpointRegistration ¶
An EndpointRegistration specifies parameters for a presence endpoint registration. Addresses without ports will use the DefaultPort.
func NewRegistration ¶
func NewRegistration(prefix string, addrs []net.IP, port int) EndpointRegistration
NewRegistration creates a new EndpointRegistration.
type EndpointSet ¶
type EndpointSet struct {
// contains filtered or unexported fields
}
EndpointSet is a container of Endpoints that is synchronizable with the contents of a presence tree as created by Register().
Note that while an Endpoint might appear multiple times in the presence registry (before a stale lease expires, for instance), we deduplicate endpoints based on their Name.
func WatchEndpoints ¶
func WatchEndpoints(ctx context.Context, cli *clientv3.Client, prefix string) *EndpointSet
func WatchEndpointsReady ¶
func WatchEndpointsReady(ctx context.Context, cli *clientv3.Client, prefix string) (*EndpointSet, <-chan struct{})
func (*EndpointSet) Delete ¶
func (n *EndpointSet) Delete(k string)
Delete implements the watcher.Watchable interface.
func (*EndpointSet) Endpoints ¶
func (n *EndpointSet) Endpoints() []*pb.Endpoint
Endpoints returns all registered endpoints.
func (*EndpointSet) GetEndpoint ¶
func (n *EndpointSet) GetEndpoint(name string) (*pb.Endpoint, bool)
GetEndpoint returns a specific endpoint by host name.
func (*EndpointSet) RandomEndpoint ¶
func (n *EndpointSet) RandomEndpoint() *pb.Endpoint
RandomEndpoint returns a randomly selected Endpoint (or nil, if none are available).
func (*EndpointSet) RandomEndpointExcluding ¶
func (n *EndpointSet) RandomEndpointExcluding(name string) *pb.Endpoint
RandomEndpointExcluding returns a randomly selected Endpoint except for the named one (or nil, if none are available).
func (*EndpointSet) Reset ¶
func (n *EndpointSet) Reset(m map[string]string)
Reset implements the watcher.Watchable interface.
func (*EndpointSet) Set ¶
func (n *EndpointSet) Set(k, v string)
Set implements the watcher.Watchable interface.