Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExist = errors.New("discovery: id exist")
ErrExist represents an error in case of id already existed.
Functions ¶
Types ¶
type Discovery ¶
type Discovery interface { // Register registers a service, if nx is true, the id must not exist. // Otherwise, ErrExist returned. If ttl > 0, the service has a expires time. Register(ctx context.Context, name, id, content string, nx bool, ttl time.Duration) error // Unregister unregisters a service Unregister(ctx context.Context, name, id string) error // Find finds service by name and id Find(ctx context.Context, name, id string) (content string, err error) // Resolve resolves any one service by name Resolve(ctx context.Context, name string) (id, content string, err error) // Resolve resolves all services by name ResolveAll(ctx context.Context, name string) (map[string]string, error) }
Discovery represents a interface for service discovery
Click to show internal directories.
Click to hide internal directories.