Documentation ¶
Overview ¶
Package gxregistry provides a interface for service register/discovery
Package gxregistry provides a interface for service register/discovery
Package gxregistry is a generated protocol buffer package. It is generated from these files: service.proto It has these top-level messages: ServiceAttr Node Service EventResult
Package gxregistry provides a interface for service register/discovery
Index ¶
- Constants
- Variables
- func EncodeService(s *Service) (string, error)
- type EventResult
- func (*EventResult) Descriptor() ([]byte, []int)
- func (this *EventResult) Equal(that interface{}) bool
- func (this *EventResult) GoString() string
- func (m *EventResult) Marshal() (dAtA []byte, err error)
- func (m *EventResult) MarshalTo(dAtA []byte) (int, error)
- func (*EventResult) ProtoMessage()
- func (m *EventResult) Reset()
- func (m *EventResult) Size() (n int)
- func (this *EventResult) String() string
- func (m *EventResult) Unmarshal(dAtA []byte) error
- func (this *EventResult) VerboseEqual(that interface{}) error
- type Node
- func (m *Node) Copy() *Node
- func (*Node) Descriptor() ([]byte, []int)
- func (this *Node) Equal(that interface{}) bool
- func (this *Node) GoString() string
- func (m *Node) Marshal() (dAtA []byte, err error)
- func (m *Node) MarshalTo(dAtA []byte) (int, error)
- func (*Node) ProtoMessage()
- func (m *Node) Reset()
- func (m *Node) Size() (n int)
- func (this *Node) String() string
- func (m *Node) Unmarshal(dAtA []byte) error
- func (this *Node) VerboseEqual(that interface{}) error
- type NodeMeta
- type Option
- type Options
- type Registry
- type Service
- func (s *Service) Copy() *Service
- func (*Service) Descriptor() ([]byte, []int)
- func (this *Service) Equal(that interface{}) bool
- func (this *Service) GoString() string
- func (m *Service) Marshal() (dAtA []byte, err error)
- func (m *Service) MarshalTo(dAtA []byte) (int, error)
- func (s *Service) NodePath(root string, node Node) string
- func (s *Service) Path(root string) string
- func (*Service) ProtoMessage()
- func (m *Service) Reset()
- func (m *Service) Size() (n int)
- func (this *Service) String() string
- func (m *Service) Unmarshal(dAtA []byte) error
- func (this *Service) VerboseEqual(that interface{}) error
- type ServiceAttr
- func (m *ServiceAttr) Copy() *ServiceAttr
- func (*ServiceAttr) Descriptor() ([]byte, []int)
- func (this *ServiceAttr) Equal(that interface{}) bool
- func (m *ServiceAttr) Filter(service ServiceAttr) bool
- func (this *ServiceAttr) GoString() string
- func (m *ServiceAttr) Marshal() (dAtA []byte, err error)
- func (a *ServiceAttr) MarshalPath() ([]byte, error)
- func (m *ServiceAttr) MarshalTo(dAtA []byte) (int, error)
- func (m *ServiceAttr) MeshFilter(service ServiceAttr) bool
- func (*ServiceAttr) ProtoMessage()
- func (m *ServiceAttr) Reset()
- func (m *ServiceAttr) Size() (n int)
- func (this *ServiceAttr) String() string
- func (m *ServiceAttr) Unmarshal(dAtA []byte) error
- func (a *ServiceAttr) UnmarshalPath(data []byte) error
- func (this *ServiceAttr) VerboseEqual(that interface{}) error
- type ServiceEventType
- type ServiceMeta
- type ServiceRoleType
- type WatchOption
- type WatchOptions
- type Watcher
Constants ¶
View Source
const ( REGISTRY_CONN_DELAY = 3 // watchDir中使用,防止不断地对zk重连 DefaultTimeout = 3e9 MaxFailTime = 15e9 // fail retry wait time delay )
Variables ¶
View Source
var ( ErrorRegistryNotFound = jerrors.Errorf("registry not found") ErrorAlreadyRegister = jerrors.Errorf("service has already been registered") DefaultServiceRoot = "/gxregistry" )
View Source
var ( ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowService = fmt.Errorf("proto: integer overflow") )
View Source
var (
ErrWatcherClosed = jerrors.Errorf("Watcher closed")
)
View Source
var ServiceEventType_name = map[int32]string{
0: "SET_UNKNOWN",
1: "ServiceAdd",
2: "ServiceDel",
3: "ServiceUpdate",
}
View Source
var ServiceEventType_value = map[string]int32{
"SET_UNKNOWN": 0,
"ServiceAdd": 1,
"ServiceDel": 2,
"ServiceUpdate": 3,
}
View Source
var ServiceRoleType_name = map[int32]string{
0: "SRT_UNKOWN",
1: "SRT_Provider",
2: "SRT_Consumer",
}
View Source
var ServiceRoleType_value = map[string]int32{
"SRT_UNKOWN": 0,
"SRT_Provider": 1,
"SRT_Consumer": 2,
}
Functions ¶
func EncodeService ¶
Types ¶
type EventResult ¶
type EventResult struct { Action ServiceEventType `protobuf:"varint,1,opt,name=Action,proto3,enum=gxregistry.ServiceEventType" json:"Action,omitempty"` Service *Service `protobuf:"bytes,2,opt,name=Service" json:"Service,omitempty"` }
Result is returned by a call to Next on the watcher. Actions can be create, update, delete
func (*EventResult) Descriptor ¶
func (*EventResult) Descriptor() ([]byte, []int)
func (*EventResult) Equal ¶
func (this *EventResult) Equal(that interface{}) bool
func (*EventResult) GoString ¶
func (this *EventResult) GoString() string
func (*EventResult) Marshal ¶
func (m *EventResult) Marshal() (dAtA []byte, err error)
func (*EventResult) ProtoMessage ¶
func (*EventResult) ProtoMessage()
func (*EventResult) Reset ¶
func (m *EventResult) Reset()
func (*EventResult) Size ¶
func (m *EventResult) Size() (n int)
func (*EventResult) String ¶
func (this *EventResult) String() string
func (*EventResult) Unmarshal ¶
func (m *EventResult) Unmarshal(dAtA []byte) error
func (*EventResult) VerboseEqual ¶
func (this *EventResult) VerboseEqual(that interface{}) error
type Node ¶
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 int32 `protobuf:"varint,3,opt,name=Port,proto3" json:"Port,omitempty"` Metadata map[string]string `` /* 150-byte string literal not displayed */ }
func (*Node) Descriptor ¶
func (*Node) ProtoMessage ¶
func (*Node) ProtoMessage()
func (*Node) VerboseEqual ¶
type Registry ¶
type Registry interface { Register(service Service) error Deregister(service Service) error GetServices(attr ServiceAttr) ([]Service, error) Watch(opts ...WatchOption) (Watcher, error) Close() error String() string Options() Options }
Registry provides an interface for service register
type Service ¶
type Service struct { Attr *ServiceAttr `protobuf:"bytes,1,opt,name=Attr" json:"Attr,omitempty"` Nodes []*Node `protobuf:"bytes,2,rep,name=Nodes" json:"Nodes,omitempty"` Metadata map[string]string `` /* 150-byte string literal not displayed */ }
func DecodeService ¶
func (*Service) Descriptor ¶
func (*Service) Path ¶
/dubbo/group%3Dbjtelecom%26protocol%3Dpb%26service%3Dshopping%26type%3Dadd%2Bservice%26version%3D1.0.1/node1
func (*Service) ProtoMessage ¶
func (*Service) ProtoMessage()
func (*Service) VerboseEqual ¶
type ServiceAttr ¶
type ServiceAttr struct { Group string `protobuf:"bytes,1,opt,name=Group,proto3" json:"Group,omitempty"` Service string `protobuf:"bytes,2,opt,name=Service,proto3" json:"Service,omitempty"` Protocol string `protobuf:"bytes,3,opt,name=Protocol,proto3" json:"Protocol,omitempty"` Version string `protobuf:"bytes,4,opt,name=Version,proto3" json:"Version,omitempty"` Role ServiceRoleType `protobuf:"varint,5,opt,name=Role,proto3,enum=gxregistry.ServiceRoleType" json:"Role,omitempty"` }
func (*ServiceAttr) Copy ¶
func (m *ServiceAttr) Copy() *ServiceAttr
func (*ServiceAttr) Descriptor ¶
func (*ServiceAttr) Descriptor() ([]byte, []int)
func (*ServiceAttr) Equal ¶
func (this *ServiceAttr) Equal(that interface{}) bool
func (*ServiceAttr) GoString ¶
func (this *ServiceAttr) GoString() string
func (*ServiceAttr) Marshal ¶
func (m *ServiceAttr) Marshal() (dAtA []byte, err error)
func (*ServiceAttr) MarshalPath ¶
func (a *ServiceAttr) MarshalPath() ([]byte, error)
func (*ServiceAttr) MeshFilter ¶ added in v0.3.1
func (m *ServiceAttr) MeshFilter(service ServiceAttr) bool
func (*ServiceAttr) ProtoMessage ¶
func (*ServiceAttr) ProtoMessage()
func (*ServiceAttr) Reset ¶
func (m *ServiceAttr) Reset()
func (*ServiceAttr) Size ¶
func (m *ServiceAttr) Size() (n int)
func (*ServiceAttr) String ¶
func (this *ServiceAttr) String() string
func (*ServiceAttr) Unmarshal ¶
func (m *ServiceAttr) Unmarshal(dAtA []byte) error
func (*ServiceAttr) UnmarshalPath ¶
func (a *ServiceAttr) UnmarshalPath(data []byte) error
func (*ServiceAttr) VerboseEqual ¶
func (this *ServiceAttr) VerboseEqual(that interface{}) error
type ServiceEventType ¶
type ServiceEventType int32
//////////////////////////////////////// service url event type ////////////////////////////////////////
const ( SET_UNKNOWN ServiceEventType = 0 ServiceAdd ServiceEventType = 1 ServiceDel ServiceEventType = 2 ServiceUpdate ServiceEventType = 3 )
func (ServiceEventType) EnumDescriptor ¶
func (ServiceEventType) EnumDescriptor() ([]byte, []int)
func (ServiceEventType) String ¶
func (x ServiceEventType) String() string
type ServiceMeta ¶ added in v0.3.1
type ServiceMeta func(*Service)
func WithServiceMeta ¶ added in v0.3.1
func WithServiceMeta(key, value string) ServiceMeta
type ServiceRoleType ¶
type ServiceRoleType int32
//////////////////////////////////////// service role ////////////////////////////////////////
const ( SRT_UNKOWN ServiceRoleType = 0 SRT_Provider ServiceRoleType = 1 SRT_Consumer ServiceRoleType = 2 )
func String2ServiceRoleType ¶
func String2ServiceRoleType(role string) ServiceRoleType
func (ServiceRoleType) EnumDescriptor ¶
func (ServiceRoleType) EnumDescriptor() ([]byte, []int)
func (ServiceRoleType) String ¶
func (x ServiceRoleType) String() string
type WatchOption ¶
type WatchOption func(*WatchOptions)
func WithWatchFilter ¶
func WithWatchFilter(filter ServiceAttr) WatchOption
Watch ServiceAttr Filter
type WatchOptions ¶
type WatchOptions struct { // the root registry path, such as "/dubbo/" Root string // filter the second path, such as // "/test/group%3Dbjtelecom%26protocol%3Dpb%26role%3DSRT_Provider%26service%3Dshopping%26version%3D1.0.1" Filter ServiceAttr }
Directories ¶
Path | Synopsis |
---|---|
Package gxetcd provides an etcd version 3 gxregistry Package gxetcd provides an etcd version 3 gxregistry ref: https://github.com/micro/go-plugins/blob/master/gxregistry/etcdv3/etcdv3.go
|
Package gxetcd provides an etcd version 3 gxregistry Package gxetcd provides an etcd version 3 gxregistry ref: https://github.com/micro/go-plugins/blob/master/gxregistry/etcdv3/etcdv3.go |
Package gxzookeeper provides a zookeeper registry Package gxzookeeper provides a zookeeper watcher
|
Package gxzookeeper provides a zookeeper registry Package gxzookeeper provides a zookeeper watcher |
Click to show internal directories.
Click to hide internal directories.