membership

package
v1.2.10-prerelease3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 19 Imported by: 19

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

View Source
const (
	PortTchannel = "tchannel"
	PortGRPC     = "grpc"
)

Variables

View Source
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

type ChangedEvent struct {
	HostsAdded   []string
	HostsUpdated []string
	HostsRemoved []string
}

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

func NewDetailedHostInfo(addr string, identity string, portMap PortMap) HostInfo

NewDetailedHostInfo creates a new HostInfo instance with identity and portmap information

func NewHostInfo

func NewHostInfo(addr string) HostInfo

NewHostInfo creates a new HostInfo instance

func (HostInfo) Belongs added in v0.24.0

func (hi HostInfo) Belongs(address string) (bool, error)

Belongs tells if ip:port is assigned to this member

func (HostInfo) GetAddress

func (hi HostInfo) GetAddress() string

GetAddress returns the ip:port address

func (HostInfo) GetNamedAddress added in v0.24.0

func (hi HostInfo) GetNamedAddress(port string) (string, error)

GetNamedAddress returns the ip:port address

func (HostInfo) Identity

func (hi HostInfo) Identity() string

Identity implements ringpop's Membership interface

func (HostInfo) Label

func (hi HostInfo) Label(key string) (value string, has bool)

Label is a noop function to conform to ringpop hashring member interface

func (HostInfo) SetLabel

func (hi HostInfo) SetLabel(key string, value string)

SetLabel is a noop function to conform to ringpop hashring member interface

func (HostInfo) String added in v0.24.0

func (hi HostInfo) String() string

String will return a human-readable host details

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

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

Start indicates an expected call of Start.

func (*MockPeerProviderMockRecorder) Stop added in v0.24.0

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

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

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) Stop added in v0.24.0

func (m *MockResolver) Stop()

Stop 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 PortMap added in v0.24.0

type PortMap map[string]uint16

PortMap is a map of port names to port numbers.

func (PortMap) String added in v0.24.0

func (m PortMap) String() string

String formats a PortMap into a string of name:port pairs

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.

Jump to

Keyboard shortcuts

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