Documentation ¶
Index ¶
- Variables
- func Deregister(ctx context.Context, s *Service) error
- func Register(ctx context.Context, s *Service, opts ...RegisterOption) error
- func String() string
- type DeregisterOption
- type DeregisterOptions
- type Endpoint
- type Event
- type EventType
- type GetOption
- type GetOptions
- type ListOption
- type ListOptions
- type Node
- type OpenAPIOption
- type OpenAPIOptions
- type Option
- type Options
- type RegisterOption
- type RegisterOptions
- type Registry
- type Result
- type Service
- type Value
- type WatchOption
- type WatchOptions
- type Watcher
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type DeregisterOption ¶
type DeregisterOption func(*DeregisterOptions)
type DeregisterOptions ¶
type DeregisterOptions struct { }
type Endpoint ¶ added in v0.23.0
type Endpoint struct { Name string `json:"name,omitempty"` Request *Value `json:"request,omitempty"` Response *Value `json:"response,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` }
Endpoint is a endpoint provided by a service
type Event ¶ added in v0.23.0
type Event struct { // Event Id Id string `json:"id,omitempty"` // type of event Type EventType `json:"type,omitempty"` // unix timestamp of event Timestamp int64 `json:"timestamp,omitempty"` // service entry Service *Service `json:"service,omitempty"` }
Event is registry event
type GetOption ¶
type GetOption func(*GetOptions)
type GetOptions ¶
type GetOptions struct { }
type ListOption ¶
type ListOption func(*ListOptions)
type ListOptions ¶
type ListOptions struct { }
type Node ¶ added in v0.23.0
type Node struct { Id string `json:"id,omitempty"` Address string `json:"address,omitempty"` Port int64 `json:"port,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` }
Node represents the node the service is on
type OpenAPIOption ¶
type OpenAPIOption func(*OpenAPIOptions)
type OpenAPIOptions ¶
type OpenAPIOptions struct { }
type RegisterOption ¶
type RegisterOption func(*RegisterOptions)
func RegisterTTL ¶
func RegisterTTL(t time.Duration) RegisterOption
type RegisterOptions ¶
type Registry ¶
type Registry interface { Init(...Option) error Options() Options Register(context.Context, *Service, ...RegisterOption) error Deregister(context.Context, *Service, ...DeregisterOption) error GetService(context.Context, string, ...GetOption) ([]*Service, error) ListServices(context.Context, ...ListOption) ([]*Service, error) Watch(context.Context, ...WatchOption) (Watcher, error) String() string }
Registry the registry provides an interface for service discovery and an abstraction over varying implementations {consul, etcd, zookeeper, ...}
type Result ¶ added in v0.23.0
type Result struct { Action string `json:"action,omitempty"` Service *Service `json:"service,omitempty"` Timestamp int64 `json:"timestamp,omitempty"` }
Result is returns by the watcher
type Service ¶ added in v0.23.0
type Service struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` Endpoints []*Endpoint `json:"endpoints,omitempty"` Nodes []*Node `json:"nodes,omitempty"` TTL int64 `json:"ttl,omitempty"` }
Service represents a vine service
func GetService ¶
GetService retrieve a service. A slice is returned since we separate Name/Version.
type Value ¶ added in v0.23.0
type Value struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Values []*Value `json:"values,omitempty"` }
Value is an opaque value for a request or response
type WatchOption ¶
type WatchOption func(*WatchOptions)
type WatchOptions ¶
type WatchOptions struct { // Specify a service to watch // If blank, the watch is for all services Service string }
Click to show internal directories.
Click to hide internal directories.