membership

package
v1.22.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package membership is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrIncorrectAddressFormat = errors.New("incorrect address format")

ErrIncorrectAddressFormat is thrown on incorrect address format

View Source
var ErrInsufficientHosts = serviceerror.NewUnavailable("Not enough hosts to serve the request")

ErrInsufficientHosts is thrown when there are not enough hosts to serve the request

View Source
var ErrListenerAlreadyExist = errors.New("listener already exist for the service")

ErrListenerAlreadyExist is thrown on a duplicate AddListener call from the same listener

View Source
var ErrUnknownService = errors.New("service not tracked by Monitor")

ErrUnknownService is thrown for a service that is not tracked by this instance

View Source
var (
	GRPCResolverModule = fx.Options(
		fx.Provide(initializeBuilder),
	)
)

Functions

func NewHostInfoProvider added in v1.16.0

func NewHostInfoProvider(hostInfo HostInfo) *hostInfoProvider

Types

type ChangedEvent

type ChangedEvent struct {
	HostsAdded   []HostInfo
	HostsRemoved []HostInfo
}

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

func NewHostInfoFromAddress(address string) HostInfo

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

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

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) 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) 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) Start added in v0.27.0

func (m *MockMonitor) Start()

Start 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) EvictSelf added in v0.27.0

func (mr *MockMonitorMockRecorder) EvictSelf() *gomock.Call

EvictSelf indicates an expected call of EvictSelf.

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) 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) EXPECT added in v0.27.0

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

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
	// 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
}

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)
	// 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
	// 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.

Directories

Path Synopsis
Package ringpop provides a service-based membership monitor
Package ringpop provides a service-based membership monitor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL