topology

package
v0.15.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 18 Imported by: 32

Documentation

Overview

Package topology is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Majority

func Majority(replicas int) int

Majority returns the majority required to successfully return when querying a majority of a set of replicas

func NumDesiredForReadConsistency added in v0.14.0

func NumDesiredForReadConsistency(level ReadConsistencyLevel, numReplicas, majority int) int

NumDesiredForReadConsistency returns the number of replicas that would ideally be used to satisfy the read consistency.

func ReadConsistencyAchieved

func ReadConsistencyAchieved(
	level ReadConsistencyLevel,
	majority, numPeers, numSuccess int,
) bool

ReadConsistencyAchieved returns whether sufficient responses have been received to reach the desired consistency. NB: it is not the same as `readConsistencyTermination`.

func ReadConsistencyTermination

func ReadConsistencyTermination(
	level ReadConsistencyLevel,
	majority, remaining, success int32,
) bool

ReadConsistencyTermination returns a bool to indicate whether sufficient responses (error/success) have been received, so that we're able to decide whether we will be able to satisfy the reuquest or not. NB: it is not the same as `readConsistencyAchieved`.

func ValidateConnectConsistencyLevel

func ValidateConnectConsistencyLevel(v ConnectConsistencyLevel) error

ValidateConnectConsistencyLevel returns nil when consistency level is valid, otherwise it returns an error

func ValidateConsistencyLevel

func ValidateConsistencyLevel(v ConsistencyLevel) error

ValidateConsistencyLevel returns nil when consistency level is valid, otherwise it returns an error

func ValidateReadConsistencyLevel

func ValidateReadConsistencyLevel(v ReadConsistencyLevel) error

ValidateReadConsistencyLevel returns nil when consistency level is valid, otherwise it returns an error

func WriteConsistencyAchieved

func WriteConsistencyAchieved(
	level ConsistencyLevel,
	majority, numPeers, numSuccess int,
) bool

WriteConsistencyAchieved returns a bool indicating whether or not we've received enough successful acks to consider a write successful based on the specified consistency level.

Types

type ConnectConsistencyLevel

type ConnectConsistencyLevel int

ConnectConsistencyLevel is the consistency level for connecting to a cluster

const (
	// ConnectConsistencyLevelAny corresponds to connecting to any number of nodes for a given shard
	// set, this strategy will attempt to connect to all, then the majority, then one and then none.
	ConnectConsistencyLevelAny ConnectConsistencyLevel = iota

	// ConnectConsistencyLevelNone corresponds to connecting to no nodes for a given shard set
	ConnectConsistencyLevelNone

	// ConnectConsistencyLevelOne corresponds to connecting to a single node for a given shard set
	ConnectConsistencyLevelOne

	// ConnectConsistencyLevelMajority corresponds to connecting to the majority of nodes for a given shard set
	ConnectConsistencyLevelMajority

	// ConnectConsistencyLevelAll corresponds to connecting to all of the nodes for a given shard set
	ConnectConsistencyLevelAll
)

func ValidConnectConsistencyLevels

func ValidConnectConsistencyLevels() []ConnectConsistencyLevel

ValidConnectConsistencyLevels returns a copy of valid consistency levels to avoid callers mutating the set of valid read consistency levels

func (ConnectConsistencyLevel) String

func (l ConnectConsistencyLevel) String() string

String returns the consistency level as a string

func (*ConnectConsistencyLevel) UnmarshalYAML

func (l *ConnectConsistencyLevel) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals an ConnectConsistencyLevel into a valid type from string.

type ConsistencyLevel

type ConsistencyLevel int

ConsistencyLevel is the consistency level for cluster operations

const (

	// ConsistencyLevelOne corresponds to a single node participating
	// for an operation to succeed
	ConsistencyLevelOne ConsistencyLevel

	// ConsistencyLevelMajority corresponds to the majority of nodes participating
	// for an operation to succeed
	ConsistencyLevelMajority

	// ConsistencyLevelAll corresponds to all nodes participating
	// for an operation to succeed
	ConsistencyLevelAll
)

nolint: varcheck, unused

func ValidConsistencyLevels

func ValidConsistencyLevels() []ConsistencyLevel

ValidConsistencyLevels returns a copy of valid consistency levels to avoid callers mutating the set of valid read consistency levels

func (ConsistencyLevel) String

func (l ConsistencyLevel) String() string

