Documentation ¶
Overview ¶
Package membership is a generated GoMock package.
Index ¶
- Variables
- func NewHostInfoProvider(hostInfo HostInfo) *hostInfoProvider
- type ChangedEvent
- type GRPCResolver
- type HostInfo
- type HostInfoProvider
- type MockHostInfoProvider
- type MockHostInfoProviderMockRecorder
- type MockMonitor
- func (m *MockMonitor) ApproximateMaxPropagationTime() time.Duration
- func (m *MockMonitor) EXPECT() *MockMonitorMockRecorder
- func (m *MockMonitor) EvictSelf() error
- func (m *MockMonitor) EvictSelfAt(asOf time.Time) (time.Duration, error)
- func (m *MockMonitor) GetReachableMembers() ([]string, error)
- func (m *MockMonitor) GetResolver(service primitives.ServiceName) (ServiceResolver, error)
- func (m *MockMonitor) SetDraining(draining bool) error
- func (m *MockMonitor) Start()
- func (m *MockMonitor) WaitUntilInitialized(arg0 context.Context) error
- type MockMonitorMockRecorder
- func (mr *MockMonitorMockRecorder) ApproximateMaxPropagationTime() *gomock.Call
- func (mr *MockMonitorMockRecorder) EvictSelf() *gomock.Call
- func (mr *MockMonitorMockRecorder) EvictSelfAt(asOf interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) GetReachableMembers() *gomock.Call
- func (mr *MockMonitorMockRecorder) GetResolver(service interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) SetDraining(draining interface{}) *gomock.Call
- func (mr *MockMonitorMockRecorder) Start() *gomock.Call
- func (mr *MockMonitorMockRecorder) WaitUntilInitialized(arg0 interface{}) *gomock.Call
- type MockServiceResolver
- func (m *MockServiceResolver) AddListener(name string, notifyChannel chan<- *ChangedEvent) error
- func (m *MockServiceResolver) AvailableMembers() []HostInfo
- func (m *MockServiceResolver) EXPECT() *MockServiceResolverMockRecorder
- func (m *MockServiceResolver) Lookup(key string) (HostInfo, error)
- func (m *MockServiceResolver) LookupN(key string, n int) []HostInfo
- 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) AvailableMembers() *gomock.Call
- func (mr *MockServiceResolverMockRecorder) Lookup(key interface{}) *gomock.Call
- func (mr *MockServiceResolverMockRecorder) LookupN(key, n 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 ServiceResolver
Constants ¶
This section is empty.
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), ) )
Functions ¶
func NewHostInfoProvider ¶ added in v1.16.0
func NewHostInfoProvider(hostInfo HostInfo) *hostInfoProvider
Types ¶
type ChangedEvent ¶
ChangedEvent describes a change in membership
type GRPCResolver ¶ added in v1.18.0
type GRPCResolver struct{}
GRPCResolver is an 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 interface { // Identity returns the unique identifier of the host. // This may be the same as the address. Identity() string // GetAddress returns the socket address of the host (i.e. <ip>:<port>). // This must be a valid gRPC address. GetAddress() string }
HostInfo represents the host of a Temporal service.
func NewHostInfoFromAddress ¶ added in v1.21.0
NewHostInfoFromAddress creates a new HostInfo instance from a socket address.
type HostInfoProvider ¶ added in v1.16.0
type HostInfoProvider interface {
HostInfo() HostInfo
}
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.
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.
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) ApproximateMaxPropagationTime ¶ added in v1.24.0
func (m *MockMonitor) ApproximateMaxPropagationTime() time.Duration
ApproximateMaxPropagationTime 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) EvictSelfAt ¶ added in v1.24.0
EvictSelfAt 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) SetDraining ¶ added in v1.24.0
func (m *MockMonitor) SetDraining(draining bool) error
SetDraining mocks base method.
func (*MockMonitor) WaitUntilInitialized ¶ added in v1.20.0
func (m *MockMonitor) WaitUntilInitialized(arg0 context.Context) error
WaitUntilInitialized 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) ApproximateMaxPropagationTime ¶ added in v1.24.0
func (mr *MockMonitorMockRecorder) ApproximateMaxPropagationTime() *gomock.Call
ApproximateMaxPropagationTime indicates an expected call of ApproximateMaxPropagationTime.
func (*MockMonitorMockRecorder) EvictSelf ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) EvictSelf() *gomock.Call
EvictSelf indicates an expected call of EvictSelf.
func (*MockMonitorMockRecorder) EvictSelfAt ¶ added in v1.24.0
func (mr *MockMonitorMockRecorder) EvictSelfAt(asOf interface{}) *gomock.Call
EvictSelfAt indicates an expected call of EvictSelfAt.
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) SetDraining ¶ added in v1.24.0
func (mr *MockMonitorMockRecorder) SetDraining(draining interface{}) *gomock.Call
SetDraining indicates an expected call of SetDraining.
func (*MockMonitorMockRecorder) Start ¶ added in v0.27.0
func (mr *MockMonitorMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockMonitorMockRecorder) WaitUntilInitialized ¶ added in v1.20.0
func (mr *MockMonitorMockRecorder) WaitUntilInitialized(arg0 interface{}) *gomock.Call
WaitUntilInitialized indicates an expected call of WaitUntilInitialized.
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) AvailableMembers ¶ added in v1.24.0
func (m *MockServiceResolver) AvailableMembers() []HostInfo
AvailableMembers 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) LookupN ¶ added in v1.23.0
func (m *MockServiceResolver) LookupN(key string, n int) []HostInfo
LookupN 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) AvailableMembers ¶ added in v1.24.0
func (mr *MockServiceResolverMockRecorder) AvailableMembers() *gomock.Call
AvailableMembers indicates an expected call of AvailableMembers.
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) LookupN ¶ added in v1.23.0
func (mr *MockServiceResolverMockRecorder) LookupN(key, n interface{}) *gomock.Call
LookupN indicates an expected call of LookupN.
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 { // Start causes this service to join the membership ring. Services // should not call Start until they are ready to receive requests from // other cluster members. Start() // 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 // EvictSelfAt is similar to EvictSelf but causes the change to take effect on all // hosts at that absolute time (assuming it's in the future). This process should stay // alive for at least the returned duration after calling this, so that all membership // information can be propagated correctly. The resolution of asOf is whole seconds. EvictSelfAt(asOf time.Time) (time.Duration, error) // GetResolver returns the service resolver for a service in the cluster. GetResolver(service primitives.ServiceName) (ServiceResolver, error) // GetReachableMembers returns addresses of all members of the ring. GetReachableMembers() ([]string, 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 // SetDraining sets the draining state (synchronized through ringpop) SetDraining(draining bool) error // ApproximateMaxPropagationTime returns an approximate upper bound on propagation time // for updates to membership information. This is _not_ a guarantee! This value is only // provided to help with startup/shutdown timing as a best-effort. ApproximateMaxPropagationTime() time.Duration }
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.
type ServiceResolver ¶
type ServiceResolver interface { // Lookup looks up the host that currently owns the resource identified by the given key. Lookup(key string) (HostInfo, error) // LookupN looks n hosts that owns the resource identified by the given key, if n greater than total number // of hosts total number of hosts will be returned LookupN(key string, n int) []HostInfo // AddListener adds a listener which will get notified on the given channel whenever membership changes. AddListener(name string, notifyChannel chan<- *ChangedEvent) error // RemoveListener removes a listener for this service. RemoveListener(name string) error // MemberCount returns the number of known hosts running this service. MemberCount() int // Members returns all known hosts available for this service. Members() []HostInfo // AvailableMembers returns all hosts available for this service that are accepting requests (not draining). AvailableMembers() []HostInfo // RequestRefresh requests that the membership information be refreshed. RequestRefresh() }
ServiceResolver provides membership information for a specific temporal service. It can also be used to determine the placement of resources across hosts.