Documentation ¶
Overview ¶
Package membership is a generated GoMock package.
Index ¶
- Constants
- Variables
- func BuildBroadcastHostPort(listenerPeerInfo tchannel.LocalPeerInfo, broadcastAddress string) (string, error)
- func HostInfoProviderLifetimeHooks(lc fx.Lifecycle, provider HostInfoProvider)
- func ServiceNameToServiceTypeEnum(name primitives.ServiceName) (persistence.ServiceType, error)
- func SplitHostPortTyped(hostPort string) (net.IP, uint16, error)
- type CachingHostInfoProvider
- type ChangedEvent
- type GRPCResolver
- type HostInfo
- type HostInfoProvider
- type MockHostInfoProvider
- type MockHostInfoProviderMockRecorder
- type MockMonitor
- func (m *MockMonitor) AddListener(service primitives.ServiceName, name string, ...) error
- func (m *MockMonitor) EXPECT() *MockMonitorMockRecorder
- func (m *MockMonitor) EvictSelf() error
- func (m *MockMonitor) GetMemberCount(service primitives.ServiceName) (int, error)
- func (m *MockMonitor) GetReachableMembers() ([]string, error)
- func (m *MockMonitor) GetResolver(service primitives.ServiceName) (ServiceResolver, error)
- func (m *MockMonitor) Lookup(service primitives.ServiceName, key string) (*HostInfo, error)
- func (m *MockMonitor) RemoveListener(service primitives.ServiceName, name string) error
- func (m *MockMonitor) Start()
- func (m *MockMonitor) Stop()
- func (m *MockMonitor) WaitUntilInitialized(arg0 context.Context) error
- func (m *MockMonitor) WhoAmI() (*HostInfo, error)
- type MockMonitorMockRecorder
- func (mr *MockMonitorMockRecorder) AddListener(service, name, notifyChannel interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) EvictSelf() *gomock.Call
- func (mr *MockMonitorMockRecorder) GetMemberCount(service interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) GetReachableMembers() *gomock.Call
- func (mr *MockMonitorMockRecorder) GetResolver(service interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) Lookup(service, key interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) RemoveListener(service, name interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) Start() *gomock.Call
- func (mr *MockMonitorMockRecorder) Stop() *gomock.Call
- func (mr *MockMonitorMockRecorder) WaitUntilInitialized(arg0 interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) WhoAmI() *gomock.Call
- type MockServiceResolver
- func (m *MockServiceResolver) AddListener(name string, notifyChannel chan<- *ChangedEvent) error
- func (m *MockServiceResolver) EXPECT() *MockServiceResolverMockRecorder
- func (m *MockServiceResolver) Lookup(key string) (*HostInfo, error)
- func (m *MockServiceResolver) MemberCount() int
- func (m *MockServiceResolver) Members() []*HostInfo
- func (m *MockServiceResolver) RemoveListener(name string) error
- func (m *MockServiceResolver) RequestRefresh()
- type MockServiceResolverMockRecorder
- func (mr *MockServiceResolverMockRecorder) AddListener(name, notifyChannel interface{}) *gomock.Call
- func (mr *MockServiceResolverMockRecorder) Lookup(key interface{}) *gomock.Call
- func (mr *MockServiceResolverMockRecorder) MemberCount() *gomock.Call
- func (mr *MockServiceResolverMockRecorder) Members() *gomock.Call
- func (mr *MockServiceResolverMockRecorder) RemoveListener(name interface{}) *gomock.Call
- func (mr *MockServiceResolverMockRecorder) RequestRefresh() *gomock.Call
- type Monitor
- type RingPop
- type ServiceResolver
Constants ¶
const ( // RoleKey label is set by every single service as soon as it bootstraps its // ringpop instance. The data for this key is the service name RoleKey = "serviceName" // RolePort label is set by every single service as soon as it bootstraps its // ringpop instance. The data for this key represents the TCP port through which // the service can be accessed. RolePort = "servicePort" )
const GRPCResolverScheme = "membership"
Variables ¶
var ErrIncorrectAddressFormat = errors.New("incorrect address format")
ErrIncorrectAddressFormat is thrown on incorrect address format
var ErrInsufficientHosts = serviceerror.NewUnavailable("Not enough hosts to serve the request")
ErrInsufficientHosts is thrown when there are not enough hosts to serve the request
var ErrListenerAlreadyExist = errors.New("listener already exist for the service")
ErrListenerAlreadyExist is thrown on a duplicate AddListener call from the same listener
var ErrUnknownService = errors.New("service not tracked by Monitor")
ErrUnknownService is thrown for a service that is not tracked by this instance
var ( GRPCResolverModule = fx.Options( fx.Provide(initializeBuilder), ) )
var HostInfoProviderModule = fx.Options( fx.Provide(NewHostInfoProvider), fx.Invoke(HostInfoProviderLifetimeHooks), )
Functions ¶
func BuildBroadcastHostPort ¶ added in v0.27.0
func BuildBroadcastHostPort(listenerPeerInfo tchannel.LocalPeerInfo, broadcastAddress string) (string, error)
BuildBroadcastHostPort return the listener hostport from an existing tchannel and overrides the address with broadcastAddress if specified
func HostInfoProviderLifetimeHooks ¶ added in v1.16.0
func HostInfoProviderLifetimeHooks( lc fx.Lifecycle, provider HostInfoProvider, )
func ServiceNameToServiceTypeEnum ¶ added in v0.27.0
func ServiceNameToServiceTypeEnum(name primitives.ServiceName) (persistence.ServiceType, error)
Types ¶
type CachingHostInfoProvider ¶ added in v1.16.0
type CachingHostInfoProvider struct {
// contains filtered or unexported fields
}
func (*CachingHostInfoProvider) HostInfo ¶ added in v1.16.0
func (hip *CachingHostInfoProvider) HostInfo() *HostInfo
func (*CachingHostInfoProvider) Start ¶ added in v1.16.0
func (hip *CachingHostInfoProvider) Start() error
type ChangedEvent ¶
type ChangedEvent struct { HostsAdded []*HostInfo HostsUpdated []*HostInfo HostsRemoved []*HostInfo }
ChangedEvent describes a change in membership
type GRPCResolver ¶ added in v1.18.0
type GRPCResolver struct{}
Empty type used to enforce a dependency using fx so that we're guaranteed to have initialized the global builder before we use it.
func (*GRPCResolver) MakeURL ¶ added in v1.18.0
func (g *GRPCResolver) MakeURL(service primitives.ServiceName) string
type HostInfo ¶
type HostInfo struct {
// contains filtered or unexported fields
}
HostInfo is a type that contains the info about a temporal host
func NewHostInfo ¶
NewHostInfo creates a new HostInfo instance
func (*HostInfo) GetAddress ¶
GetAddress returns the ip:port address
type HostInfoProvider ¶ added in v1.16.0
func NewHostInfoProvider ¶ added in v1.16.0
func NewHostInfoProvider(membershipMonitor Monitor) HostInfoProvider
type MockHostInfoProvider ¶ added in v1.16.0
type MockHostInfoProvider struct {
// contains filtered or unexported fields
}
MockHostInfoProvider is a mock of HostInfoProvider interface.
func NewMockHostInfoProvider ¶ added in v1.16.0
func NewMockHostInfoProvider(ctrl *gomock.Controller) *MockHostInfoProvider
NewMockHostInfoProvider creates a new mock instance.
func (*MockHostInfoProvider) EXPECT ¶ added in v1.16.0
func (m *MockHostInfoProvider) EXPECT() *MockHostInfoProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockHostInfoProvider) HostInfo ¶ added in v1.16.0
func (m *MockHostInfoProvider) HostInfo() *HostInfo
HostInfo mocks base method.
func (*MockHostInfoProvider) Start ¶ added in v1.16.0
func (m *MockHostInfoProvider) Start() error
Start mocks base method.
type MockHostInfoProviderMockRecorder ¶ added in v1.16.0
type MockHostInfoProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockHostInfoProviderMockRecorder is the mock recorder for MockHostInfoProvider.
func (*MockHostInfoProviderMockRecorder) HostInfo ¶ added in v1.16.0
func (mr *MockHostInfoProviderMockRecorder) HostInfo() *gomock.Call
HostInfo indicates an expected call of HostInfo.
func (*MockHostInfoProviderMockRecorder) Start ¶ added in v1.16.0
func (mr *MockHostInfoProviderMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
type MockMonitor ¶ added in v0.27.0
type MockMonitor struct {
// contains filtered or unexported fields
}
MockMonitor is a mock of Monitor interface.
func NewMockMonitor ¶ added in v0.27.0
func NewMockMonitor(ctrl *gomock.Controller) *MockMonitor
NewMockMonitor creates a new mock instance.
func (*MockMonitor) AddListener ¶ added in v0.27.0
func (m *MockMonitor) AddListener(service primitives.ServiceName, name string, notifyChannel chan<- *ChangedEvent) error
AddListener mocks base method.
func (*MockMonitor) EXPECT ¶ added in v0.27.0
func (m *MockMonitor) EXPECT() *MockMonitorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMonitor) EvictSelf ¶ added in v0.27.0
func (m *MockMonitor) EvictSelf() error
EvictSelf mocks base method.
func (*MockMonitor) GetMemberCount ¶ added in v0.27.0
func (m *MockMonitor) GetMemberCount(service primitives.ServiceName) (int, error)
GetMemberCount mocks base method.
func (*MockMonitor) GetReachableMembers ¶ added in v0.27.0
func (m *MockMonitor) GetReachableMembers() ([]string, error)
GetReachableMembers mocks base method.
func (*MockMonitor) GetResolver ¶ added in v0.27.0
func (m *MockMonitor) GetResolver(service primitives.ServiceName) (ServiceResolver, error)
GetResolver mocks base method.
func (*MockMonitor) Lookup ¶ added in v0.27.0
func (m *MockMonitor) Lookup(service primitives.ServiceName, key string) (*HostInfo, error)
Lookup mocks base method.
func (*MockMonitor) RemoveListener ¶ added in v0.27.0
func (m *MockMonitor) RemoveListener(service primitives.ServiceName, name string) error
RemoveListener mocks base method.
func (*MockMonitor) WaitUntilInitialized ¶ added in v1.20.0
func (m *MockMonitor) WaitUntilInitialized(arg0 context.Context) error
WaitUntilInitialized mocks base method.
func (*MockMonitor) WhoAmI ¶ added in v0.27.0
func (m *MockMonitor) WhoAmI() (*HostInfo, error)
WhoAmI mocks base method.
type MockMonitorMockRecorder ¶ added in v0.27.0
type MockMonitorMockRecorder struct {
// contains filtered or unexported fields
}
MockMonitorMockRecorder is the mock recorder for MockMonitor.
func (*MockMonitorMockRecorder) AddListener ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) AddListener(service, name, notifyChannel interface{}) *gomock.Call
AddListener indicates an expected call of AddListener.
func (*MockMonitorMockRecorder) EvictSelf ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) EvictSelf() *gomock.Call
EvictSelf indicates an expected call of EvictSelf.
func (*MockMonitorMockRecorder) GetMemberCount ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) GetMemberCount(service interface{}) *gomock.Call
GetMemberCount indicates an expected call of GetMemberCount.
func (*MockMonitorMockRecorder) GetReachableMembers ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) GetReachableMembers() *gomock.Call
GetReachableMembers indicates an expected call of GetReachableMembers.
func (*MockMonitorMockRecorder) GetResolver ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) GetResolver(service interface{}) *gomock.Call
GetResolver indicates an expected call of GetResolver.
func (*MockMonitorMockRecorder) Lookup ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) Lookup(service, key interface{}) *gomock.Call
Lookup indicates an expected call of Lookup.
func (*MockMonitorMockRecorder) RemoveListener ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) RemoveListener(service, name interface{}) *gomock.Call
RemoveListener indicates an expected call of RemoveListener.
func (*MockMonitorMockRecorder) Start ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockMonitorMockRecorder) Stop ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
func (*MockMonitorMockRecorder) WaitUntilInitialized ¶ added in v1.20.0
func (mr *MockMonitorMockRecorder) WaitUntilInitialized(arg0 interface{}) *gomock.Call
WaitUntilInitialized indicates an expected call of WaitUntilInitialized.
func (*MockMonitorMockRecorder) WhoAmI ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) WhoAmI() *gomock.Call
WhoAmI indicates an expected call of WhoAmI.
type MockServiceResolver ¶ added in v0.27.0
type MockServiceResolver struct {
// contains filtered or unexported fields
}
MockServiceResolver is a mock of ServiceResolver interface.
func NewMockServiceResolver ¶ added in v0.27.0
func NewMockServiceResolver(ctrl *gomock.Controller) *MockServiceResolver
NewMockServiceResolver creates a new mock instance.
func (*MockServiceResolver) AddListener ¶ added in v0.27.0
func (m *MockServiceResolver) AddListener(name string, notifyChannel chan<- *ChangedEvent) error
AddListener mocks base method.
func (*MockServiceResolver) EXPECT ¶ added in v0.27.0
func (m *MockServiceResolver) EXPECT() *MockServiceResolverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockServiceResolver) Lookup ¶ added in v0.27.0
func (m *MockServiceResolver) Lookup(key string) (*HostInfo, error)
Lookup mocks base method.
func (*MockServiceResolver) MemberCount ¶ added in v0.27.0
func (m *MockServiceResolver) MemberCount() int
MemberCount mocks base method.
func (*MockServiceResolver) Members ¶ added in v0.27.0
func (m *MockServiceResolver) Members() []*HostInfo
Members mocks base method.
func (*MockServiceResolver) RemoveListener ¶ added in v0.27.0
func (m *MockServiceResolver) RemoveListener(name string) error
RemoveListener mocks base method.
func (*MockServiceResolver) RequestRefresh ¶ added in v1.18.0
func (m *MockServiceResolver) RequestRefresh()
RequestRefresh mocks base method.
type MockServiceResolverMockRecorder ¶ added in v0.27.0
type MockServiceResolverMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceResolverMockRecorder is the mock recorder for MockServiceResolver.
func (*MockServiceResolverMockRecorder) AddListener ¶ added in v0.27.0
func (mr *MockServiceResolverMockRecorder) AddListener(name, notifyChannel interface{}) *gomock.Call
AddListener indicates an expected call of AddListener.
func (*MockServiceResolverMockRecorder) Lookup ¶ added in v0.27.0
func (mr *MockServiceResolverMockRecorder) Lookup(key interface{}) *gomock.Call
Lookup indicates an expected call of Lookup.
func (*MockServiceResolverMockRecorder) MemberCount ¶ added in v0.27.0
func (mr *MockServiceResolverMockRecorder) MemberCount() *gomock.Call
MemberCount indicates an expected call of MemberCount.
func (*MockServiceResolverMockRecorder) Members ¶ added in v0.27.0
func (mr *MockServiceResolverMockRecorder) Members() *gomock.Call
Members indicates an expected call of Members.
func (*MockServiceResolverMockRecorder) RemoveListener ¶ added in v0.27.0
func (mr *MockServiceResolverMockRecorder) RemoveListener(name interface{}) *gomock.Call
RemoveListener indicates an expected call of RemoveListener.
func (*MockServiceResolverMockRecorder) RequestRefresh ¶ added in v1.18.0
func (mr *MockServiceResolverMockRecorder) RequestRefresh() *gomock.Call
RequestRefresh indicates an expected call of RequestRefresh.
type Monitor ¶
type Monitor interface { common.Daemon WhoAmI() (*HostInfo, error) // EvictSelf evicts this member from the membership ring. After this method is // called, other members will 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(service primitives.ServiceName, key string) (*HostInfo, error) GetResolver(service primitives.ServiceName) (ServiceResolver, error) // AddListener adds a listener for this service. // The listener will get notified on the given // channel, whenever there is a membership change. // @service: The service to be listened on // @name: The name for identifying the listener // @notifyChannel: The channel on which the caller receives notifications AddListener(service primitives.ServiceName, name string, notifyChannel chan<- *ChangedEvent) error // RemoveListener removes a listener for this service. RemoveListener(service primitives.ServiceName, name string) error // GetReachableMembers returns addresses of all members of the ring GetReachableMembers() ([]string, error) // GetMemberCount returns the number of reachable members // currently in this node's membership list for the given service GetMemberCount(service primitives.ServiceName) (int, error) // WaitUntilInitialized blocks until initialization is completed and returns the result // of initialization. The current implementation does log.Fatal if it can't initialize, // so currently this will never return non-nil, except for context cancel/timeout. A // future implementation might return more errors. WaitUntilInitialized(context.Context) error }
Monitor provides membership information for all temporal services. It can be used to query which member host of a service is responsible for serving a given key.
func NewRingpopMonitor ¶
func NewRingpopMonitor( serviceName primitives.ServiceName, services map[primitives.ServiceName]int, rp *RingPop, logger log.Logger, metadataManager persistence.ClusterMetadataManager, broadcastHostPortResolver func() (string, error), ) Monitor
NewRingpopMonitor returns a ringpop-based membership monitor
type RingPop ¶ added in v0.27.0
type RingPop struct { *ringpop.Ringpop // contains filtered or unexported fields }
RingPop is a simple wrapper
func NewRingPop ¶ added in v0.27.0
func NewRingPop( ringPop *ringpop.Ringpop, maxJoinDuration time.Duration, logger log.Logger, ) *RingPop
NewRingPop create a new ring pop wrapper
type ServiceResolver ¶
type ServiceResolver interface { Lookup(key string) (*HostInfo, error) // AddListener adds a listener which will get notified on the given // channel, whenever membership changes. // @name: The name for identifying the listener // @notifyChannel: The channel on which the caller receives notifications AddListener(name string, notifyChannel chan<- *ChangedEvent) error // RemoveListener removes a listener for this service. RemoveListener(name string) error // MemberCount returns host count in hashring for any particular role MemberCount() int // Members returns all host addresses in hashring for any particular role Members() []*HostInfo // Requests to rebuild the hash ring RequestRefresh() }
ServiceResolver provides membership information for a specific temporal service. It can be used to resolve which member host is responsible for serving a given key.