String returns the consistency level as a string

func (*ConsistencyLevel) UnmarshalYAML

func (l *ConsistencyLevel) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals an ConnectConsistencyLevel into a valid type from string.

type DynamicOptions

type DynamicOptions interface {
	// Validate validates the options
	Validate() error

	// SetConfigServiceClient sets the client of ConfigService
	SetConfigServiceClient(c client.Client) DynamicOptions

	// ConfigServiceClient returns the client of ConfigService
	ConfigServiceClient() client.Client

	// SetServiceID sets the ServiceID for service discovery
	SetServiceID(s services.ServiceID) DynamicOptions

	// ServiceID returns the ServiceID for service discovery
	ServiceID() services.ServiceID

	// SetServicesOverrideOptions sets the override options for service discovery.
	SetServicesOverrideOptions(opts services.OverrideOptions) DynamicOptions

	// ServicesOverrideOptions returns the override options for service discovery.
	ServicesOverrideOptions() services.OverrideOptions

	// SetQueryOptions sets the ConfigService query options
	SetQueryOptions(value services.QueryOptions) DynamicOptions

	// QueryOptions returns the ConfigService query options
	QueryOptions() services.QueryOptions

	// SetInstrumentOptions sets the instrumentation options
	SetInstrumentOptions(value instrument.Options) DynamicOptions

	// InstrumentOptions returns the instrumentation options
	InstrumentOptions() instrument.Options

	// SetHashGen sets the HashGen function
	SetHashGen(h sharding.HashGen) DynamicOptions

	// HashGen returns HashGen function
	HashGen() sharding.HashGen
}

DynamicOptions is a set of options for dynamic topology

func NewDynamicOptions

func NewDynamicOptions() DynamicOptions

NewDynamicOptions creates a new set of dynamic topology options

type DynamicTopology

type DynamicTopology interface {
	Topology

	// MarkShardsAvailable marks a shard with the state of initializing as available
	MarkShardsAvailable(instanceID string, shardIDs ...uint32) error
}

DynamicTopology is a topology that dynamically changes and as such adds functionality for a clustered database to call back and mark a shard as available once it completes bootstrapping

type Host

type Host interface {
	// ID is the identifier of the host
	ID() string

	// Address returns the address of the host
	Address() string

	// String returns a string representation of the host
	String() string
}

Host is a container of a host in a topology

func NewHost

func NewHost(id, address string) Host

NewHost creates a new host

type HostID added in v0.4.4

type HostID string

HostID is the string representation of a host ID.

type HostShardConfig

type HostShardConfig struct {
	HostID        string `yaml:"hostID"`
	ListenAddress string `yaml:"listenAddress"`
}

HostShardConfig stores host information for fanout

type HostShardSet

type HostShardSet interface {
	// Host returns the host
	Host() Host

	// ShardSet returns the shard set owned by the host
	ShardSet() sharding.ShardSet
}

HostShardSet is a container for a host and corresponding shard set

func NewHostShardSet

func NewHostShardSet(host Host, shardSet sharding.ShardSet) HostShardSet

NewHostShardSet creates a new host shard set

func NewHostShardSetFromServiceInstance

func NewHostShardSetFromServiceInstance(
	si services.ServiceInstance,
	fn sharding.HashFn,
) (HostShardSet, error)

NewHostShardSetFromServiceInstance creates a new host shard set derived from a service instance

type HostShardState added in v0.4.4

type HostShardState struct {
	Host       Host
	ShardState shard.State
}

HostShardState contains the state of a shard as owned by a given host.

type Initializer

type Initializer interface {
	// Init will return a new topology
	Init() (Topology, error)

	// TopologyIsSet returns whether the topology is able to be
	// initialized immediately or if instead it will blockingly
	// wait to be set on initialization
	TopologyIsSet() (bool, error)
}

Initializer can init new instances of Topology

func NewDynamicInitializer

func NewDynamicInitializer(opts DynamicOptions) Initializer

NewDynamicInitializer returns a dynamic topology initializer

func NewStaticInitializer

func NewStaticInitializer(opts StaticOptions) Initializer

NewStaticInitializer creates a static topology initializer.

type Map

type Map interface {
	// Hosts returns all hosts in the map
	Hosts() []Host

	// HostShardSets returns all HostShardSets in the map
	HostShardSets() []HostShardSet

	// LookupHostShardSet returns a HostShardSet for a host in the map
	LookupHostShardSet(hostID string) (HostShardSet, bool)

	// HostsLen returns the length of all hosts in the map
	HostsLen() int

	// ShardSet returns the shard set for the topology
	ShardSet() sharding.ShardSet

	// Route will route a given ID to a shard and a set of hosts
	Route(id ident.ID) (uint32, []Host, error)

	// RouteForEach will route a given ID to a shard then execute a
	// function for each host in the set of routed hosts
	RouteForEach(id ident.ID, forEachFn RouteForEachFn) error

	// RouteShard will route a given shard to a set of hosts
	RouteShard(shard uint32) ([]Host, error)

	// RouteShardForEach will route a given shard and execute
	// a function for each host in the set of routed hosts
	RouteShardForEach(shard uint32, forEachFn RouteForEachFn) error

	// Replicas returns the number of replicas in the topology
	Replicas() int

	// MajorityReplicas returns the number of replicas to establish majority in the topology
	MajorityReplicas() int
}

Map describes a topology

func NewStaticMap

func NewStaticMap(opts StaticOptions) Map

NewStaticMap creates a new static topology map

type MapProvider added in v0.4.6

type MapProvider interface {
	// TopologyMap returns a topology map.
	TopologyMap() (Map, error)
}

MapProvider is an interface that can provide a topology map.

type MapWatch

type MapWatch interface {
	// C is the notification channel for when a value becomes available
	C() <-chan struct{}

	// Get the current topology map
	Get() Map

	// Close the watch on the topology map
	Close()
}

MapWatch is a watch on a topology map

func NewMapWatch

func NewMapWatch(w xwatch.Watch) MapWatch

NewMapWatch creates a new watch on a topology map from a generic watch that watches a Map

type MockDynamicOptions

type MockDynamicOptions struct {
	// contains filtered or unexported fields
}

MockDynamicOptions is a mock of DynamicOptions interface

func NewMockDynamicOptions

func NewMockDynamicOptions(ctrl *gomock.Controller) *MockDynamicOptions

NewMockDynamicOptions creates a new mock instance

func (*MockDynamicOptions) ConfigServiceClient

func (m *MockDynamicOptions) ConfigServiceClient() client.Client

ConfigServiceClient mocks base method

func (*MockDynamicOptions) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDynamicOptions) HashGen

func (m *MockDynamicOptions) HashGen() sharding.HashGen

HashGen mocks base method

func (*MockDynamicOptions) InstrumentOptions

func (m *MockDynamicOptions) InstrumentOptions() instrument.Options

InstrumentOptions mocks base method

func (*MockDynamicOptions) QueryOptions

func (m *MockDynamicOptions) QueryOptions() services.QueryOptions

QueryOptions mocks base method

func (*MockDynamicOptions) ServiceID

func (m *MockDynamicOptions) ServiceID() services.ServiceID

ServiceID mocks base method

func (*MockDynamicOptions) ServicesOverrideOptions

func (m *MockDynamicOptions) ServicesOverrideOptions() services.OverrideOptions

ServicesOverrideOptions mocks base method

func (*MockDynamicOptions) SetConfigServiceClient

func (m *MockDynamicOptions) SetConfigServiceClient(c client.Client) DynamicOptions

SetConfigServiceClient mocks base method

func (*MockDynamicOptions) SetHashGen

SetHashGen mocks base method

func (*MockDynamicOptions) SetInstrumentOptions

func (m *MockDynamicOptions) SetInstrumentOptions(value instrument.Options) DynamicOptions

SetInstrumentOptions mocks base method

func (*MockDynamicOptions) SetQueryOptions

func (m *MockDynamicOptions) SetQueryOptions(value services.QueryOptions) DynamicOptions

SetQueryOptions mocks base method

func (*MockDynamicOptions) SetServiceID

SetServiceID mocks base method

func (*MockDynamicOptions) SetServicesOverrideOptions

func (m *MockDynamicOptions) SetServicesOverrideOptions(opts services.OverrideOptions) DynamicOptions

SetServicesOverrideOptions mocks base method

func (*MockDynamicOptions) Validate

func (m *MockDynamicOptions) Validate() error

Validate mocks base method

type MockDynamicOptionsMockRecorder

type MockDynamicOptionsMockRecorder struct {
	// contains filtered or unexported fields
}

MockDynamicOptionsMockRecorder is the mock recorder for MockDynamicOptions

func (*MockDynamicOptionsMockRecorder) ConfigServiceClient

func (mr *MockDynamicOptionsMockRecorder) ConfigServiceClient() *gomock.Call

ConfigServiceClient indicates an expected call of ConfigServiceClient

func (*MockDynamicOptionsMockRecorder) HashGen

HashGen indicates an expected call of HashGen

func (*MockDynamicOptionsMockRecorder) InstrumentOptions

func (mr *MockDynamicOptionsMockRecorder) InstrumentOptions() *gomock.Call

InstrumentOptions indicates an expected call of InstrumentOptions

func (*MockDynamicOptionsMockRecorder) QueryOptions

func (mr *MockDynamicOptionsMockRecorder) QueryOptions() *gomock.Call

QueryOptions indicates an expected call of QueryOptions

func (*MockDynamicOptionsMockRecorder) ServiceID

func (mr *MockDynamicOptionsMockRecorder) ServiceID() *gomock.Call

ServiceID indicates an expected call of ServiceID

func (*MockDynamicOptionsMockRecorder) ServicesOverrideOptions

func (mr *MockDynamicOptionsMockRecorder) ServicesOverrideOptions() *gomock.Call

ServicesOverrideOptions indicates an expected call of ServicesOverrideOptions

func (*MockDynamicOptionsMockRecorder) SetConfigServiceClient

func (mr *MockDynamicOptionsMockRecorder) SetConfigServiceClient(c interface{}) *gomock.Call

SetConfigServiceClient indicates an expected call of SetConfigServiceClient

func (*MockDynamicOptionsMockRecorder) SetHashGen

func (mr *MockDynamicOptionsMockRecorder) SetHashGen(h interface{}) *gomock.Call

SetHashGen indicates an expected call of SetHashGen

func (*MockDynamicOptionsMockRecorder) SetInstrumentOptions

func (mr *MockDynamicOptionsMockRecorder) SetInstrumentOptions(value interface{}) *gomock.Call

SetInstrumentOptions indicates an expected call of SetInstrumentOptions

func (*MockDynamicOptionsMockRecorder) SetQueryOptions

func (mr *MockDynamicOptionsMockRecorder) SetQueryOptions(value interface{}) *gomock.Call

SetQueryOptions indicates an expected call of SetQueryOptions

func (*MockDynamicOptionsMockRecorder) SetServiceID

func (mr *MockDynamicOptionsMockRecorder) SetServiceID(s interface{}) *gomock.Call

SetServiceID indicates an expected call of SetServiceID

func (*MockDynamicOptionsMockRecorder) SetServicesOverrideOptions

func (mr *MockDynamicOptionsMockRecorder) SetServicesOverrideOptions(opts interface{}) *gomock.Call

SetServicesOverrideOptions indicates an expected call of SetServicesOverrideOptions

func (*MockDynamicOptionsMockRecorder) Validate

func (mr *MockDynamicOptionsMockRecorder) Validate() *gomock.Call

Validate indicates an expected call of Validate

type MockDynamicTopology

type MockDynamicTopology struct {
	// contains filtered or unexported fields
}

MockDynamicTopology is a mock of DynamicTopology interface

func NewMockDynamicTopology

func NewMockDynamicTopology(ctrl *gomock.Controller) *MockDynamicTopology

NewMockDynamicTopology creates a new mock instance

func (*MockDynamicTopology) Close

func (m *MockDynamicTopology) Close()

Close mocks base method

func (*MockDynamicTopology) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDynamicTopology) Get

func (m *MockDynamicTopology) Get() Map

Get mocks base method

func (*MockDynamicTopology) MarkShardsAvailable added in v0.3.0

func (m *MockDynamicTopology) MarkShardsAvailable(instanceID string, shardIDs ...uint32) error

MarkShardsAvailable mocks base method

func (*MockDynamicTopology) Watch

func (m *MockDynamicTopology) Watch() (MapWatch, error)

Watch mocks base method

type MockDynamicTopologyMockRecorder

type MockDynamicTopologyMockRecorder struct {
	// contains filtered or unexported fields
}

MockDynamicTopologyMockRecorder is the mock recorder for MockDynamicTopology

func (*MockDynamicTopologyMockRecorder) Close

Close indicates an expected call of Close

func (*MockDynamicTopologyMockRecorder) Get

Get indicates an expected call of Get

func (*MockDynamicTopologyMockRecorder) MarkShardsAvailable added in v0.3.0

func (mr *MockDynamicTopologyMockRecorder) MarkShardsAvailable(instanceID interface{}, shardIDs ...interface{}) *gomock.Call

MarkShardsAvailable indicates an expected call of MarkShardsAvailable

func (*MockDynamicTopologyMockRecorder) Watch

Watch indicates an expected call of Watch

type MockHost

type MockHost struct {
	// contains filtered or unexported fields
}

MockHost is a mock of Host interface

func NewMockHost

func NewMockHost(ctrl *gomock.Controller) *MockHost

NewMockHost creates a new mock instance

func (*MockHost) Address

func (m *MockHost) Address() string

Address mocks base method

func (*MockHost) EXPECT

func (m *MockHost) EXPECT() *MockHostMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockHost) ID

func (m *MockHost) ID() string

ID mocks base method

func (*MockHost) String

func (m *MockHost) String() string

String mocks base method

type MockHostMockRecorder

type MockHostMockRecorder struct {
	// contains filtered or unexported fields
}

MockHostMockRecorder is the mock recorder for MockHost

func (*MockHostMockRecorder) Address

func (mr *MockHostMockRecorder) Address() *gomock.Call

Address indicates an expected call of Address

func (*MockHostMockRecorder) ID

func (mr *MockHostMockRecorder) ID() *gomock.Call

ID indicates an expected call of ID

func (*MockHostMockRecorder) String

func (mr *MockHostMockRecorder) String() *gomock.Call

String indicates an expected call of String

type MockHostShardSet

type MockHostShardSet struct {
	// contains filtered or unexported fields
}

MockHostShardSet is a mock of HostShardSet interface

func NewMockHostShardSet

func NewMockHostShardSet(ctrl *gomock.Controller) *MockHostShardSet

NewMockHostShardSet creates a new mock instance

func (*MockHostShardSet) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockHostShardSet) Host

func (m *MockHostShardSet) Host() Host

Host mocks base method

func (*MockHostShardSet) ShardSet

func (m *MockHostShardSet) ShardSet() sharding.ShardSet

ShardSet mocks base method

type MockHostShardSetMockRecorder

type MockHostShardSetMockRecorder struct {
	// contains filtered or unexported fields
}

MockHostShardSetMockRecorder is the mock recorder for MockHostShardSet

func (*MockHostShardSetMockRecorder) Host

Host indicates an expected call of Host

func (*MockHostShardSetMockRecorder) ShardSet

func (mr *MockHostShardSetMockRecorder) ShardSet() *gomock.Call

ShardSet indicates an expected call of ShardSet

type MockInitializer

type MockInitializer struct {
	// contains filtered or unexported fields
}

MockInitializer is a mock of Initializer interface

func NewMockInitializer

func NewMockInitializer(ctrl *gomock.Controller) *MockInitializer

NewMockInitializer creates a new mock instance

func (*MockInitializer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockInitializer) Init

func (m *MockInitializer) Init() (Topology, error)

Init mocks base method

func (*MockInitializer) TopologyIsSet added in v0.9.0

func (m *MockInitializer) TopologyIsSet() (bool, error)

TopologyIsSet mocks base method

type MockInitializerMockRecorder

type MockInitializerMockRecorder struct {
	// contains filtered or unexported fields
}

MockInitializerMockRecorder is the mock recorder for MockInitializer

func (*MockInitializerMockRecorder) Init

Init indicates an expected call of Init

func (*MockInitializerMockRecorder) TopologyIsSet added in v0.9.0

func (mr *MockInitializerMockRecorder) TopologyIsSet() *gomock.Call

TopologyIsSet indicates an expected call of TopologyIsSet

type MockMap

type MockMap struct {
	// contains filtered or unexported fields
}

MockMap is a mock of Map interface

func NewMockMap

func NewMockMap(ctrl *gomock.Controller) *MockMap

NewMockMap creates a new mock instance

func (*MockMap) EXPECT

func (m *MockMap) EXPECT() *MockMapMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMap) HostShardSets

func (m *MockMap) HostShardSets() []HostShardSet

HostShardSets mocks base method

func (*MockMap) Hosts

func (m *MockMap) Hosts() []Host

Hosts mocks base method

func (*MockMap) HostsLen

func (m *MockMap) HostsLen() int

HostsLen mocks base method

func (*MockMap) LookupHostShardSet

func (m *MockMap) LookupHostShardSet(hostID string) (HostShardSet, bool)

LookupHostShardSet mocks base method

func (*MockMap) MajorityReplicas

func (m *MockMap) MajorityReplicas() int

MajorityReplicas mocks base method

func (*MockMap) Replicas

func (m *MockMap) Replicas() int

Replicas mocks base method

func (*MockMap) Route

func (m *MockMap) Route(id ident.ID) (uint32, []Host, error)

Route mocks base method

func (*MockMap) RouteForEach

func (m *MockMap) RouteForEach(id ident.ID, forEachFn RouteForEachFn) error

RouteForEach mocks base method

func (*MockMap) RouteShard

func (m *MockMap) RouteShard(shard uint32) ([]Host, error)

RouteShard mocks base method

func (*MockMap) RouteShardForEach

func (m *MockMap) RouteShardForEach(shard uint32, forEachFn RouteForEachFn) error

RouteShardForEach mocks base method

func (*MockMap) ShardSet

func (m *MockMap) ShardSet() sharding.ShardSet

ShardSet mocks base method

type MockMapMockRecorder

type MockMapMockRecorder struct {
	// contains filtered or unexported fields
}

MockMapMockRecorder is the mock recorder for MockMap

func (*MockMapMockRecorder) HostShardSets

func (mr *MockMapMockRecorder) HostShardSets() *gomock.Call

HostShardSets indicates an expected call of HostShardSets

func (*MockMapMockRecorder) Hosts

func (mr *MockMapMockRecorder) Hosts() *gomock.Call

Hosts indicates an expected call of Hosts

func (*MockMapMockRecorder) HostsLen

func (mr *MockMapMockRecorder) HostsLen() *gomock.Call

HostsLen indicates an expected call of HostsLen

func (*MockMapMockRecorder) LookupHostShardSet

func (mr *MockMapMockRecorder) LookupHostShardSet(hostID interface{}) *gomock.Call

LookupHostShardSet indicates an expected call of LookupHostShardSet

func (*MockMapMockRecorder) MajorityReplicas

func (mr *MockMapMockRecorder) MajorityReplicas() *gomock.Call

MajorityReplicas indicates an expected call of MajorityReplicas

func (*MockMapMockRecorder) Replicas

func (mr *MockMapMockRecorder) Replicas() *gomock.Call

Replicas indicates an expected call of Replicas

func (*MockMapMockRecorder) Route

func (mr *MockMapMockRecorder) Route(id interface{}) *gomock.Call

Route indicates an expected call of Route

func (*MockMapMockRecorder) RouteForEach

func (mr *MockMapMockRecorder) RouteForEach(id, forEachFn interface{}) *gomock.Call

RouteForEach indicates an expected call of RouteForEach

func (*MockMapMockRecorder) RouteShard

func (mr *MockMapMockRecorder) RouteShard(shard interface{}) *gomock.Call

RouteShard indicates an expected call of RouteShard

func (*MockMapMockRecorder) RouteShardForEach

func (mr *MockMapMockRecorder) RouteShardForEach(shard, forEachFn interface{}) *gomock.Call

RouteShardForEach indicates an expected call of RouteShardForEach

func (*MockMapMockRecorder) ShardSet

func (mr *MockMapMockRecorder) ShardSet() *gomock.Call

ShardSet indicates an expected call of ShardSet

type MockMapProvider added in v0.4.6

type MockMapProvider struct {
	// contains filtered or unexported fields
}

MockMapProvider is a mock of MapProvider interface

func NewMockMapProvider added in v0.4.6

func NewMockMapProvider(ctrl *gomock.Controller) *MockMapProvider

NewMockMapProvider creates a new mock instance

func (*MockMapProvider) EXPECT added in v0.4.6

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMapProvider) TopologyMap added in v0.4.6

func (m *MockMapProvider) TopologyMap() (Map, error)

TopologyMap mocks base method

type MockMapProviderMockRecorder added in v0.4.6

type MockMapProviderMockRecorder struct {
	// contains filtered or unexported fields
}

MockMapProviderMockRecorder is the mock recorder for MockMapProvider

func (*MockMapProviderMockRecorder) TopologyMap added in v0.4.6

func (mr *MockMapProviderMockRecorder) TopologyMap() *gomock.Call

TopologyMap indicates an expected call of TopologyMap

type MockMapWatch

type MockMapWatch struct {
	// contains filtered or unexported fields
}

MockMapWatch is a mock of MapWatch interface

func NewMockMapWatch

func NewMockMapWatch(ctrl *gomock.Controller) *MockMapWatch

NewMockMapWatch creates a new mock instance

func (*MockMapWatch) C

func (m *MockMapWatch) C() <-chan struct{}

C mocks base method

func (*MockMapWatch) Close

func (m *MockMapWatch) Close()

Close mocks base method

func (*MockMapWatch) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMapWatch) Get

func (m *MockMapWatch) Get() Map

Get mocks base method

type MockMapWatchMockRecorder

type MockMapWatchMockRecorder struct {
	// contains filtered or unexported fields
}

MockMapWatchMockRecorder is the mock recorder for MockMapWatch

func (*MockMapWatchMockRecorder) C

C indicates an expected call of C

func (*MockMapWatchMockRecorder) Close

func (mr *MockMapWatchMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockMapWatchMockRecorder) Get

Get indicates an expected call of Get

type MockStaticOptions

type MockStaticOptions struct {
	// contains filtered or unexported fields
}

MockStaticOptions is a mock of StaticOptions interface

func NewMockStaticOptions

func NewMockStaticOptions(ctrl *gomock.Controller) *MockStaticOptions

NewMockStaticOptions creates a new mock instance

func (*MockStaticOptions) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockStaticOptions) HostShardSets

func (m *MockStaticOptions) HostShardSets() []HostShardSet

HostShardSets mocks base method

func (*MockStaticOptions) Replicas

func (m *MockStaticOptions) Replicas() int

Replicas mocks base method

func (*MockStaticOptions) SetHostShardSets

func (m *MockStaticOptions) SetHostShardSets(value []HostShardSet) StaticOptions

SetHostShardSets mocks base method

func (*MockStaticOptions) SetReplicas

func (m *MockStaticOptions) SetReplicas(value int) StaticOptions

SetReplicas mocks base method

func (*MockStaticOptions) SetShardSet

func (m *MockStaticOptions) SetShardSet(value sharding.ShardSet) StaticOptions

SetShardSet mocks base method

func (*MockStaticOptions) ShardSet

func (m *MockStaticOptions) ShardSet() sharding.ShardSet

ShardSet mocks base method

func (*MockStaticOptions) Validate

func (m *MockStaticOptions) Validate() error

Validate mocks base method

type MockStaticOptionsMockRecorder

type MockStaticOptionsMockRecorder struct {
	// contains filtered or unexported fields
}

MockStaticOptionsMockRecorder is the mock recorder for MockStaticOptions

func (*MockStaticOptionsMockRecorder) HostShardSets

func (mr *MockStaticOptionsMockRecorder) HostShardSets() *gomock.Call

HostShardSets indicates an expected call of HostShardSets

func (*MockStaticOptionsMockRecorder) Replicas

func (mr *MockStaticOptionsMockRecorder) Replicas() *gomock.Call

Replicas indicates an expected call of Replicas

func (*MockStaticOptionsMockRecorder) SetHostShardSets

func (mr *MockStaticOptionsMockRecorder) SetHostShardSets(value interface{}) *gomock.Call

SetHostShardSets indicates an expected call of SetHostShardSets

func (*MockStaticOptionsMockRecorder) SetReplicas

func (mr *MockStaticOptionsMockRecorder) SetReplicas(value interface{}) *gomock.Call

SetReplicas indicates an expected call of SetReplicas

func (*MockStaticOptionsMockRecorder) SetShardSet

func (mr *MockStaticOptionsMockRecorder) SetShardSet(value interface{}) *gomock.Call

SetShardSet indicates an expected call of SetShardSet

func (*MockStaticOptionsMockRecorder) ShardSet

func (mr *MockStaticOptionsMockRecorder) ShardSet() *gomock.Call

ShardSet indicates an expected call of ShardSet

func (*MockStaticOptionsMockRecorder) Validate

func (mr *MockStaticOptionsMockRecorder) Validate() *gomock.Call

Validate indicates an expected call of Validate

type MockTopology

type MockTopology struct {
	// contains filtered or unexported fields
}

MockTopology is a mock of Topology interface

func NewMockTopology

func NewMockTopology(ctrl *gomock.Controller) *MockTopology

NewMockTopology creates a new mock instance

func (*MockTopology) Close

func (m *MockTopology) Close()

Close mocks base method

func (*MockTopology) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockTopology) Get

func (m *MockTopology) Get() Map

Get mocks base method

func (*MockTopology) Watch

func (m *MockTopology) Watch() (MapWatch, error)

Watch mocks base method

type MockTopologyMockRecorder

type MockTopologyMockRecorder struct {
	// contains filtered or unexported fields
}

MockTopologyMockRecorder is the mock recorder for MockTopology

func (*MockTopologyMockRecorder) Close

func (mr *MockTopologyMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockTopologyMockRecorder) Get

Get indicates an expected call of Get

func (*MockTopologyMockRecorder) Watch

func (mr *MockTopologyMockRecorder) Watch() *gomock.Call

Watch indicates an expected call of Watch

type ReadConsistencyLevel

type ReadConsistencyLevel int

ReadConsistencyLevel is the consistency level for reading from a cluster

const (
	// ReadConsistencyLevelNone corresponds to reading from no nodes
	ReadConsistencyLevelNone ReadConsistencyLevel = iota

	// ReadConsistencyLevelOne corresponds to reading from a single node
	ReadConsistencyLevelOne

	// ReadConsistencyLevelUnstrictMajority corresponds to reading from the majority of nodes
	// but relaxing the constraint when it cannot be met, falling back to returning success when
	// reading from at least a single node after attempting reading from the majority of nodes
	ReadConsistencyLevelUnstrictMajority

	// ReadConsistencyLevelMajority corresponds to reading from the majority of nodes
	ReadConsistencyLevelMajority

	// ReadConsistencyLevelAll corresponds to reading from all of the nodes
	ReadConsistencyLevelAll
)

func ValidReadConsistencyLevels

func ValidReadConsistencyLevels() []ReadConsistencyLevel

ValidReadConsistencyLevels returns a copy of valid consistency levels to avoid callers mutating the set of valid read consistency levels

func (ReadConsistencyLevel) String

func (l ReadConsistencyLevel) String() string

String returns the consistency level as a string

func (*ReadConsistencyLevel) UnmarshalYAML

func (l *ReadConsistencyLevel) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals an ConnectConsistencyLevel into a valid type from string.

type RouteForEachFn

type RouteForEachFn func(idx int, host Host)

RouteForEachFn is a function to execute for each routed to host

type ShardID added in v0.4.4

type ShardID uint32

ShardID is the ID of a shard.

type ShardStates added in v0.4.4

type ShardStates map[ShardID]map[HostID]HostShardState

ShardStates maps shard IDs to the state of each of the hosts that own that shard.

type StateSnapshot added in v0.4.4

type StateSnapshot struct {
	Origin           Host
	MajorityReplicas int
	ShardStates      ShardStates
}

StateSnapshot represents a snapshot of the state of the topology at a given moment.

type StaticConfiguration

type StaticConfiguration struct {
	Shards   int               `yaml:"shards"`
	Replicas int               `yaml:"replicas"`
	Hosts    []HostShardConfig `yaml:"hosts"`
}

StaticConfiguration is used for standing up M3DB with a static topology

type StaticOptions

type StaticOptions interface {
	// Validate validates the options
	Validate() error

	// SetShardSet sets the ShardSet
	SetShardSet(value sharding.ShardSet) StaticOptions

	// ShardSet returns the ShardSet
	ShardSet() sharding.ShardSet

	// SetReplicas sets the replicas
	SetReplicas(value int) StaticOptions

	// Replicas returns the replicas
	Replicas() int

	// SetHostShardSets sets the hostShardSets
	SetHostShardSets(value []HostShardSet) StaticOptions

	// HostShardSets returns the hostShardSets
	HostShardSets() []HostShardSet
}

StaticOptions is a set of options for static topology

func NewStaticOptions

func NewStaticOptions() StaticOptions

NewStaticOptions creates a new set of static topology options

type Topology

type Topology interface {
	// Get the topology map
	Get() Map

	// Watch for the topology map
	Watch() (MapWatch, error)

	// Close will close the topology map
	Close()
}

Topology is a container of a topology map and disseminates topology map changes

func NewStaticTopology

func NewStaticTopology(opts StaticOptions) Topology

NewStaticTopology creates a static topology.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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