Documentation ¶
Overview ¶
Package membership is a generated GoMock package.
Package membership provides service discovery and membership information mechanism ¶
Package membership is a generated GoMock package.
Index ¶
- Constants
- Variables
- type ChangedEvent
- type HostInfo
- func (hi HostInfo) Belongs(address string) (bool, error)
- func (hi HostInfo) GetAddress() string
- func (hi HostInfo) GetNamedAddress(port string) (string, error)
- func (hi HostInfo) Identity() string
- func (hi HostInfo) Label(key string) (value string, has bool)
- func (hi HostInfo) SetLabel(key string, value string)
- func (hi HostInfo) String() string
- type MockPeerProvider
- func (m *MockPeerProvider) EXPECT() *MockPeerProviderMockRecorder
- func (m *MockPeerProvider) GetMembers(service string) ([]HostInfo, error)
- func (m *MockPeerProvider) SelfEvict() error
- func (m *MockPeerProvider) Start()
- func (m *MockPeerProvider) Stop()
- func (m *MockPeerProvider) Subscribe(name string, notifyChannel chan<- *ChangedEvent) error
- func (m *MockPeerProvider) WhoAmI() (HostInfo, error)
- type MockPeerProviderMockRecorder
- func (mr *MockPeerProviderMockRecorder) GetMembers(service interface{}) *gomock.Call
- func (mr *MockPeerProviderMockRecorder) SelfEvict() *gomock.Call
- func (mr *MockPeerProviderMockRecorder) Start() *gomock.Call
- func (mr *MockPeerProviderMockRecorder) Stop() *gomock.Call
- func (mr *MockPeerProviderMockRecorder) Subscribe(name, notifyChannel interface{}) *gomock.Call
- func (mr *MockPeerProviderMockRecorder) WhoAmI() *gomock.Call
- type MockResolver
- func (m *MockResolver) EXPECT() *MockResolverMockRecorder
- func (m *MockResolver) EvictSelf() error
- func (m *MockResolver) Lookup(service, key string) (HostInfo, error)
- func (m *MockResolver) LookupByAddress(service, address string) (HostInfo, error)
- func (m *MockResolver) MemberCount(service string) (int, error)
- func (m *MockResolver) Members(service string) ([]HostInfo, error)
- func (m *MockResolver) Start()
- func (m *MockResolver) Stop()
- func (m *MockResolver) Subscribe(service, name string, notifyChannel chan<- *ChangedEvent) error
- func (m *MockResolver) Unsubscribe(service, name string) error
- func (m *MockResolver) WhoAmI() (HostInfo, error)
- type MockResolverMockRecorder
- func (mr *MockResolverMockRecorder) EvictSelf() *gomock.Call
- func (mr *MockResolverMockRecorder) Lookup(service, key interface{}) *gomock.Call
- func (mr *MockResolverMockRecorder) LookupByAddress(service, address interface{}) *gomock.Call
- func (mr *MockResolverMockRecorder) MemberCount(service interface{}) *gomock.Call
- func (mr *MockResolverMockRecorder) Members(service interface{}) *gomock.Call
- func (mr *MockResolverMockRecorder) Start() *gomock.Call
- func (mr *MockResolverMockRecorder) Stop() *gomock.Call
- func (mr *MockResolverMockRecorder) Subscribe(service, name, notifyChannel interface{}) *gomock.Call
- func (mr *MockResolverMockRecorder) Unsubscribe(service, name interface{}) *gomock.Call
- func (mr *MockResolverMockRecorder) WhoAmI() *gomock.Call
- type MultiringResolver
- func (rpo *MultiringResolver) EvictSelf() error
- func (rpo *MultiringResolver) Lookup(service string, key string) (HostInfo, error)
- func (rpo *MultiringResolver) LookupByAddress(service, address string) (HostInfo, error)
- func (rpo *MultiringResolver) MemberCount(service string) (int, error)
- func (rpo *MultiringResolver) Members(service string) ([]HostInfo, error)
- func (rpo *MultiringResolver) Start()
- func (rpo *MultiringResolver) Stop()
- func (rpo *MultiringResolver) Subscribe(service string, name string, notifyChannel chan<- *ChangedEvent) error
- func (rpo *MultiringResolver) Unsubscribe(service string, name string) error
- func (rpo *MultiringResolver) WhoAmI() (HostInfo, error)
- type PeerProvider
- type PortMap
- type Resolver
Constants ¶
const ( PortTchannel = "tchannel" PortGRPC = "grpc" )
Variables ¶
var ErrInsufficientHosts = &types.InternalServiceError{Message: "Not enough hosts to serve the request"}
ErrInsufficientHosts is thrown when there are not enough hosts to serve the request
Functions ¶
This section is empty.
Types ¶
type ChangedEvent ¶
ChangedEvent describes a change in a membership ring
type HostInfo ¶
type HostInfo struct {
// contains filtered or unexported fields
}
HostInfo is a type that contains the info about a cadence host
func NewDetailedHostInfo ¶ added in v0.24.0
NewDetailedHostInfo creates a new HostInfo instance with identity and portmap information
func NewHostInfo ¶
NewHostInfo creates a new HostInfo instance
func (HostInfo) GetAddress ¶
GetAddress returns the ip:port address
func (HostInfo) GetNamedAddress ¶ added in v0.24.0
GetNamedAddress returns the ip:port address
type MockPeerProvider ¶ added in v0.24.0
type MockPeerProvider struct {
// contains filtered or unexported fields
}
MockPeerProvider is a mock of PeerProvider interface.
func NewMockPeerProvider ¶ added in v0.24.0
func NewMockPeerProvider(ctrl *gomock.Controller) *MockPeerProvider
NewMockPeerProvider creates a new mock instance.
func (*MockPeerProvider) EXPECT ¶ added in v0.24.0
func (m *MockPeerProvider) EXPECT() *MockPeerProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPeerProvider) GetMembers ¶ added in v0.24.0
func (m *MockPeerProvider) GetMembers(service string) ([]HostInfo, error)
GetMembers mocks base method.
func (*MockPeerProvider) SelfEvict ¶ added in v0.24.0
func (m *MockPeerProvider) SelfEvict() error
SelfEvict mocks base method.
func (*MockPeerProvider) Start ¶ added in v0.24.0
func (m *MockPeerProvider) Start()
Start mocks base method.
func (*MockPeerProvider) Stop ¶ added in v0.24.0
func (m *MockPeerProvider) Stop()
Stop mocks base method.
func (*MockPeerProvider) Subscribe ¶ added in v0.24.0
func (m *MockPeerProvider) Subscribe(name string, notifyChannel chan<- *ChangedEvent) error
Subscribe mocks base method.
func (*MockPeerProvider) WhoAmI ¶ added in v0.24.0
func (m *MockPeerProvider) WhoAmI() (HostInfo, error)
WhoAmI mocks base method.
type MockPeerProviderMockRecorder ¶ added in v0.24.0
type MockPeerProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockPeerProviderMockRecorder is the mock recorder for MockPeerProvider.
func (*MockPeerProviderMockRecorder) GetMembers ¶ added in v0.24.0
func (mr *MockPeerProviderMockRecorder) GetMembers(service interface{}) *gomock.Call
GetMembers indicates an expected call of GetMembers.
func (*MockPeerProviderMockRecorder) SelfEvict ¶ added in v0.24.0
func (mr *MockPeerProviderMockRecorder) SelfEvict() *gomock.Call
SelfEvict indicates an expected call of SelfEvict.
func (*MockPeerProviderMockRecorder) Start ¶ added in v0.24.0
func (mr *MockPeerProviderMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockPeerProviderMockRecorder) Stop ¶ added in v0.24.0
func (mr *MockPeerProviderMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
func (*MockPeerProviderMockRecorder) Subscribe ¶ added in v0.24.0
func (mr *MockPeerProviderMockRecorder) Subscribe(name, notifyChannel interface{}) *gomock.Call
Subscribe indicates an expected call of Subscribe.
func (*MockPeerProviderMockRecorder) WhoAmI ¶ added in v0.24.0
func (mr *MockPeerProviderMockRecorder) WhoAmI() *gomock.Call
WhoAmI indicates an expected call of WhoAmI.
type MockResolver ¶ added in v0.24.0
type MockResolver struct {
// contains filtered or unexported fields
}
MockResolver is a mock of Resolver interface.
func NewMockResolver ¶ added in v0.24.0
func NewMockResolver(ctrl *gomock.Controller) *MockResolver
NewMockResolver creates a new mock instance.
func (*MockResolver) EXPECT ¶ added in v0.24.0
func (m *MockResolver) EXPECT() *MockResolverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockResolver) EvictSelf ¶ added in v0.24.0
func (m *MockResolver) EvictSelf() error
EvictSelf mocks base method.
func (*MockResolver) Lookup ¶ added in v0.24.0
func (m *MockResolver) Lookup(service, key string) (HostInfo, error)
Lookup mocks base method.
func (*MockResolver) LookupByAddress ¶ added in v0.24.0
func (m *MockResolver) LookupByAddress(service, address string) (HostInfo, error)
LookupByAddress mocks base method.
func (*MockResolver) MemberCount ¶ added in v0.24.0
func (m *MockResolver) MemberCount(service string) (int, error)
MemberCount mocks base method.
func (*MockResolver) Members ¶ added in v0.24.0
func (m *MockResolver) Members(service string) ([]HostInfo, error)
Members mocks base method.
func (*MockResolver) Start ¶ added in v0.24.0
func (m *MockResolver) Start()
Start mocks base method.
func (*MockResolver) Subscribe ¶ added in v0.24.0
func (m *MockResolver) Subscribe(service, name string, notifyChannel chan<- *ChangedEvent) error
Subscribe mocks base method.
func (*MockResolver) Unsubscribe ¶ added in v0.24.0
func (m *MockResolver) Unsubscribe(service, name string) error
Unsubscribe mocks base method.
func (*MockResolver) WhoAmI ¶ added in v0.24.0
func (m *MockResolver) WhoAmI() (HostInfo, error)
WhoAmI mocks base method.
type MockResolverMockRecorder ¶ added in v0.24.0
type MockResolverMockRecorder struct {
// contains filtered or unexported fields
}
MockResolverMockRecorder is the mock recorder for MockResolver.
func (*MockResolverMockRecorder) EvictSelf ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) EvictSelf() *gomock.Call
EvictSelf indicates an expected call of EvictSelf.
func (*MockResolverMockRecorder) Lookup ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) Lookup(service, key interface{}) *gomock.Call
Lookup indicates an expected call of Lookup.
func (*MockResolverMockRecorder) LookupByAddress ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) LookupByAddress(service, address interface{}) *gomock.Call
LookupByAddress indicates an expected call of LookupByAddress.
func (*MockResolverMockRecorder) MemberCount ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) MemberCount(service interface{}) *gomock.Call
MemberCount indicates an expected call of MemberCount.
func (*MockResolverMockRecorder) Members ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) Members(service interface{}) *gomock.Call
Members indicates an expected call of Members.
func (*MockResolverMockRecorder) Start ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockResolverMockRecorder) Stop ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
func (*MockResolverMockRecorder) Subscribe ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) Subscribe(service, name, notifyChannel interface{}) *gomock.Call
Subscribe indicates an expected call of Subscribe.
func (*MockResolverMockRecorder) Unsubscribe ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) Unsubscribe(service, name interface{}) *gomock.Call
Unsubscribe indicates an expected call of Unsubscribe.
func (*MockResolverMockRecorder) WhoAmI ¶ added in v0.24.0
func (mr *MockResolverMockRecorder) WhoAmI() *gomock.Call
WhoAmI indicates an expected call of WhoAmI.
type MultiringResolver ¶ added in v0.24.0
type MultiringResolver struct {
// contains filtered or unexported fields
}
MultiringResolver uses ring-per-service for membership information
func NewMultiringResolver ¶ added in v0.24.0
func NewMultiringResolver( services []string, provider PeerProvider, logger log.Logger, metricsClient metrics.Client, ) *MultiringResolver
NewMultiringResolver creates hashrings for all services
func NewResolver ¶ added in v0.24.0
func NewResolver( provider PeerProvider, logger log.Logger, metrics metrics.Client, ) (*MultiringResolver, error)
NewResolver builds hashrings for all services
func (*MultiringResolver) EvictSelf ¶ added in v0.24.0
func (rpo *MultiringResolver) EvictSelf() error
EvictSelf is used to remove this host from membership ring
func (*MultiringResolver) Lookup ¶ added in v0.24.0
func (rpo *MultiringResolver) Lookup(service string, key string) (HostInfo, error)
func (*MultiringResolver) LookupByAddress ¶ added in v0.24.0
func (rpo *MultiringResolver) LookupByAddress(service, address string) (HostInfo, error)
func (*MultiringResolver) MemberCount ¶ added in v0.24.0
func (rpo *MultiringResolver) MemberCount(service string) (int, error)
func (*MultiringResolver) Members ¶ added in v0.24.0
func (rpo *MultiringResolver) Members(service string) ([]HostInfo, error)
func (*MultiringResolver) Start ¶ added in v0.24.0
func (rpo *MultiringResolver) Start()
Start starts provider and all rings
func (*MultiringResolver) Stop ¶ added in v0.24.0
func (rpo *MultiringResolver) Stop()
Stop stops all rings and membership provider
func (*MultiringResolver) Subscribe ¶ added in v0.24.0
func (rpo *MultiringResolver) Subscribe(service string, name string, notifyChannel chan<- *ChangedEvent) error
func (*MultiringResolver) Unsubscribe ¶ added in v0.24.0
func (rpo *MultiringResolver) Unsubscribe(service string, name string) error
func (*MultiringResolver) WhoAmI ¶ added in v0.24.0
func (rpo *MultiringResolver) WhoAmI() (HostInfo, error)
WhoAmI asks to provide current instance address
type PeerProvider ¶ added in v0.24.0
type PeerProvider interface { common.Daemon GetMembers(service string) ([]HostInfo, error) WhoAmI() (HostInfo, error) SelfEvict() error Subscribe(name string, notifyChannel chan<- *ChangedEvent) error }
PeerProvider is used to retrieve membership information from provider
type Resolver ¶ added in v0.24.0
type Resolver interface { common.Daemon // WhoAmI returns self host details. // To be consistent with peer provider, it is advised to use peer provider // to return this information WhoAmI() (HostInfo, error) // EvictSelf evicts this member from the membership ring. After this method is // called, other members should discover that this node is no longer part of the // ring. // This primitive is useful to carry out graceful host shutdown during deployments. EvictSelf() error // Lookup will return host which is an owner for provided key. Lookup(service, key string) (HostInfo, error) // Subscribe adds a subscriber which will get detailed change data on the given // channel, whenever membership changes. Subscribe(service, name string, notifyChannel chan<- *ChangedEvent) error // Unsubscribe removes a subscriber for this service. Unsubscribe(service, name string) error // MemberCount returns host count in a service specific hashring MemberCount(service string) (int, error) // Members returns all host addresses in a service specific hashring Members(service string) ([]HostInfo, error) // LookupByAddress returns Host which owns IP:port tuple LookupByAddress(service, address string) (HostInfo, error) }
Resolver provides membership information for all cadence services.