discovery

package
v0.0.0-...-034a78d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL