Documentation
¶
Index ¶
- type ConsistencyLevel
- type MockReadReplicaStrategy
- type MockReadReplicaStrategy_Apply_Call
- func (_c *MockReadReplicaStrategy_Apply_Call) Return(_a0 ReadReplicaSet) *MockReadReplicaStrategy_Apply_Call
- func (_c *MockReadReplicaStrategy_Apply_Call) Run(run func(replicas ReadReplicaSet, options RoutingPlanBuildOptions)) *MockReadReplicaStrategy_Apply_Call
- func (_c *MockReadReplicaStrategy_Apply_Call) RunAndReturn(run func(ReadReplicaSet, RoutingPlanBuildOptions) ReadReplicaSet) *MockReadReplicaStrategy_Apply_Call
- type MockReadReplicaStrategy_Expecter
- type MockRouter
- func (_m *MockRouter) AllHostnames() []string
- func (_m *MockRouter) BuildReadRoutingPlan(params RoutingPlanBuildOptions) (ReadRoutingPlan, error)
- func (_m *MockRouter) BuildRoutingPlanOptions(tenant string, shard string, cl ConsistencyLevel, directCandidate string) RoutingPlanBuildOptions
- func (_m *MockRouter) BuildWriteRoutingPlan(params RoutingPlanBuildOptions) (WriteRoutingPlan, error)
- func (_m *MockRouter) EXPECT() *MockRouter_Expecter
- func (_m *MockRouter) GetReadReplicasLocation(collection string, tenant string, shard string) (ReadReplicaSet, error)
- func (_m *MockRouter) GetReadWriteReplicasLocation(collection string, tenant string, shard string) (ReadReplicaSet, WriteReplicaSet, error)
- func (_m *MockRouter) GetWriteReplicasLocation(collection string, tenant string, shard string) (WriteReplicaSet, error)
- func (_m *MockRouter) NodeHostname(nodeName string) (string, bool)
- type MockRouter_AllHostnames_Call
- type MockRouter_BuildReadRoutingPlan_Call
- func (_c *MockRouter_BuildReadRoutingPlan_Call) Return(_a0 ReadRoutingPlan, _a1 error) *MockRouter_BuildReadRoutingPlan_Call
- func (_c *MockRouter_BuildReadRoutingPlan_Call) Run(run func(params RoutingPlanBuildOptions)) *MockRouter_BuildReadRoutingPlan_Call
- func (_c *MockRouter_BuildReadRoutingPlan_Call) RunAndReturn(run func(RoutingPlanBuildOptions) (ReadRoutingPlan, error)) *MockRouter_BuildReadRoutingPlan_Call
- type MockRouter_BuildRoutingPlanOptions_Call
- func (_c *MockRouter_BuildRoutingPlanOptions_Call) Return(_a0 RoutingPlanBuildOptions) *MockRouter_BuildRoutingPlanOptions_Call
- func (_c *MockRouter_BuildRoutingPlanOptions_Call) Run(...) *MockRouter_BuildRoutingPlanOptions_Call
- func (_c *MockRouter_BuildRoutingPlanOptions_Call) RunAndReturn(run func(string, string, ConsistencyLevel, string) RoutingPlanBuildOptions) *MockRouter_BuildRoutingPlanOptions_Call
- type MockRouter_BuildWriteRoutingPlan_Call
- func (_c *MockRouter_BuildWriteRoutingPlan_Call) Return(_a0 WriteRoutingPlan, _a1 error) *MockRouter_BuildWriteRoutingPlan_Call
- func (_c *MockRouter_BuildWriteRoutingPlan_Call) Run(run func(params RoutingPlanBuildOptions)) *MockRouter_BuildWriteRoutingPlan_Call
- func (_c *MockRouter_BuildWriteRoutingPlan_Call) RunAndReturn(run func(RoutingPlanBuildOptions) (WriteRoutingPlan, error)) *MockRouter_BuildWriteRoutingPlan_Call
- type MockRouter_Expecter
- func (_e *MockRouter_Expecter) AllHostnames() *MockRouter_AllHostnames_Call
- func (_e *MockRouter_Expecter) BuildReadRoutingPlan(params interface{}) *MockRouter_BuildReadRoutingPlan_Call
- func (_e *MockRouter_Expecter) BuildRoutingPlanOptions(tenant interface{}, shard interface{}, cl interface{}, ...) *MockRouter_BuildRoutingPlanOptions_Call
- func (_e *MockRouter_Expecter) BuildWriteRoutingPlan(params interface{}) *MockRouter_BuildWriteRoutingPlan_Call
- func (_e *MockRouter_Expecter) GetReadReplicasLocation(collection interface{}, tenant interface{}, shard interface{}) *MockRouter_GetReadReplicasLocation_Call
- func (_e *MockRouter_Expecter) GetReadWriteReplicasLocation(collection interface{}, tenant interface{}, shard interface{}) *MockRouter_GetReadWriteReplicasLocation_Call
- func (_e *MockRouter_Expecter) GetWriteReplicasLocation(collection interface{}, tenant interface{}, shard interface{}) *MockRouter_GetWriteReplicasLocation_Call
- func (_e *MockRouter_Expecter) NodeHostname(nodeName interface{}) *MockRouter_NodeHostname_Call
- type MockRouter_GetReadReplicasLocation_Call
- func (_c *MockRouter_GetReadReplicasLocation_Call) Return(_a0 ReadReplicaSet, _a1 error) *MockRouter_GetReadReplicasLocation_Call
- func (_c *MockRouter_GetReadReplicasLocation_Call) Run(run func(collection string, tenant string, shard string)) *MockRouter_GetReadReplicasLocation_Call
- func (_c *MockRouter_GetReadReplicasLocation_Call) RunAndReturn(run func(string, string, string) (ReadReplicaSet, error)) *MockRouter_GetReadReplicasLocation_Call
- type MockRouter_GetReadWriteReplicasLocation_Call
- func (_c *MockRouter_GetReadWriteReplicasLocation_Call) Return(readReplicas ReadReplicaSet, writeReplicas WriteReplicaSet, err error) *MockRouter_GetReadWriteReplicasLocation_Call
- func (_c *MockRouter_GetReadWriteReplicasLocation_Call) Run(run func(collection string, tenant string, shard string)) *MockRouter_GetReadWriteReplicasLocation_Call
- func (_c *MockRouter_GetReadWriteReplicasLocation_Call) RunAndReturn(run func(string, string, string) (ReadReplicaSet, WriteReplicaSet, error)) *MockRouter_GetReadWriteReplicasLocation_Call
- type MockRouter_GetWriteReplicasLocation_Call
- func (_c *MockRouter_GetWriteReplicasLocation_Call) Return(_a0 WriteReplicaSet, _a1 error) *MockRouter_GetWriteReplicasLocation_Call
- func (_c *MockRouter_GetWriteReplicasLocation_Call) Run(run func(collection string, tenant string, shard string)) *MockRouter_GetWriteReplicasLocation_Call
- func (_c *MockRouter_GetWriteReplicasLocation_Call) RunAndReturn(run func(string, string, string) (WriteReplicaSet, error)) *MockRouter_GetWriteReplicasLocation_Call
- type MockRouter_NodeHostname_Call
- func (_c *MockRouter_NodeHostname_Call) Return(_a0 string, _a1 bool) *MockRouter_NodeHostname_Call
- func (_c *MockRouter_NodeHostname_Call) Run(run func(nodeName string)) *MockRouter_NodeHostname_Call
- func (_c *MockRouter_NodeHostname_Call) RunAndReturn(run func(string) (string, bool)) *MockRouter_NodeHostname_Call
- type ReadReplicaSet
- func (s ReadReplicaSet) EmptyReplicas() bool
- func (s ReadReplicaSet) HostAddresses() []string
- func (s ReadReplicaSet) NodeNames() []string
- func (s ReadReplicaSet) Shards() []string
- func (s ReadReplicaSet) String() string
- func (s ReadReplicaSet) ValidateConsistencyLevel(level ConsistencyLevel) (int, error)
- type ReadRoutingPlan
- type RepairResponse
- type Replica
- type Router
- type RoutingPlanBuildOptions
- type WriteReplicaSet
- func (s WriteReplicaSet) AdditionalHostAddresses() []string
- func (s WriteReplicaSet) AdditionalNodeNames() []string
- func (s WriteReplicaSet) AdditionalShards() []string
- func (s WriteReplicaSet) EmptyAdditionalReplicas() bool
- func (s WriteReplicaSet) HostAddresses() []string
- func (s WriteReplicaSet) IsEmpty() bool
- func (s WriteReplicaSet) NodeNames() []string
- func (s WriteReplicaSet) Shards() []string
- func (s WriteReplicaSet) ValidateConsistencyLevel(level ConsistencyLevel) (int, error)
- type WriteRoutingPlan
- func (p WriteRoutingPlan) AdditionalHostAddresses() []string
- func (p WriteRoutingPlan) AdditionalHostNames() []string
- func (p WriteRoutingPlan) AdditionalReplicas() []Replica
- func (p WriteRoutingPlan) AdditionalShards() []string
- func (p WriteRoutingPlan) HostAddresses() []string
- func (p WriteRoutingPlan) HostNames() []string
- func (p WriteRoutingPlan) LogFields() logrus.Fields
- func (p WriteRoutingPlan) Replicas() []Replica
- func (p WriteRoutingPlan) Shards() []string
- func (p WriteRoutingPlan) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsistencyLevel ¶
type ConsistencyLevel string
ConsistencyLevel is an enum of all possible consistency level
const ( ConsistencyLevelOne ConsistencyLevel = "ONE" ConsistencyLevelQuorum ConsistencyLevel = "QUORUM" ConsistencyLevelAll ConsistencyLevel = "ALL" )
func (ConsistencyLevel) ToInt ¶
func (l ConsistencyLevel) ToInt(n int) int
ToInt returns the minimum number needed to satisfy consistency level l among N
type MockReadReplicaStrategy ¶ added in v1.33.0
MockReadReplicaStrategy is an autogenerated mock type for the ReadReplicaStrategy type
func NewMockReadReplicaStrategy ¶ added in v1.33.0
func NewMockReadReplicaStrategy(t interface {
mock.TestingT
Cleanup(func())
}) *MockReadReplicaStrategy
NewMockReadReplicaStrategy creates a new instance of MockReadReplicaStrategy. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockReadReplicaStrategy) Apply ¶ added in v1.33.0
func (_m *MockReadReplicaStrategy) Apply(replicas ReadReplicaSet, options RoutingPlanBuildOptions) ReadReplicaSet
Apply provides a mock function with given fields: replicas, options
func (*MockReadReplicaStrategy) EXPECT ¶ added in v1.33.0
func (_m *MockReadReplicaStrategy) EXPECT() *MockReadReplicaStrategy_Expecter
type MockReadReplicaStrategy_Apply_Call ¶ added in v1.33.0
MockReadReplicaStrategy_Apply_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Apply'
func (*MockReadReplicaStrategy_Apply_Call) Return ¶ added in v1.33.0
func (_c *MockReadReplicaStrategy_Apply_Call) Return(_a0 ReadReplicaSet) *MockReadReplicaStrategy_Apply_Call
func (*MockReadReplicaStrategy_Apply_Call) Run ¶ added in v1.33.0
func (_c *MockReadReplicaStrategy_Apply_Call) Run(run func(replicas ReadReplicaSet, options RoutingPlanBuildOptions)) *MockReadReplicaStrategy_Apply_Call
func (*MockReadReplicaStrategy_Apply_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockReadReplicaStrategy_Apply_Call) RunAndReturn(run func(ReadReplicaSet, RoutingPlanBuildOptions) ReadReplicaSet) *MockReadReplicaStrategy_Apply_Call
type MockReadReplicaStrategy_Expecter ¶ added in v1.33.0
type MockReadReplicaStrategy_Expecter struct {
// contains filtered or unexported fields
}
func (*MockReadReplicaStrategy_Expecter) Apply ¶ added in v1.33.0
func (_e *MockReadReplicaStrategy_Expecter) Apply(replicas interface{}, options interface{}) *MockReadReplicaStrategy_Apply_Call
Apply is a helper method to define mock.On call
- replicas ReadReplicaSet
- options RoutingPlanBuildOptions
type MockRouter ¶ added in v1.33.0
MockRouter is an autogenerated mock type for the Router type
func NewMockRouter ¶ added in v1.33.0
func NewMockRouter(t interface {
mock.TestingT
Cleanup(func())
}) *MockRouter
NewMockRouter creates a new instance of MockRouter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockRouter) AllHostnames ¶ added in v1.33.0
func (_m *MockRouter) AllHostnames() []string
AllHostnames provides a mock function with no fields
func (*MockRouter) BuildReadRoutingPlan ¶ added in v1.33.0
func (_m *MockRouter) BuildReadRoutingPlan(params RoutingPlanBuildOptions) (ReadRoutingPlan, error)
BuildReadRoutingPlan provides a mock function with given fields: params
func (*MockRouter) BuildRoutingPlanOptions ¶ added in v1.33.0
func (_m *MockRouter) BuildRoutingPlanOptions(tenant string, shard string, cl ConsistencyLevel, directCandidate string) RoutingPlanBuildOptions
BuildRoutingPlanOptions provides a mock function with given fields: tenant, shard, cl, directCandidate
func (*MockRouter) BuildWriteRoutingPlan ¶ added in v1.33.0
func (_m *MockRouter) BuildWriteRoutingPlan(params RoutingPlanBuildOptions) (WriteRoutingPlan, error)
BuildWriteRoutingPlan provides a mock function with given fields: params
func (*MockRouter) EXPECT ¶ added in v1.33.0
func (_m *MockRouter) EXPECT() *MockRouter_Expecter
func (*MockRouter) GetReadReplicasLocation ¶ added in v1.33.0
func (_m *MockRouter) GetReadReplicasLocation(collection string, tenant string, shard string) (ReadReplicaSet, error)
GetReadReplicasLocation provides a mock function with given fields: collection, tenant, shard
func (*MockRouter) GetReadWriteReplicasLocation ¶ added in v1.33.0
func (_m *MockRouter) GetReadWriteReplicasLocation(collection string, tenant string, shard string) (ReadReplicaSet, WriteReplicaSet, error)
GetReadWriteReplicasLocation provides a mock function with given fields: collection, tenant, shard
func (*MockRouter) GetWriteReplicasLocation ¶ added in v1.33.0
func (_m *MockRouter) GetWriteReplicasLocation(collection string, tenant string, shard string) (WriteReplicaSet, error)
GetWriteReplicasLocation provides a mock function with given fields: collection, tenant, shard
func (*MockRouter) NodeHostname ¶ added in v1.33.0
func (_m *MockRouter) NodeHostname(nodeName string) (string, bool)
NodeHostname provides a mock function with given fields: nodeName
type MockRouter_AllHostnames_Call ¶ added in v1.33.0
MockRouter_AllHostnames_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AllHostnames'
func (*MockRouter_AllHostnames_Call) Return ¶ added in v1.33.0
func (_c *MockRouter_AllHostnames_Call) Return(_a0 []string) *MockRouter_AllHostnames_Call
func (*MockRouter_AllHostnames_Call) Run ¶ added in v1.33.0
func (_c *MockRouter_AllHostnames_Call) Run(run func()) *MockRouter_AllHostnames_Call
func (*MockRouter_AllHostnames_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockRouter_AllHostnames_Call) RunAndReturn(run func() []string) *MockRouter_AllHostnames_Call
type MockRouter_BuildReadRoutingPlan_Call ¶ added in v1.33.0
MockRouter_BuildReadRoutingPlan_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BuildReadRoutingPlan'
func (*MockRouter_BuildReadRoutingPlan_Call) Return ¶ added in v1.33.0
func (_c *MockRouter_BuildReadRoutingPlan_Call) Return(_a0 ReadRoutingPlan, _a1 error) *MockRouter_BuildReadRoutingPlan_Call
func (*MockRouter_BuildReadRoutingPlan_Call) Run ¶ added in v1.33.0
func (_c *MockRouter_BuildReadRoutingPlan_Call) Run(run func(params RoutingPlanBuildOptions)) *MockRouter_BuildReadRoutingPlan_Call
func (*MockRouter_BuildReadRoutingPlan_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockRouter_BuildReadRoutingPlan_Call) RunAndReturn(run func(RoutingPlanBuildOptions) (ReadRoutingPlan, error)) *MockRouter_BuildReadRoutingPlan_Call
type MockRouter_BuildRoutingPlanOptions_Call ¶ added in v1.33.0
MockRouter_BuildRoutingPlanOptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BuildRoutingPlanOptions'
func (*MockRouter_BuildRoutingPlanOptions_Call) Return ¶ added in v1.33.0
func (_c *MockRouter_BuildRoutingPlanOptions_Call) Return(_a0 RoutingPlanBuildOptions) *MockRouter_BuildRoutingPlanOptions_Call
func (*MockRouter_BuildRoutingPlanOptions_Call) Run ¶ added in v1.33.0
func (_c *MockRouter_BuildRoutingPlanOptions_Call) Run(run func(tenant string, shard string, cl ConsistencyLevel, directCandidate string)) *MockRouter_BuildRoutingPlanOptions_Call
func (*MockRouter_BuildRoutingPlanOptions_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockRouter_BuildRoutingPlanOptions_Call) RunAndReturn(run func(string, string, ConsistencyLevel, string) RoutingPlanBuildOptions) *MockRouter_BuildRoutingPlanOptions_Call
type MockRouter_BuildWriteRoutingPlan_Call ¶ added in v1.33.0
MockRouter_BuildWriteRoutingPlan_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BuildWriteRoutingPlan'
func (*MockRouter_BuildWriteRoutingPlan_Call) Return ¶ added in v1.33.0
func (_c *MockRouter_BuildWriteRoutingPlan_Call) Return(_a0 WriteRoutingPlan, _a1 error) *MockRouter_BuildWriteRoutingPlan_Call
func (*MockRouter_BuildWriteRoutingPlan_Call) Run ¶ added in v1.33.0
func (_c *MockRouter_BuildWriteRoutingPlan_Call) Run(run func(params RoutingPlanBuildOptions)) *MockRouter_BuildWriteRoutingPlan_Call
func (*MockRouter_BuildWriteRoutingPlan_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockRouter_BuildWriteRoutingPlan_Call) RunAndReturn(run func(RoutingPlanBuildOptions) (WriteRoutingPlan, error)) *MockRouter_BuildWriteRoutingPlan_Call
type MockRouter_Expecter ¶ added in v1.33.0
type MockRouter_Expecter struct {
// contains filtered or unexported fields
}
func (*MockRouter_Expecter) AllHostnames ¶ added in v1.33.0
func (_e *MockRouter_Expecter) AllHostnames() *MockRouter_AllHostnames_Call
AllHostnames is a helper method to define mock.On call
func (*MockRouter_Expecter) BuildReadRoutingPlan ¶ added in v1.33.0
func (_e *MockRouter_Expecter) BuildReadRoutingPlan(params interface{}) *MockRouter_BuildReadRoutingPlan_Call
BuildReadRoutingPlan is a helper method to define mock.On call
- params RoutingPlanBuildOptions
func (*MockRouter_Expecter) BuildRoutingPlanOptions ¶ added in v1.33.0
func (_e *MockRouter_Expecter) BuildRoutingPlanOptions(tenant interface{}, shard interface{}, cl interface{}, directCandidate interface{}) *MockRouter_BuildRoutingPlanOptions_Call
BuildRoutingPlanOptions is a helper method to define mock.On call
- tenant string
- shard string
- cl ConsistencyLevel
- directCandidate string
func (*MockRouter_Expecter) BuildWriteRoutingPlan ¶ added in v1.33.0
func (_e *MockRouter_Expecter) BuildWriteRoutingPlan(params interface{}) *MockRouter_BuildWriteRoutingPlan_Call
BuildWriteRoutingPlan is a helper method to define mock.On call
- params RoutingPlanBuildOptions
func (*MockRouter_Expecter) GetReadReplicasLocation ¶ added in v1.33.0
func (_e *MockRouter_Expecter) GetReadReplicasLocation(collection interface{}, tenant interface{}, shard interface{}) *MockRouter_GetReadReplicasLocation_Call
GetReadReplicasLocation is a helper method to define mock.On call
- collection string
- tenant string
- shard string
func (*MockRouter_Expecter) GetReadWriteReplicasLocation ¶ added in v1.33.0
func (_e *MockRouter_Expecter) GetReadWriteReplicasLocation(collection interface{}, tenant interface{}, shard interface{}) *MockRouter_GetReadWriteReplicasLocation_Call
GetReadWriteReplicasLocation is a helper method to define mock.On call
- collection string
- tenant string
- shard string
func (*MockRouter_Expecter) GetWriteReplicasLocation ¶ added in v1.33.0
func (_e *MockRouter_Expecter) GetWriteReplicasLocation(collection interface{}, tenant interface{}, shard interface{}) *MockRouter_GetWriteReplicasLocation_Call
GetWriteReplicasLocation is a helper method to define mock.On call
- collection string
- tenant string
- shard string
func (*MockRouter_Expecter) NodeHostname ¶ added in v1.33.0
func (_e *MockRouter_Expecter) NodeHostname(nodeName interface{}) *MockRouter_NodeHostname_Call
NodeHostname is a helper method to define mock.On call
- nodeName string
type MockRouter_GetReadReplicasLocation_Call ¶ added in v1.33.0
MockRouter_GetReadReplicasLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetReadReplicasLocation'
func (*MockRouter_GetReadReplicasLocation_Call) Return ¶ added in v1.33.0
func (_c *MockRouter_GetReadReplicasLocation_Call) Return(_a0 ReadReplicaSet, _a1 error) *MockRouter_GetReadReplicasLocation_Call
func (*MockRouter_GetReadReplicasLocation_Call) Run ¶ added in v1.33.0
func (_c *MockRouter_GetReadReplicasLocation_Call) Run(run func(collection string, tenant string, shard string)) *MockRouter_GetReadReplicasLocation_Call
func (*MockRouter_GetReadReplicasLocation_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockRouter_GetReadReplicasLocation_Call) RunAndReturn(run func(string, string, string) (ReadReplicaSet, error)) *MockRouter_GetReadReplicasLocation_Call
type MockRouter_GetReadWriteReplicasLocation_Call ¶ added in v1.33.0
MockRouter_GetReadWriteReplicasLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetReadWriteReplicasLocation'
func (*MockRouter_GetReadWriteReplicasLocation_Call) Return ¶ added in v1.33.0
func (_c *MockRouter_GetReadWriteReplicasLocation_Call) Return(readReplicas ReadReplicaSet, writeReplicas WriteReplicaSet, err error) *MockRouter_GetReadWriteReplicasLocation_Call
func (*MockRouter_GetReadWriteReplicasLocation_Call) Run ¶ added in v1.33.0
func (_c *MockRouter_GetReadWriteReplicasLocation_Call) Run(run func(collection string, tenant string, shard string)) *MockRouter_GetReadWriteReplicasLocation_Call
func (*MockRouter_GetReadWriteReplicasLocation_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockRouter_GetReadWriteReplicasLocation_Call) RunAndReturn(run func(string, string, string) (ReadReplicaSet, WriteReplicaSet, error)) *MockRouter_GetReadWriteReplicasLocation_Call
type MockRouter_GetWriteReplicasLocation_Call ¶ added in v1.33.0
MockRouter_GetWriteReplicasLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWriteReplicasLocation'
func (*MockRouter_GetWriteReplicasLocation_Call) Return ¶ added in v1.33.0
func (_c *MockRouter_GetWriteReplicasLocation_Call) Return(_a0 WriteReplicaSet, _a1 error) *MockRouter_GetWriteReplicasLocation_Call
func (*MockRouter_GetWriteReplicasLocation_Call) Run ¶ added in v1.33.0
func (_c *MockRouter_GetWriteReplicasLocation_Call) Run(run func(collection string, tenant string, shard string)) *MockRouter_GetWriteReplicasLocation_Call
func (*MockRouter_GetWriteReplicasLocation_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockRouter_GetWriteReplicasLocation_Call) RunAndReturn(run func(string, string, string) (WriteReplicaSet, error)) *MockRouter_GetWriteReplicasLocation_Call
type MockRouter_NodeHostname_Call ¶ added in v1.33.0
MockRouter_NodeHostname_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NodeHostname'
func (*MockRouter_NodeHostname_Call) Return ¶ added in v1.33.0
func (_c *MockRouter_NodeHostname_Call) Return(_a0 string, _a1 bool) *MockRouter_NodeHostname_Call
func (*MockRouter_NodeHostname_Call) Run ¶ added in v1.33.0
func (_c *MockRouter_NodeHostname_Call) Run(run func(nodeName string)) *MockRouter_NodeHostname_Call
func (*MockRouter_NodeHostname_Call) RunAndReturn ¶ added in v1.33.0
func (_c *MockRouter_NodeHostname_Call) RunAndReturn(run func(string) (string, bool)) *MockRouter_NodeHostname_Call
type ReadReplicaSet ¶ added in v1.33.0
type ReadReplicaSet struct {
Replicas []Replica
}
ReadReplicaSet contains *exactly one* replica per shard and is produced by ReadReplicaStrategy implementations for read paths.
func (ReadReplicaSet) EmptyReplicas ¶ added in v1.33.0
func (s ReadReplicaSet) EmptyReplicas() bool
func (ReadReplicaSet) HostAddresses ¶ added in v1.33.0
func (s ReadReplicaSet) HostAddresses() []string
HostAddresses returns a list of host addresses for all Replicas in the ReplicaSet.
func (ReadReplicaSet) NodeNames ¶ added in v1.33.0
func (s ReadReplicaSet) NodeNames() []string
NodeNames returns a list of node names contained in the ReplicaSet.
func (ReadReplicaSet) Shards ¶ added in v1.33.0
func (s ReadReplicaSet) Shards() []string
Shards returns a list of unique shard names for all Replicas in the ReplicaSet.
func (ReadReplicaSet) String ¶ added in v1.33.0
func (s ReadReplicaSet) String() string
String returns a human-readable representation of a ReplicaSet, showing all Replicas in the set.
func (ReadReplicaSet) ValidateConsistencyLevel ¶ added in v1.33.0
func (s ReadReplicaSet) ValidateConsistencyLevel(level ConsistencyLevel) (int, error)
type ReadRoutingPlan ¶ added in v1.32.0
type ReadRoutingPlan struct {
LocalHostname string
Shard string
Tenant string
ReplicaSet ReadReplicaSet
ConsistencyLevel ConsistencyLevel
IntConsistencyLevel int
}
ReadRoutingPlan represents the plan for routing a read operation.
Fields:
- Shard: The (optional) shard targeted by this routing plan. If empty, all relevant shards are targeted.
- Tenant: The tenant name targeted by this routing plan. Expected to be empty and ignored for single-tenant collections.
- ReplicaSet: The ordered list of Replicas to contact.
- ConsistencyLevel: The user-specified consistency level.
- IntConsistencyLevel: The resolved numeric value for the consistency level.
func (ReadRoutingPlan) HostAddresses ¶ added in v1.32.0
func (p ReadRoutingPlan) HostAddresses() []string
HostAddresses returns the host addresses of all Replicas in the ReadRoutingPlan.
func (ReadRoutingPlan) LogFields ¶ added in v1.32.0
func (p ReadRoutingPlan) LogFields() logrus.Fields
LogFields returns a structured representation of the ReadRoutingPlan for logging purposes.
func (ReadRoutingPlan) NodeNames ¶ added in v1.32.0
func (p ReadRoutingPlan) NodeNames() []string
NodeNames returns the hostnames of the Replicas included in the ReadRoutingPlan.
func (ReadRoutingPlan) Replicas ¶ added in v1.32.0
func (p ReadRoutingPlan) Replicas() []Replica
Replicas returns a list of replicas
func (ReadRoutingPlan) Shards ¶ added in v1.32.0
func (p ReadRoutingPlan) Shards() []string
Shards returns the logical shard names associated with the Replicas in the ReadRoutingPlan.
func (ReadRoutingPlan) String ¶ added in v1.32.0
func (p ReadRoutingPlan) String() string
String returns a human-readable representation of the ReadRoutingPlan, including shard, consistency level, and list of Replicas.
type RepairResponse ¶
type Replica ¶ added in v1.32.0
Replica represents a single replica in the system, containing enough information to route traffic to it: the node name, shard name, and host address.
type Router ¶
type Router interface {
// GetReadWriteReplicasLocation returns the read and write Replicas for a given
// collection.
//
// Parameters:
// - collection: the name of the collection to get Replicas for.
// - shard: the shard identifier (matches the tenant name for multi-tenant collections).
//
// Returns:
// - readReplicas: a replica set serving as read Replicas.
// - writeReplicas: a replica set serving as primary write Replicas.
// - error: if an error occurs while retrieving Replicas.
GetReadWriteReplicasLocation(collection string, tenant string, shard string) (readReplicas ReadReplicaSet, writeReplicas WriteReplicaSet, err error)
// GetWriteReplicasLocation returns the write Replicas for a given collection.
//
// Parameters:
// - collection: the name of the collection to get write Replicas for.
// - shard: the shard identifier (matches the tenant name for multi-tenant collections).
//
// Returns:
// - writeReplicas: a replica set serving as primary write Replicas.
// - error: if an error occurs while retrieving Replicas.
GetWriteReplicasLocation(collection string, tenant string, shard string) (WriteReplicaSet, error)
// GetReadReplicasLocation returns the read Replicas for a given collection.
//
// Parameters:
// - collection: the name of the collection to get read Replicas for.
// - shard: the shard identifier (matches the tenant name for multi-tenant collections).
//
// Returns:
// - readReplicas: a replica set serving as read Replicas.
// - error: if an error occurs while retrieving Replicas.
GetReadReplicasLocation(collection string, tenant string, shard string) (ReadReplicaSet, error)
// BuildRoutingPlanOptions constructs routing plan build options with router-specific tenant handling.
//
// This method creates RoutingPlanBuildOptions configured appropriately for the router type:
// - Single-tenant routers: ignore the tenant parameter and always set tenant to empty string
// - Multi-tenant routers: preserve the tenant parameter as provided
//
// This allows callers to use the same code with different router types without needing to know
// the specific router implementation details.
//
// Parameters:
// - tenant: the tenant identifier to target. For single-tenant routers, this parameter is
// ignored and the resulting options will have an empty tenant. For multi-tenant routers,
// this value is preserved in the resulting options.
// - shard: the shard identifier to target. For multi-tenant collections, this should typically
// match the tenant name due to partitioning constraints. For single-tenant collections,
// this can be empty to target all shards or set to a specific shard name.
// - cl: the desired consistency level for operations using these options.
// - directCandidate: the preferred node name to contact first when executing routing plans.
// If empty, the router will use the local node as the preferred candidate.
//
// Returns:
// - RoutingPlanBuildOptions: configured routing plan build options with router-appropriate
// tenant handling applied.
BuildRoutingPlanOptions(tenant, shard string, cl ConsistencyLevel, directCandidate string) RoutingPlanBuildOptions
// BuildWriteRoutingPlan constructs a routing plan for a write operation based on the provided options.
//
// Parameters:
// - params: the routing plan build options containing tenant, shard, consistency level,
// and direct candidate preferences for constructing the write routing plan.
//
// Returns:
// - WriteRoutingPlan: a routing plan optimized for write operations.
// - error: if an error occurs while building the routing plan.
BuildWriteRoutingPlan(params RoutingPlanBuildOptions) (WriteRoutingPlan, error)
// BuildReadRoutingPlan constructs a routing plan for a read operation based on the provided options.
//
// Parameters:
// - params: the routing plan build options containing tenant, shard, consistency level,
// and direct candidate preferences for constructing the read routing plan.
//
// Returns:
// - ReadRoutingPlan: a routing plan optimized for read operations.
// - error: if an error occurs while building the routing plan.
BuildReadRoutingPlan(params RoutingPlanBuildOptions) (ReadRoutingPlan, error)
// NodeHostname returns the hostname for a given node name.
//
// Parameters:
// - nodeName: the name of the node to get the hostname for.
//
// Returns:
// - hostname: the hostname of the node.
// - ok: true if the hostname was found, false if the node name is unknown or unregistered.
NodeHostname(nodeName string) (string, bool)
// AllHostnames returns all known hostnames in the cluster.
//
// Returns:
// - hostnames: a slice of all known hostnames; always returns a valid slice, possibly empty.
AllHostnames() []string
}
Router defines the contract for determining routing plans for reads and writes within a cluster. It abstracts the logic to identify read/write Replicas, construct routing plans, and access cluster host information including hostnames and ip addresses.
type RoutingPlanBuildOptions ¶
type RoutingPlanBuildOptions struct {
Shard string
Tenant string
ConsistencyLevel ConsistencyLevel
DirectCandidateNode string
}
RoutingPlanBuildOptions contains parameters used to construct a routing plan for either read or write operations.
Fields:
- Shard: The name of the shard to route to. For multi-tenant collections, this must be the tenant name. For single-tenant collections, this should be empty to route to all shards, or optionally set to a specific shard if targeting all shards when creating routing plans for reading.
- Tenant: The tenant name targeted by this routing plan. Expected to be empty and ignored for single-tenant collections.
- ConsistencyLevel: The desired level of consistency for the operation.
- DirectCandidateNode: Optional. The preferred node to use first when building the routing plan. If empty, the local node is used as the default candidate.
func (RoutingPlanBuildOptions) String ¶ added in v1.32.0
func (o RoutingPlanBuildOptions) String() string
String returns a human-readable representation of the RoutingPlanBuildOptions. Useful for debugging and logging.
type WriteReplicaSet ¶ added in v1.33.0
func (WriteReplicaSet) AdditionalHostAddresses ¶ added in v1.33.0
func (s WriteReplicaSet) AdditionalHostAddresses() []string
AdditionalHostAddresses returns a list of host addresses for all Replicas in the AdditionalReplicaSet.
func (WriteReplicaSet) AdditionalNodeNames ¶ added in v1.33.0
func (s WriteReplicaSet) AdditionalNodeNames() []string
AdditionalNodeNames returns a list of node names contained in the AdditionalReplicaSet.
func (WriteReplicaSet) AdditionalShards ¶ added in v1.33.0
func (s WriteReplicaSet) AdditionalShards() []string
AdditionalShards returns a list of unique shard names for all Replicas in the AdditionalReplicaSet.
func (WriteReplicaSet) EmptyAdditionalReplicas ¶ added in v1.33.0
func (s WriteReplicaSet) EmptyAdditionalReplicas() bool
func (WriteReplicaSet) HostAddresses ¶ added in v1.33.0
func (s WriteReplicaSet) HostAddresses() []string
HostAddresses returns a list of host addresses for all Replicas in the ReplicaSet.
func (WriteReplicaSet) IsEmpty ¶ added in v1.33.0
func (s WriteReplicaSet) IsEmpty() bool
func (WriteReplicaSet) NodeNames ¶ added in v1.33.0
func (s WriteReplicaSet) NodeNames() []string
NodeNames returns a list of node names contained in the ReplicaSet.
func (WriteReplicaSet) Shards ¶ added in v1.33.0
func (s WriteReplicaSet) Shards() []string
Shards returns a list of unique shard names for all Replicas in the ReplicaSet.
func (WriteReplicaSet) ValidateConsistencyLevel ¶ added in v1.33.0
func (s WriteReplicaSet) ValidateConsistencyLevel(level ConsistencyLevel) (int, error)
type WriteRoutingPlan ¶ added in v1.32.0
type WriteRoutingPlan struct {
Shard string
Tenant string
ReplicaSet WriteReplicaSet
ConsistencyLevel ConsistencyLevel
IntConsistencyLevel int
}
WriteRoutingPlan represents the plan for routing a write operation.
Fields:
- Shard: The shard targeted by this routing plan. For writing, this is required as a write operation always targets a specific shard. Usually, the shard is determined based on the object's UUID.
- Tenant: The tenant name targeted by this routing plan. Expected to be empty and ignored for single-tenant collections.
- ReplicaSet: The ordered list of primary write Replicas. Write Replicas will normally also include read Replicas. A node that accepts writes is also eligible to serve reads.
- AdditionalReplicaSet: Any secondary or additional Replicas to include in the write operation.
- ConsistencyLevel: The user-specified consistency level.
- IntConsistencyLevel: The resolved numeric value for the consistency level.
func (WriteRoutingPlan) AdditionalHostAddresses ¶ added in v1.32.0
func (p WriteRoutingPlan) AdditionalHostAddresses() []string
AdditionalHostAddresses returns the host addresses of the additional write Replicas, which are not part of the primary ReplicaSet, in the WriteRoutingPlan.
func (WriteRoutingPlan) AdditionalHostNames ¶ added in v1.32.0
func (p WriteRoutingPlan) AdditionalHostNames() []string
AdditionalHostNames returns the hostnames of the additional write Replicas, which are not part of the primary ReplicaSet, in the WriteRoutingPlan.
func (WriteRoutingPlan) AdditionalReplicas ¶ added in v1.32.0
func (p WriteRoutingPlan) AdditionalReplicas() []Replica
AdditionalReplicas returns a list of additional replicas
func (WriteRoutingPlan) AdditionalShards ¶ added in v1.32.0
func (p WriteRoutingPlan) AdditionalShards() []string
AdditionalShards returns the shard names associated with the additional write Replicas in the WriteRoutingPlan.
func (WriteRoutingPlan) HostAddresses ¶ added in v1.32.0
func (p WriteRoutingPlan) HostAddresses() []string
HostAddresses returns the host addresses of the primary write Replicas in the WriteRoutingPlan.
func (WriteRoutingPlan) HostNames ¶ added in v1.32.0
func (p WriteRoutingPlan) HostNames() []string
HostNames returns the hostnames of the primary write Replicas in the WriteRoutingPlan.
func (WriteRoutingPlan) LogFields ¶ added in v1.32.0
func (p WriteRoutingPlan) LogFields() logrus.Fields
LogFields returns a structured representation of the WriteRoutingPlan for logging purposes.
func (WriteRoutingPlan) Replicas ¶ added in v1.32.0
func (p WriteRoutingPlan) Replicas() []Replica
Replicas returns a list of replicas
func (WriteRoutingPlan) Shards ¶ added in v1.32.0
func (p WriteRoutingPlan) Shards() []string
Shards returns the logical shard names associated with the primary write Replicas in the WriteRoutingPlan.
func (WriteRoutingPlan) String ¶ added in v1.32.0
func (p WriteRoutingPlan) String() string
String returns a human-readable representation of the WriteRoutingPlan, including shard, consistency level, write Replicas, and additional Replicas.