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
- func (in *Endpoint) DeepCopyInto(out *Endpoint)
- func (*Endpoint) Descriptor() ([]byte, []int)
- func (m *Endpoint) Marshal() (dAtA []byte, err error)
- func (m *Endpoint) MarshalTo(dAtA []byte) (int, error)
- func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Endpoint) ProtoMessage()
- func (m *Endpoint) Reset()
- func (m *Endpoint) String() string
- func (m *Endpoint) Unmarshal(dAtA []byte) error
- func (m *Endpoint) XSize() (n int)
- func (m *Endpoint) XXX_DiscardUnknown()
- func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Endpoint) XXX_Merge(src proto.Message)
- func (m *Endpoint) XXX_Size() int
- func (m *Endpoint) XXX_Unmarshal(b []byte) error
- type Event
- func (in *Event) DeepCopyInto(out *Event)
- func (*Event) Descriptor() ([]byte, []int)
- func (m *Event) Marshal() (dAtA []byte, err error)
- func (m *Event) MarshalTo(dAtA []byte) (int, error)
- func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Event) ProtoMessage()
- func (m *Event) Reset()
- func (m *Event) String() string
- func (m *Event) Unmarshal(dAtA []byte) error
- func (m *Event) XSize() (n int)
- func (m *Event) XXX_DiscardUnknown()
- func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Event) XXX_Merge(src proto.Message)
- func (m *Event) XXX_Size() int
- func (m *Event) XXX_Unmarshal(b []byte) error
- type GetOption
- type GetOptions
- type ListOption
- type ListOptions
- type Node
- func (in *Node) DeepCopyInto(out *Node)
- func (*Node) Descriptor() ([]byte, []int)
- func (m *Node) Marshal() (dAtA []byte, err error)
- func (m *Node) MarshalTo(dAtA []byte) (int, error)
- func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Node) ProtoMessage()
- func (m *Node) Reset()
- func (m *Node) String() string
- func (m *Node) Unmarshal(dAtA []byte) error
- func (m *Node) XSize() (n int)
- func (m *Node) XXX_DiscardUnknown()
- func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Node) XXX_Merge(src proto.Message)
- func (m *Node) XXX_Size() int
- func (m *Node) XXX_Unmarshal(b []byte) error
- type OpenAPIOption
- type OpenAPIOptions
- type Option
- type Options
- type RegisterOption
- type RegisterOptions
- type Registry
- type Result
- func (in *Result) DeepCopyInto(out *Result)
- func (*Result) Descriptor() ([]byte, []int)
- func (m *Result) Marshal() (dAtA []byte, err error)
- func (m *Result) MarshalTo(dAtA []byte) (int, error)
- func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Result) ProtoMessage()
- func (m *Result) Reset()
- func (m *Result) String() string
- func (m *Result) Unmarshal(dAtA []byte) error
- func (m *Result) XSize() (n int)
- func (m *Result) XXX_DiscardUnknown()
- func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Result) XXX_Merge(src proto.Message)
- func (m *Result) XXX_Size() int
- func (m *Result) XXX_Unmarshal(b []byte) error
- type Service
- func (in *Service) DeepCopyInto(out *Service)
- func (*Service) Descriptor() ([]byte, []int)
- func (m *Service) Marshal() (dAtA []byte, err error)
- func (m *Service) MarshalTo(dAtA []byte) (int, error)
- func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Service) ProtoMessage()
- func (m *Service) Reset()
- func (m *Service) String() string
- func (m *Service) Unmarshal(dAtA []byte) error
- func (m *Service) XSize() (n int)
- func (m *Service) XXX_DiscardUnknown()
- func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Service) XXX_Merge(src proto.Message)
- func (m *Service) XXX_Size() int
- func (m *Service) XXX_Unmarshal(b []byte) error
- type Value
- func (in *Value) DeepCopyInto(out *Value)
- func (*Value) Descriptor() ([]byte, []int)
- func (m *Value) Marshal() (dAtA []byte, err error)
- func (m *Value) MarshalTo(dAtA []byte) (int, error)
- func (m *Value) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Value) ProtoMessage()
- func (m *Value) Reset()
- func (m *Value) String() string
- func (m *Value) Unmarshal(dAtA []byte) error
- func (m *Value) XSize() (n int)
- func (m *Value) XXX_DiscardUnknown()
- func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Value) XXX_Merge(src proto.Message)
- func (m *Value) XXX_Size() int
- func (m *Value) XXX_Unmarshal(b []byte) error
- type WatchOption
- type WatchOptions
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var ( // Flag pflag.FlagSet for registry Flag = pflag.NewFlagSet("registry", pflag.ExitOnError) DefaultRegistry Registry DefaultRegistryTimeout = time.Second * 10 // DefaultNamespace the default value of namespace DefaultNamespace = "vine" // ErrNotFound not found error when GetService is called ErrNotFound = errors.New("service not found") // ErrWatcherStopped watcher stopped error when watcher is stopped ErrWatcherStopped = errors.New("watcher stopped") )
Functions ¶
Types ¶
type DeregisterOption ¶
type DeregisterOption func(*DeregisterOptions)
func DeregisterNamespace ¶ added in v1.6.6
func DeregisterNamespace(ns string) DeregisterOption
type DeregisterOptions ¶
type DeregisterOptions struct {
Namespace string
}
type Endpoint ¶ added in v0.23.0
type Endpoint struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Request *Value `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` Response *Value `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"` Metadata map[string]string `` /* 157-byte string literal not displayed */ }
Endpoint is a endpoint provided by a service
func (*Endpoint) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Endpoint) Descriptor ¶ added in v1.5.6
func (*Endpoint) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Endpoint) ProtoMessage ¶ added in v1.5.6
func (*Endpoint) ProtoMessage()
func (*Endpoint) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Endpoint) XXX_DiscardUnknown()
func (*Endpoint) XXX_Marshal ¶ added in v1.5.6
func (*Endpoint) XXX_Unmarshal ¶ added in v1.5.6
type Event ¶ added in v0.23.0
type Event struct { // Event Id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // type of event Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // unix timestamp of event Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // service entry Service *Service `protobuf:"bytes,4,opt,name=service,proto3" json:"service,omitempty"` }
Event is registry event
func (*Event) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Event) Descriptor ¶ added in v1.5.6
func (*Event) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Event) ProtoMessage ¶ added in v1.5.6
func (*Event) ProtoMessage()
func (*Event) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Event) XXX_DiscardUnknown()
func (*Event) XXX_Marshal ¶ added in v1.5.6
func (*Event) XXX_Unmarshal ¶ added in v1.5.6
type GetOptions ¶
type GetOptions struct {
Namespace string
}
type ListOption ¶
type ListOption func(*ListOptions)
func ListNamespace ¶ added in v1.6.6
func ListNamespace(ns string) ListOption
type ListOptions ¶
type ListOptions struct {
Namespace string
}
type Node ¶ added in v0.23.0
type Node struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` Port int64 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` Metadata map[string]string `` /* 157-byte string literal not displayed */ }
Node represents the node the service is on
func (*Node) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Node) Descriptor ¶ added in v1.5.6
func (*Node) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Node) ProtoMessage ¶ added in v1.5.6
func (*Node) ProtoMessage()
func (*Node) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Node) XXX_DiscardUnknown()
func (*Node) XXX_Marshal ¶ added in v1.5.6
func (*Node) XXX_Unmarshal ¶ added in v1.5.6
type OpenAPIOption ¶
type OpenAPIOption func(*OpenAPIOptions)
type OpenAPIOptions ¶
type OpenAPIOptions struct { }
type Options ¶
type Options struct { Addrs []string Namespace string Timeout time.Duration Secure bool TLSConfig *tls.Config // Other options for implementations of the interface // can be stored in a context Context context.Context }
func NewOptions ¶ added in v1.6.6
type RegisterOption ¶
type RegisterOption func(*RegisterOptions)
func RegisterNamespace ¶ added in v1.6.6
func RegisterNamespace(ns string) RegisterOption
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 `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"` Service *Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` }
Result is returns by the watcher
func (*Result) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Result) Descriptor ¶ added in v1.5.6
func (*Result) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Result) ProtoMessage ¶ added in v1.5.6
func (*Result) ProtoMessage()
func (*Result) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Result) XXX_DiscardUnknown()
func (*Result) XXX_Marshal ¶ added in v1.5.6
func (*Result) XXX_Unmarshal ¶ added in v1.5.6
type Service ¶ added in v0.23.0
type Service struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` Metadata map[string]string `` /* 157-byte string literal not displayed */ Endpoints []*Endpoint `protobuf:"bytes,5,rep,name=endpoints,proto3" json:"endpoints,omitempty"` Nodes []*Node `protobuf:"bytes,6,rep,name=nodes,proto3" json:"nodes,omitempty"` Ttl int64 `protobuf:"varint,7,opt,name=ttl,proto3" json:"ttl,omitempty"` }
Service represents a vine service
func GetService ¶
GetService retrieve a service. A slice is returned since we separate Name/Version.
func ListServices ¶
ListServices list the services. Only returns service names
func (*Service) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Service) Descriptor ¶ added in v1.5.6
func (*Service) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Service) ProtoMessage ¶ added in v1.5.6
func (*Service) ProtoMessage()
func (*Service) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Service) XXX_DiscardUnknown()
func (*Service) XXX_Marshal ¶ added in v1.5.6
func (*Service) XXX_Unmarshal ¶ added in v1.5.6
type Value ¶ added in v0.23.0
type Value struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` Values []*Value `protobuf:"bytes,3,rep,name=values,proto3" json:"values,omitempty"` }
Value is an opaque value for a request or response
func (*Value) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Value) Descriptor ¶ added in v1.5.6
func (*Value) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Value) ProtoMessage ¶ added in v1.5.6
func (*Value) ProtoMessage()
func (*Value) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Value) XXX_DiscardUnknown()
func (*Value) XXX_Marshal ¶ added in v1.5.6
func (*Value) XXX_Unmarshal ¶ added in v1.5.6
type WatchOption ¶
type WatchOption func(*WatchOptions)
func WatchNamespace ¶ added in v1.6.6
func WatchNamespace(ns string) WatchOption