Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discovery ¶
type Discovery interface { // Discovery starts discovery resources change, includes create/delete/clean Discovery() error // Close stops watch, trigger all resource cleanup callback Close() }
Discovery represents discovery resources, through watch resource's prefix
func NewDiscovery ¶
func NewDiscovery(repo state.Repository, prefix string, listener Listener) Discovery
NewDiscovery returns a Discovery who will watch the changes with the given prefix
type Listener ¶
type Listener interface { // OnCreate is resource creation callback OnCreate(key string, resource []byte) // OnDelete is resource deletion callback OnDelete(key string) // Cleanup cleans all resources Cleanup() }
Listener represents discovery resource event callback interface, includes create/delete/cleanup operation
type Registry ¶
type Registry interface { // Register registers node info, add it to active node list for discovery Register(node models.Node) error // Deregister deregister node info, remove it from active list Deregister(node models.Node) error // Close closes registry, releases resources Close() error }
Registry represents server node register
func NewRegistry ¶
func NewRegistry(repo state.Repository, prefix string, ttl int64) Registry
NewRegistry returns a new registry with prefix and ttl
Click to show internal directories.
Click to hide internal directories.