placement

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 20 Imported by: 53

Documentation

Overview

Package placement is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(p Placement) error

Validate validates a placement to ensure: - The shards on each instance are in valid state. - The total number of shards match rf * num_shards_per_replica. - Each shard shows up rf times. - There is one Initializing shard for each Leaving shard. - The instances with same shard_set_id owns the same shards.

Types

type Algorithm

type Algorithm interface {
	// InitialPlacement initialize a sharding placement with given replica factor.
	InitialPlacement(instances []Instance, shards []uint32, rf int) (Placement, error)

	// AddReplica up the replica factor by 1 in the placement.
	AddReplica(p Placement) (Placement, error)

	// AddInstances adds a list of instance to the placement.
	AddInstances(p Placement, instances []Instance) (Placement, error)

	// RemoveInstances removes a list of instances from the placement.
	RemoveInstances(p Placement, leavingInstanceIDs []string) (Placement, error)

	// ReplaceInstances replace a list of instances with new instances.
	ReplaceInstances(
		p Placement,
		leavingInstanecIDs []string,
		addingInstances []Instance,
	) (Placement, error)

	// IsCompatibleWith checks whether the algorithm could be applied to given placement.
	IsCompatibleWith(p Placement) error

	// MarkShardsAvailable marks given shards as available.
	MarkShardsAvailable(p Placement, instanceID string, shardIDs ...uint32) (Placement, error)

	// MarkAllShardsAvailable marks shard states as available where applicable.
	MarkAllShardsAvailable(p Placement) (Placement, bool, error)

	// BalanceShards rebalances load in the cluster to achieve the most balanced shard distribution.
	BalanceShards(p Placement) (Placement, error)
}

Algorithm places shards on instances.

type ByIDAscending

type ByIDAscending []Instance

ByIDAscending sorts Instance by ID ascending

func (ByIDAscending) Len

func (s ByIDAscending) Len() int

func (ByIDAscending) Less

func (s ByIDAscending) Less(i, j int) bool

func (ByIDAscending) Swap

func (s ByIDAscending) Swap(i, j int)

type Configuration added in v0.15.0

type Configuration struct {
	AllowPartialReplace *bool           `yaml:"allowPartialReplace"`
	AllowAllZones       *bool           `yaml:"allowAllZones"`
	AddAllCandidates    *bool           `yaml:"addAllCandidates"`
	IsSharded           *bool           `yaml:"isSharded"`
	ShardStateMode      *ShardStateMode `yaml:"shardStateMode"`
	IsMirrored          *bool           `yaml:"isMirrored"`
	IsStaged            *bool           `yaml:"isStaged"`
	ValidZone           *string         `yaml:"validZone"`
}

Configuration is configuration for placement options.

func (Configuration) ApplyOverride added in v1.2.0

func (c Configuration) ApplyOverride(opts *placementpb.Options) Configuration

ApplyOverride applys the override values.

func (Configuration) DeepCopy added in v1.2.0

func (c Configuration) DeepCopy() (Configuration, error)

DeepCopy makes a deep copy of the configuration.

func (*Configuration) NewOptions added in v0.15.0

func (c *Configuration) NewOptions() Options

NewOptions creates a placement options.

type DeploymentOptions

type DeploymentOptions interface {
	// MaxStepSize limits the number of instances to be deployed in one step
	MaxStepSize() int
	SetMaxStepSize(stepSize int) DeploymentOptions
}

DeploymentOptions provides options for DeploymentPlanner

func NewDeploymentOptions

func NewDeploymentOptions() DeploymentOptions

NewDeploymentOptions returns a default DeploymentOptions

type DeploymentPlanner

type DeploymentPlanner interface {
	// DeploymentSteps returns the deployment steps
	DeploymentSteps(p Placement) [][]Instance
}

DeploymentPlanner generates deployment steps for a placement

type Instance

type Instance interface {
	// String is for debugging.
	String() string

	// ID is the id of the instance.
	ID() string

	// SetID sets the id of the instance.
	SetID(id string) Instance

	// IsolationGroup is the isolation group of the instance,
	// which usually but not necessarily refers to the rack of the instance.
	IsolationGroup() string

	// SetIsolationGroup sets the isolation group of the instance.
	SetIsolationGroup(r string) Instance

	// Zone is the zone of the instance.
	Zone() string

	// SetZone sets the zone of the instance.
	SetZone(z string) Instance

	// Weight is the weight of the instance.
	Weight() uint32

	// SetWeight sets the weight of the instance.
	SetWeight(w uint32) Instance

	// Endpoint is the endpoint of the instance.
	Endpoint() string

	// SetEndpoint sets the endpoint of the instance.
	SetEndpoint(ip string) Instance

	// Shards returns the shards owned by the instance.
	Shards() shard.Shards

	// SetShards sets the shards owned by the instance.
	SetShards(s shard.Shards) Instance

	// ShardSetID returns the shard set id.
	ShardSetID() uint32

	// SetShardSetID sets the shard set id.
	SetShardSetID(value uint32) Instance

	// Hostname returns the hostname of the instance.
	Hostname() string

	// SetHostname sets the hostname of the instance.
	SetHostname(value string) Instance

	// Port returns the port of the instance.
	Port() uint32

	// SetPort sets the port of the instance.
	SetPort(value uint32) Instance

	// Metadata returns the metadata of the instance.
	Metadata() InstanceMetadata

	// SetMetadata sets the metadata of the instance.
	SetMetadata(value InstanceMetadata) Instance

	// Proto returns the proto representation for the Instance.
	Proto() (*placementpb.Instance, error)

	// IsLeaving returns whether the instance contains only leaving shards.
	IsLeaving() bool

	// IsInitializing returns whether the instance contains only initializing shards.
	IsInitializing() bool

	// IsAvailable returns whether the instance contains only available shards.
	IsAvailable() bool

	// Clone returns a clone of the Instance.
	Clone() Instance
}

Instance represents an instance in a placement.

func NewEmptyInstance

func NewEmptyInstance(id, isolationGroup, zone, endpoint string, weight uint32) Instance

NewEmptyInstance returns a Instance with some basic properties but no shards assigned

func NewInstance

func NewInstance() Instance

NewInstance returns a new Instance

func NewInstanceFromProto

func NewInstanceFromProto(instance *placementpb.Instance) (Instance, error)

NewInstanceFromProto creates a new placement instance from proto.

type InstanceMetadata added in v0.15.0

type InstanceMetadata struct {
	DebugPort uint32
}

InstanceMetadata represents the metadata for a single Instance in the placement.

type InstanceSelector

type InstanceSelector interface {
	// SelectInitialInstances selects instances for the initial placement.
	SelectInitialInstances(
		candidates []Instance,
		rf int,
	) ([]Instance, error)

	// SelectAddingInstances selects instances to be added to the placement.
	SelectAddingInstances(
		candidates []Instance,
		p Placement,
	) ([]Instance, error)

	// SelectReplaceInstances selects instances to replace existing instances in the placement.
	SelectReplaceInstances(
		candidates []Instance,
		leavingInstanceIDs []string,
		p Placement,
	) ([]Instance, error)
}

InstanceSelector selects valid instances for the placement change.

type Instances

type Instances []Instance

Instances is a slice of instances that can produce a debug string.

func (Instances) Clone

func (instances Instances) Clone() Instances

Clone returns a set of cloned instances.

func (Instances) String

func (instances Instances) String() string

type MockAlgorithm

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

MockAlgorithm is a mock of Algorithm interface.

func NewMockAlgorithm

func NewMockAlgorithm(ctrl *gomock.Controller) *MockAlgorithm

NewMockAlgorithm creates a new mock instance.

func (*MockAlgorithm) AddInstances

func (m *MockAlgorithm) AddInstances(p Placement, instances []Instance) (Placement, error)

AddInstances mocks base method.

func (*MockAlgorithm) AddReplica

func (m *MockAlgorithm) AddReplica(p Placement) (Placement, error)

AddReplica mocks base method.

func (*MockAlgorithm) BalanceShards added in v1.2.0

func (m *MockAlgorithm) BalanceShards(p Placement) (Placement, error)

BalanceShards mocks base method.

func (*MockAlgorithm) EXPECT

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

func (*MockAlgorithm) InitialPlacement

func (m *MockAlgorithm) InitialPlacement(instances []Instance, shards []uint32, rf int) (Placement, error)

InitialPlacement mocks base method.

func (*MockAlgorithm) IsCompatibleWith

func (m *MockAlgorithm) IsCompatibleWith(p Placement) error

IsCompatibleWith mocks base method.

func (*MockAlgorithm) MarkAllShardsAvailable

func (m *MockAlgorithm) MarkAllShardsAvailable(p Placement) (Placement, bool, error)

MarkAllShardsAvailable mocks base method.

func (*MockAlgorithm) MarkShardsAvailable

func (m *MockAlgorithm) MarkShardsAvailable(p Placement, instanceID string, shardIDs ...uint32) (Placement, error)

MarkShardsAvailable mocks base method.

func (*MockAlgorithm) RemoveInstances

func (m *MockAlgorithm) RemoveInstances(p Placement, leavingInstanceIDs []string) (Placement, error)

RemoveInstances mocks base method.

func (*MockAlgorithm) ReplaceInstances

func (m *MockAlgorithm) ReplaceInstances(p Placement, leavingInstanecIDs []string, addingInstances []Instance) (Placement, error)

ReplaceInstances mocks base method.

type MockAlgorithmMockRecorder

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

MockAlgorithmMockRecorder is the mock recorder for MockAlgorithm.

func (*MockAlgorithmMockRecorder) AddInstances

func (mr *MockAlgorithmMockRecorder) AddInstances(p, instances interface{}) *gomock.Call

AddInstances indicates an expected call of AddInstances.

func (*MockAlgorithmMockRecorder) AddReplica

func (mr *MockAlgorithmMockRecorder) AddReplica(p interface{}) *gomock.Call

AddReplica indicates an expected call of AddReplica.

func (*MockAlgorithmMockRecorder) BalanceShards added in v1.2.0

func (mr *MockAlgorithmMockRecorder) BalanceShards(p interface{}) *gomock.Call

BalanceShards indicates an expected call of BalanceShards.

func (*MockAlgorithmMockRecorder) InitialPlacement

func (mr *MockAlgorithmMockRecorder) InitialPlacement(instances, shards, rf interface{}) *gomock.Call

InitialPlacement indicates an expected call of InitialPlacement.

func (*MockAlgorithmMockRecorder) IsCompatibleWith

func (mr *MockAlgorithmMockRecorder) IsCompatibleWith(p interface{}) *gomock.Call

IsCompatibleWith indicates an expected call of IsCompatibleWith.

func (*MockAlgorithmMockRecorder) MarkAllShardsAvailable

func (mr *MockAlgorithmMockRecorder) MarkAllShardsAvailable(p interface{}) *gomock.Call

MarkAllShardsAvailable indicates an expected call of MarkAllShardsAvailable.

func (*MockAlgorithmMockRecorder) MarkShardsAvailable

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

MarkShardsAvailable indicates an expected call of MarkShardsAvailable.

func (*MockAlgorithmMockRecorder) RemoveInstances

func (mr *MockAlgorithmMockRecorder) RemoveInstances(p, leavingInstanceIDs interface{}) *gomock.Call

RemoveInstances indicates an expected call of RemoveInstances.

func (*MockAlgorithmMockRecorder) ReplaceInstances

func (mr *MockAlgorithmMockRecorder) ReplaceInstances(p, leavingInstanecIDs, addingInstances interface{}) *gomock.Call

ReplaceInstances indicates an expected call of ReplaceInstances.

type MockDeploymentOptions

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

MockDeploymentOptions is a mock of DeploymentOptions interface.

func NewMockDeploymentOptions

func NewMockDeploymentOptions(ctrl *gomock.Controller) *MockDeploymentOptions

NewMockDeploymentOptions creates a new mock instance.

func (*MockDeploymentOptions) EXPECT

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

func (*MockDeploymentOptions) MaxStepSize

func (m *MockDeploymentOptions) MaxStepSize() int

MaxStepSize mocks base method.

func (*MockDeploymentOptions) SetMaxStepSize

func (m *MockDeploymentOptions) SetMaxStepSize(stepSize int) DeploymentOptions

SetMaxStepSize mocks base method.

type MockDeploymentOptionsMockRecorder

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

MockDeploymentOptionsMockRecorder is the mock recorder for MockDeploymentOptions.

func (*MockDeploymentOptionsMockRecorder) MaxStepSize

func (mr *MockDeploymentOptionsMockRecorder) MaxStepSize() *gomock.Call

MaxStepSize indicates an expected call of MaxStepSize.

func (*MockDeploymentOptionsMockRecorder) SetMaxStepSize

func (mr *MockDeploymentOptionsMockRecorder) SetMaxStepSize(stepSize interface{}) *gomock.Call

SetMaxStepSize indicates an expected call of SetMaxStepSize.

type MockDeploymentPlanner

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

MockDeploymentPlanner is a mock of DeploymentPlanner interface.

func NewMockDeploymentPlanner

func NewMockDeploymentPlanner(ctrl *gomock.Controller) *MockDeploymentPlanner

NewMockDeploymentPlanner creates a new mock instance.

func (*MockDeploymentPlanner) DeploymentSteps

func (m *MockDeploymentPlanner) DeploymentSteps(p Placement) [][]Instance

DeploymentSteps mocks base method.

func (*MockDeploymentPlanner) EXPECT

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

type MockDeploymentPlannerMockRecorder

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

MockDeploymentPlannerMockRecorder is the mock recorder for MockDeploymentPlanner.

func (*MockDeploymentPlannerMockRecorder) DeploymentSteps

func (mr *MockDeploymentPlannerMockRecorder) DeploymentSteps(p interface{}) *gomock.Call

DeploymentSteps indicates an expected call of DeploymentSteps.

type MockInstance

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

MockInstance is a mock of Instance interface.

func NewMockInstance

func NewMockInstance(ctrl *gomock.Controller) *MockInstance

NewMockInstance creates a new mock instance.

func (*MockInstance) Clone

func (m *MockInstance) Clone() Instance

Clone mocks base method.

func (*MockInstance) EXPECT

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

func (*MockInstance) Endpoint

func (m *MockInstance) Endpoint() string

Endpoint mocks base method.

func (*MockInstance) Hostname

func (m *MockInstance) Hostname() string

Hostname mocks base method.

func (*MockInstance) ID

func (m *MockInstance) ID() string

ID mocks base method.

func (*MockInstance) IsAvailable

func (m *MockInstance) IsAvailable() bool

IsAvailable mocks base method.

func (*MockInstance) IsInitializing

func (m *MockInstance) IsInitializing() bool

IsInitializing mocks base method.

func (*MockInstance) IsLeaving

func (m *MockInstance) IsLeaving() bool

IsLeaving mocks base method.

func (*MockInstance) IsolationGroup

func (m *MockInstance) IsolationGroup() string

IsolationGroup mocks base method.

func (*MockInstance) Metadata added in v0.15.0

func (m *MockInstance) Metadata() InstanceMetadata

Metadata mocks base method.

func (*MockInstance) Port

func (m *MockInstance) Port() uint32

Port mocks base method.

func (*MockInstance) Proto

func (m *MockInstance) Proto() (*placementpb.Instance, error)

Proto mocks base method.

func (*MockInstance) SetEndpoint

func (m *MockInstance) SetEndpoint(ip string) Instance

SetEndpoint mocks base method.

func (*MockInstance) SetHostname

func (m *MockInstance) SetHostname(value string) Instance

SetHostname mocks base method.

func (*MockInstance) SetID

func (m *MockInstance) SetID(id string) Instance

SetID mocks base method.

func (*MockInstance) SetIsolationGroup

func (m *MockInstance) SetIsolationGroup(r string) Instance

SetIsolationGroup mocks base method.

func (*MockInstance) SetMetadata added in v0.15.0

func (m *MockInstance) SetMetadata(value InstanceMetadata) Instance

SetMetadata mocks base method.

func (*MockInstance) SetPort

func (m *MockInstance) SetPort(value uint32) Instance

SetPort mocks base method.

func (*MockInstance) SetShardSetID

func (m *MockInstance) SetShardSetID(value uint32) Instance

SetShardSetID mocks base method.

func (*MockInstance) SetShards

func (m *MockInstance) SetShards(s shard.Shards) Instance

SetShards mocks base method.

func (*MockInstance) SetWeight

func (m *MockInstance) SetWeight(w uint32) Instance

SetWeight mocks base method.

func (*MockInstance) SetZone

func (m *MockInstance) SetZone(z string) Instance

SetZone mocks base method.

func (*MockInstance) ShardSetID

func (m *MockInstance) ShardSetID() uint32

ShardSetID mocks base method.

func (*MockInstance) Shards

func (m *MockInstance) Shards() shard.Shards

Shards mocks base method.

func (*MockInstance) String

func (m *MockInstance) String() string

String mocks base method.

func (*MockInstance) Weight

func (m *MockInstance) Weight() uint32

Weight mocks base method.

func (*MockInstance) Zone

func (m *MockInstance) Zone() string

Zone mocks base method.

type MockInstanceMockRecorder

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

MockInstanceMockRecorder is the mock recorder for MockInstance.

func (*MockInstanceMockRecorder) Clone

func (mr *MockInstanceMockRecorder) Clone() *gomock.Call

Clone indicates an expected call of Clone.

func (*MockInstanceMockRecorder) Endpoint

func (mr *MockInstanceMockRecorder) Endpoint() *gomock.Call

Endpoint indicates an expected call of Endpoint.

func (*MockInstanceMockRecorder) Hostname

func (mr *MockInstanceMockRecorder) Hostname() *gomock.Call

Hostname indicates an expected call of Hostname.

func (*MockInstanceMockRecorder) ID

ID indicates an expected call of ID.

func (*MockInstanceMockRecorder) IsAvailable

func (mr *MockInstanceMockRecorder) IsAvailable() *gomock.Call

IsAvailable indicates an expected call of IsAvailable.

func (*MockInstanceMockRecorder) IsInitializing

func (mr *MockInstanceMockRecorder) IsInitializing() *gomock.Call

IsInitializing indicates an expected call of IsInitializing.

func (*MockInstanceMockRecorder) IsLeaving

func (mr *MockInstanceMockRecorder) IsLeaving() *gomock.Call

IsLeaving indicates an expected call of IsLeaving.

func (*MockInstanceMockRecorder) IsolationGroup

func (mr *MockInstanceMockRecorder) IsolationGroup() *gomock.Call

IsolationGroup indicates an expected call of IsolationGroup.

func (*MockInstanceMockRecorder) Metadata added in v0.15.0

func (mr *MockInstanceMockRecorder) Metadata() *gomock.Call

Metadata indicates an expected call of Metadata.

func (*MockInstanceMockRecorder) Port

func (mr *MockInstanceMockRecorder) Port() *gomock.Call

Port indicates an expected call of Port.

func (*MockInstanceMockRecorder) Proto

func (mr *MockInstanceMockRecorder) Proto() *gomock.Call

Proto indicates an expected call of Proto.

func (*MockInstanceMockRecorder) SetEndpoint

func (mr *MockInstanceMockRecorder) SetEndpoint(ip interface{}) *gomock.Call

SetEndpoint indicates an expected call of SetEndpoint.

func (*MockInstanceMockRecorder) SetHostname

func (mr *MockInstanceMockRecorder) SetHostname(value interface{}) *gomock.Call

SetHostname indicates an expected call of SetHostname.

func (*MockInstanceMockRecorder) SetID

func (mr *MockInstanceMockRecorder) SetID(id interface{}) *gomock.Call

SetID indicates an expected call of SetID.

func (*MockInstanceMockRecorder) SetIsolationGroup

func (mr *MockInstanceMockRecorder) SetIsolationGroup(r interface{}) *gomock.Call

SetIsolationGroup indicates an expected call of SetIsolationGroup.

func (*MockInstanceMockRecorder) SetMetadata added in v0.15.0

func (mr *MockInstanceMockRecorder) SetMetadata(value interface{}) *gomock.Call

SetMetadata indicates an expected call of SetMetadata.

func (*MockInstanceMockRecorder) SetPort

func (mr *MockInstanceMockRecorder) SetPort(value interface{}) *gomock.Call

SetPort indicates an expected call of SetPort.

func (*MockInstanceMockRecorder) SetShardSetID

func (mr *MockInstanceMockRecorder) SetShardSetID(value interface{}) *gomock.Call

SetShardSetID indicates an expected call of SetShardSetID.

func (*MockInstanceMockRecorder) SetShards

func (mr *MockInstanceMockRecorder) SetShards(s interface{}) *gomock.Call

SetShards indicates an expected call of SetShards.

func (*MockInstanceMockRecorder) SetWeight

func (mr *MockInstanceMockRecorder) SetWeight(w interface{}) *gomock.Call

SetWeight indicates an expected call of SetWeight.

func (*MockInstanceMockRecorder) SetZone

func (mr *MockInstanceMockRecorder) SetZone(z interface{}) *gomock.Call

SetZone indicates an expected call of SetZone.

func (*MockInstanceMockRecorder) ShardSetID

func (mr *MockInstanceMockRecorder) ShardSetID() *gomock.Call

ShardSetID indicates an expected call of ShardSetID.

func (*MockInstanceMockRecorder) Shards

func (mr *MockInstanceMockRecorder) Shards() *gomock.Call

Shards indicates an expected call of Shards.

func (*MockInstanceMockRecorder) String

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

String indicates an expected call of String.

func (*MockInstanceMockRecorder) Weight

func (mr *MockInstanceMockRecorder) Weight() *gomock.Call

Weight indicates an expected call of Weight.

func (*MockInstanceMockRecorder) Zone

func (mr *MockInstanceMockRecorder) Zone() *gomock.Call

Zone indicates an expected call of Zone.

type MockInstanceSelector

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

MockInstanceSelector is a mock of InstanceSelector interface.

func NewMockInstanceSelector

func NewMockInstanceSelector(ctrl *gomock.Controller) *MockInstanceSelector

NewMockInstanceSelector creates a new mock instance.

func (*MockInstanceSelector) EXPECT

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

func (*MockInstanceSelector) SelectAddingInstances

func (m *MockInstanceSelector) SelectAddingInstances(candidates []Instance, p Placement) ([]Instance, error)

SelectAddingInstances mocks base method.

func (*MockInstanceSelector) SelectInitialInstances

func (m *MockInstanceSelector) SelectInitialInstances(candidates []Instance, rf int) ([]Instance, error)

SelectInitialInstances mocks base method.

func (*MockInstanceSelector) SelectReplaceInstances

func (m *MockInstanceSelector) SelectReplaceInstances(candidates []Instance, leavingInstanceIDs []string, p Placement) ([]Instance, error)

SelectReplaceInstances mocks base method.

type MockInstanceSelectorMockRecorder

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

MockInstanceSelectorMockRecorder is the mock recorder for MockInstanceSelector.

func (*MockInstanceSelectorMockRecorder) SelectAddingInstances

func (mr *MockInstanceSelectorMockRecorder) SelectAddingInstances(candidates, p interface{}) *gomock.Call

SelectAddingInstances indicates an expected call of SelectAddingInstances.

func (*MockInstanceSelectorMockRecorder) SelectInitialInstances

func (mr *MockInstanceSelectorMockRecorder) SelectInitialInstances(candidates, rf interface{}) *gomock.Call

SelectInitialInstances indicates an expected call of SelectInitialInstances.

func (*MockInstanceSelectorMockRecorder) SelectReplaceInstances

func (mr *MockInstanceSelectorMockRecorder) SelectReplaceInstances(candidates, leavingInstanceIDs, p interface{}) *gomock.Call

SelectReplaceInstances indicates an expected call of SelectReplaceInstances.

type MockOperator added in v0.15.13

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

MockOperator is a mock of Operator interface.

func NewMockOperator added in v0.15.13

func NewMockOperator(ctrl *gomock.Controller) *MockOperator

NewMockOperator creates a new mock instance.

func (*MockOperator) AddInstances added in v0.15.13

func (m *MockOperator) AddInstances(candidates []Instance) (Placement, []Instance, error)

AddInstances mocks base method.

func (*MockOperator) AddReplica added in v0.15.13

func (m *MockOperator) AddReplica() (Placement, error)

AddReplica mocks base method.

func (*MockOperator) BalanceShards added in v1.2.0

func (m *MockOperator) BalanceShards() (Placement, error)

BalanceShards mocks base method.

func (*MockOperator) BuildInitialPlacement added in v0.15.13

func (m *MockOperator) BuildInitialPlacement(instances []Instance, numShards, rf int) (Placement, error)

BuildInitialPlacement mocks base method.

func (*MockOperator) EXPECT added in v0.15.13

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

func (*MockOperator) MarkAllShardsAvailable added in v0.15.13

func (m *MockOperator) MarkAllShardsAvailable() (Placement, error)

MarkAllShardsAvailable mocks base method.

func (*MockOperator) MarkInstanceAvailable added in v0.15.13

func (m *MockOperator) MarkInstanceAvailable(instanceID string) (Placement, error)

MarkInstanceAvailable mocks base method.

func (*MockOperator) MarkShardsAvailable added in v0.15.13

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

MarkShardsAvailable mocks base method.

func (*MockOperator) Placement added in v0.15.13

func (m *MockOperator) Placement() Placement

Placement mocks base method.

func (*MockOperator) RemoveInstances added in v0.15.13

func (m *MockOperator) RemoveInstances(leavingInstanceIDs []string) (Placement, error)

RemoveInstances mocks base method.

func (*MockOperator) ReplaceInstances added in v0.15.13

func (m *MockOperator) ReplaceInstances(leavingInstanceIDs []string, candidates []Instance) (Placement, []Instance, error)

ReplaceInstances mocks base method.

type MockOperatorMockRecorder added in v0.15.13

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

MockOperatorMockRecorder is the mock recorder for MockOperator.

func (*MockOperatorMockRecorder) AddInstances added in v0.15.13

func (mr *MockOperatorMockRecorder) AddInstances(candidates interface{}) *gomock.Call

AddInstances indicates an expected call of AddInstances.

func (*MockOperatorMockRecorder) AddReplica added in v0.15.13

func (mr *MockOperatorMockRecorder) AddReplica() *gomock.Call

AddReplica indicates an expected call of AddReplica.

func (*MockOperatorMockRecorder) BalanceShards added in v1.2.0

func (mr *MockOperatorMockRecorder) BalanceShards() *gomock.Call

BalanceShards indicates an expected call of BalanceShards.

func (*MockOperatorMockRecorder) BuildInitialPlacement added in v0.15.13

func (mr *MockOperatorMockRecorder) BuildInitialPlacement(instances, numShards, rf interface{}) *gomock.Call

BuildInitialPlacement indicates an expected call of BuildInitialPlacement.

func (*MockOperatorMockRecorder) MarkAllShardsAvailable added in v0.15.13

func (mr *MockOperatorMockRecorder) MarkAllShardsAvailable() *gomock.Call

MarkAllShardsAvailable indicates an expected call of MarkAllShardsAvailable.

func (*MockOperatorMockRecorder) MarkInstanceAvailable added in v0.15.13

func (mr *MockOperatorMockRecorder) MarkInstanceAvailable(instanceID interface{}) *gomock.Call

MarkInstanceAvailable indicates an expected call of MarkInstanceAvailable.

func (*MockOperatorMockRecorder) MarkShardsAvailable added in v0.15.13

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

MarkShardsAvailable indicates an expected call of MarkShardsAvailable.

func (*MockOperatorMockRecorder) Placement added in v0.15.13

func (mr *MockOperatorMockRecorder) Placement() *gomock.Call

Placement indicates an expected call of Placement.

func (*MockOperatorMockRecorder) RemoveInstances added in v0.15.13

func (mr *MockOperatorMockRecorder) RemoveInstances(leavingInstanceIDs interface{}) *gomock.Call

RemoveInstances indicates an expected call of RemoveInstances.

func (*MockOperatorMockRecorder) ReplaceInstances added in v0.15.13

func (mr *MockOperatorMockRecorder) ReplaceInstances(leavingInstanceIDs, candidates interface{}) *gomock.Call

ReplaceInstances indicates an expected call of ReplaceInstances.

type MockOptions

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

MockOptions is a mock of Options interface.

func NewMockOptions

func NewMockOptions(ctrl *gomock.Controller) *MockOptions

NewMockOptions creates a new mock instance.

func (*MockOptions) AddAllCandidates

func (m *MockOptions) AddAllCandidates() bool

AddAllCandidates mocks base method.

func (*MockOptions) AllowAllZones added in v0.7.3

func (m *MockOptions) AllowAllZones() bool

AllowAllZones mocks base method.

func (*MockOptions) AllowPartialReplace

func (m *MockOptions) AllowPartialReplace() bool

AllowPartialReplace mocks base method.

func (*MockOptions) Compress added in v1.2.0

func (m *MockOptions) Compress() bool

Compress mocks base method.

func (*MockOptions) Dryrun

func (m *MockOptions) Dryrun() bool

Dryrun mocks base method.

func (*MockOptions) EXPECT

func (m *MockOptions) EXPECT() *MockOptionsMockRecorder

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

func (*MockOptions) InstanceSelector added in v0.15.0

func (m *MockOptions) InstanceSelector() InstanceSelector

InstanceSelector mocks base method.

func (*MockOptions) InstrumentOptions

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

InstrumentOptions mocks base method.

func (*MockOptions) IsMirrored

func (m *MockOptions) IsMirrored() bool

IsMirrored mocks base method.

func (*MockOptions) IsShardCutoffFn

func (m *MockOptions) IsShardCutoffFn() ShardValidateFn

IsShardCutoffFn mocks base method.

func (*MockOptions) IsShardCutoverFn

func (m *MockOptions) IsShardCutoverFn() ShardValidateFn

IsShardCutoverFn mocks base method.

func (*MockOptions) IsSharded

func (m *MockOptions) IsSharded() bool

IsSharded mocks base method.

func (*MockOptions) IsStaged

func (m *MockOptions) IsStaged() bool

IsStaged mocks base method.

func (*MockOptions) NowFn

func (m *MockOptions) NowFn() clock.NowFn

NowFn mocks base method.

func (*MockOptions) PlacementCutoverNanosFn

func (m *MockOptions) PlacementCutoverNanosFn() TimeNanosFn

PlacementCutoverNanosFn mocks base method.

func (*MockOptions) SetAddAllCandidates

func (m *MockOptions) SetAddAllCandidates(addAllCandidates bool) Options

SetAddAllCandidates mocks base method.

func (*MockOptions) SetAllowAllZones added in v0.7.3

func (m *MockOptions) SetAllowAllZones(allowAllZones bool) Options

SetAllowAllZones mocks base method.

func (*MockOptions) SetAllowPartialReplace

func (m *MockOptions) SetAllowPartialReplace(allowPartialReplace bool) Options

SetAllowPartialReplace mocks base method.

func (*MockOptions) SetCompress added in v1.2.0

func (m *MockOptions) SetCompress(v bool) Options

SetCompress mocks base method.

func (*MockOptions) SetDryrun

func (m *MockOptions) SetDryrun(d bool) Options

SetDryrun mocks base method.

func (*MockOptions) SetInstanceSelector added in v0.15.0

func (m *MockOptions) SetInstanceSelector(s InstanceSelector) Options

SetInstanceSelector mocks base method.

func (*MockOptions) SetInstrumentOptions

func (m *MockOptions) SetInstrumentOptions(iopts instrument.Options) Options

SetInstrumentOptions mocks base method.

func (*MockOptions) SetIsMirrored

func (m_2 *MockOptions) SetIsMirrored(m bool) Options

SetIsMirrored mocks base method.

func (*MockOptions) SetIsShardCutoffFn

func (m *MockOptions) SetIsShardCutoffFn(fn ShardValidateFn) Options

SetIsShardCutoffFn mocks base method.

func (*MockOptions) SetIsShardCutoverFn

func (m *MockOptions) SetIsShardCutoverFn(fn ShardValidateFn) Options

SetIsShardCutoverFn mocks base method.

func (*MockOptions) SetIsSharded

func (m *MockOptions) SetIsSharded(sharded bool) Options

SetIsSharded mocks base method.

func (*MockOptions) SetIsStaged

func (m *MockOptions) SetIsStaged(v bool) Options

SetIsStaged mocks base method.

func (*MockOptions) SetNowFn

func (m *MockOptions) SetNowFn(fn clock.NowFn) Options

SetNowFn mocks base method.

func (*MockOptions) SetPlacementCutoverNanosFn

func (m *MockOptions) SetPlacementCutoverNanosFn(fn TimeNanosFn) Options

SetPlacementCutoverNanosFn mocks base method.

func (*MockOptions) SetShardCutoffNanosFn

func (m *MockOptions) SetShardCutoffNanosFn(fn TimeNanosFn) Options

SetShardCutoffNanosFn mocks base method.

func (*MockOptions) SetShardCutoverNanosFn

func (m *MockOptions) SetShardCutoverNanosFn(fn TimeNanosFn) Options

SetShardCutoverNanosFn mocks base method.

func (*MockOptions) SetShardStateMode

func (m *MockOptions) SetShardStateMode(value ShardStateMode) Options

SetShardStateMode mocks base method.

func (*MockOptions) SetValidZone

func (m *MockOptions) SetValidZone(z string) Options

SetValidZone mocks base method.

func (*MockOptions) SetValidateFnBeforeUpdate

func (m *MockOptions) SetValidateFnBeforeUpdate(fn ValidateFn) Options

SetValidateFnBeforeUpdate mocks base method.

func (*MockOptions) ShardCutoffNanosFn

func (m *MockOptions) ShardCutoffNanosFn() TimeNanosFn

ShardCutoffNanosFn mocks base method.

func (*MockOptions) ShardCutoverNanosFn

func (m *MockOptions) ShardCutoverNanosFn() TimeNanosFn

ShardCutoverNanosFn mocks base method.

func (*MockOptions) ShardStateMode

func (m *MockOptions) ShardStateMode() ShardStateMode

ShardStateMode mocks base method.

func (*MockOptions) ValidZone

func (m *MockOptions) ValidZone() string

ValidZone mocks base method.

func (*MockOptions) ValidateFnBeforeUpdate

func (m *MockOptions) ValidateFnBeforeUpdate() ValidateFn

ValidateFnBeforeUpdate mocks base method.

type MockOptionsMockRecorder

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

MockOptionsMockRecorder is the mock recorder for MockOptions.

func (*MockOptionsMockRecorder) AddAllCandidates

func (mr *MockOptionsMockRecorder) AddAllCandidates() *gomock.Call

AddAllCandidates indicates an expected call of AddAllCandidates.

func (*MockOptionsMockRecorder) AllowAllZones added in v0.7.3

func (mr *MockOptionsMockRecorder) AllowAllZones() *gomock.Call

AllowAllZones indicates an expected call of AllowAllZones.

func (*MockOptionsMockRecorder) AllowPartialReplace

func (mr *MockOptionsMockRecorder) AllowPartialReplace() *gomock.Call

AllowPartialReplace indicates an expected call of AllowPartialReplace.

func (*MockOptionsMockRecorder) Compress added in v1.2.0

func (mr *MockOptionsMockRecorder) Compress() *gomock.Call

Compress indicates an expected call of Compress.

func (*MockOptionsMockRecorder) Dryrun

func (mr *MockOptionsMockRecorder) Dryrun() *gomock.Call

Dryrun indicates an expected call of Dryrun.

func (*MockOptionsMockRecorder) InstanceSelector added in v0.15.0

func (mr *MockOptionsMockRecorder) InstanceSelector() *gomock.Call

InstanceSelector indicates an expected call of InstanceSelector.

func (*MockOptionsMockRecorder) InstrumentOptions

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

InstrumentOptions indicates an expected call of InstrumentOptions.

func (*MockOptionsMockRecorder) IsMirrored

func (mr *MockOptionsMockRecorder) IsMirrored() *gomock.Call

IsMirrored indicates an expected call of IsMirrored.

func (*MockOptionsMockRecorder) IsShardCutoffFn

func (mr *MockOptionsMockRecorder) IsShardCutoffFn() *gomock.Call

IsShardCutoffFn indicates an expected call of IsShardCutoffFn.

func (*MockOptionsMockRecorder) IsShardCutoverFn

func (mr *MockOptionsMockRecorder) IsShardCutoverFn() *gomock.Call

IsShardCutoverFn indicates an expected call of IsShardCutoverFn.

func (*MockOptionsMockRecorder) IsSharded

func (mr *MockOptionsMockRecorder) IsSharded() *gomock.Call

IsSharded indicates an expected call of IsSharded.

func (*MockOptionsMockRecorder) IsStaged

func (mr *MockOptionsMockRecorder) IsStaged() *gomock.Call

IsStaged indicates an expected call of IsStaged.

func (*MockOptionsMockRecorder) NowFn

func (mr *MockOptionsMockRecorder) NowFn() *gomock.Call

NowFn indicates an expected call of NowFn.

func (*MockOptionsMockRecorder) PlacementCutoverNanosFn

func (mr *MockOptionsMockRecorder) PlacementCutoverNanosFn() *gomock.Call

PlacementCutoverNanosFn indicates an expected call of PlacementCutoverNanosFn.

func (*MockOptionsMockRecorder) SetAddAllCandidates

func (mr *MockOptionsMockRecorder) SetAddAllCandidates(addAllCandidates interface{}) *gomock.Call

SetAddAllCandidates indicates an expected call of SetAddAllCandidates.

func (*MockOptionsMockRecorder) SetAllowAllZones added in v0.7.3

func (mr *MockOptionsMockRecorder) SetAllowAllZones(allowAllZones interface{}) *gomock.Call

SetAllowAllZones indicates an expected call of SetAllowAllZones.

func (*MockOptionsMockRecorder) SetAllowPartialReplace

func (mr *MockOptionsMockRecorder) SetAllowPartialReplace(allowPartialReplace interface{}) *gomock.Call

SetAllowPartialReplace indicates an expected call of SetAllowPartialReplace.

func (*MockOptionsMockRecorder) SetCompress added in v1.2.0

func (mr *MockOptionsMockRecorder) SetCompress(v interface{}) *gomock.Call

SetCompress indicates an expected call of SetCompress.

func (*MockOptionsMockRecorder) SetDryrun

func (mr *MockOptionsMockRecorder) SetDryrun(d interface{}) *gomock.Call

SetDryrun indicates an expected call of SetDryrun.

func (*MockOptionsMockRecorder) SetInstanceSelector added in v0.15.0

func (mr *MockOptionsMockRecorder) SetInstanceSelector(s interface{}) *gomock.Call

SetInstanceSelector indicates an expected call of SetInstanceSelector.

func (*MockOptionsMockRecorder) SetInstrumentOptions

func (mr *MockOptionsMockRecorder) SetInstrumentOptions(iopts interface{}) *gomock.Call

SetInstrumentOptions indicates an expected call of SetInstrumentOptions.

func (*MockOptionsMockRecorder) SetIsMirrored

func (mr *MockOptionsMockRecorder) SetIsMirrored(m interface{}) *gomock.Call

SetIsMirrored indicates an expected call of SetIsMirrored.

func (*MockOptionsMockRecorder) SetIsShardCutoffFn

func (mr *MockOptionsMockRecorder) SetIsShardCutoffFn(fn interface{}) *gomock.Call

SetIsShardCutoffFn indicates an expected call of SetIsShardCutoffFn.

func (*MockOptionsMockRecorder) SetIsShardCutoverFn

func (mr *MockOptionsMockRecorder) SetIsShardCutoverFn(fn interface{}) *gomock.Call

SetIsShardCutoverFn indicates an expected call of SetIsShardCutoverFn.

func (*MockOptionsMockRecorder) SetIsSharded

func (mr *MockOptionsMockRecorder) SetIsSharded(sharded interface{}) *gomock.Call

SetIsSharded indicates an expected call of SetIsSharded.

func (*MockOptionsMockRecorder) SetIsStaged

func (mr *MockOptionsMockRecorder) SetIsStaged(v interface{}) *gomock.Call

SetIsStaged indicates an expected call of SetIsStaged.

func (*MockOptionsMockRecorder) SetNowFn

func (mr *MockOptionsMockRecorder) SetNowFn(fn interface{}) *gomock.Call

SetNowFn indicates an expected call of SetNowFn.

func (*MockOptionsMockRecorder) SetPlacementCutoverNanosFn

func (mr *MockOptionsMockRecorder) SetPlacementCutoverNanosFn(fn interface{}) *gomock.Call

SetPlacementCutoverNanosFn indicates an expected call of SetPlacementCutoverNanosFn.

func (*MockOptionsMockRecorder) SetShardCutoffNanosFn

func (mr *MockOptionsMockRecorder) SetShardCutoffNanosFn(fn interface{}) *gomock.Call

SetShardCutoffNanosFn indicates an expected call of SetShardCutoffNanosFn.

func (*MockOptionsMockRecorder) SetShardCutoverNanosFn

func (mr *MockOptionsMockRecorder) SetShardCutoverNanosFn(fn interface{}) *gomock.Call

SetShardCutoverNanosFn indicates an expected call of SetShardCutoverNanosFn.

func (*MockOptionsMockRecorder) SetShardStateMode

func (mr *MockOptionsMockRecorder) SetShardStateMode(value interface{}) *gomock.Call

SetShardStateMode indicates an expected call of SetShardStateMode.

func (*MockOptionsMockRecorder) SetValidZone

func (mr *MockOptionsMockRecorder) SetValidZone(z interface{}) *gomock.Call

SetValidZone indicates an expected call of SetValidZone.

func (*MockOptionsMockRecorder) SetValidateFnBeforeUpdate

func (mr *MockOptionsMockRecorder) SetValidateFnBeforeUpdate(fn interface{}) *gomock.Call

SetValidateFnBeforeUpdate indicates an expected call of SetValidateFnBeforeUpdate.

func (*MockOptionsMockRecorder) ShardCutoffNanosFn

func (mr *MockOptionsMockRecorder) ShardCutoffNanosFn() *gomock.Call

ShardCutoffNanosFn indicates an expected call of ShardCutoffNanosFn.

func (*MockOptionsMockRecorder) ShardCutoverNanosFn

func (mr *MockOptionsMockRecorder) ShardCutoverNanosFn() *gomock.Call

ShardCutoverNanosFn indicates an expected call of ShardCutoverNanosFn.

func (*MockOptionsMockRecorder) ShardStateMode

func (mr *MockOptionsMockRecorder) ShardStateMode() *gomock.Call

ShardStateMode indicates an expected call of ShardStateMode.

func (*MockOptionsMockRecorder) ValidZone

func (mr *MockOptionsMockRecorder) ValidZone() *gomock.Call

ValidZone indicates an expected call of ValidZone.

func (*MockOptionsMockRecorder) ValidateFnBeforeUpdate

func (mr *MockOptionsMockRecorder) ValidateFnBeforeUpdate() *gomock.Call

ValidateFnBeforeUpdate indicates an expected call of ValidateFnBeforeUpdate.

type MockPlacement

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

MockPlacement is a mock of Placement interface.

func NewMockPlacement

func NewMockPlacement(ctrl *gomock.Controller) *MockPlacement

NewMockPlacement creates a new mock instance.

func (*MockPlacement) Clone

func (m *MockPlacement) Clone() Placement

Clone mocks base method.

func (*MockPlacement) CutoverNanos

func (m *MockPlacement) CutoverNanos() int64

CutoverNanos mocks base method.

func (*MockPlacement) EXPECT

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

func (*MockPlacement) Instance

func (m *MockPlacement) Instance(id string) (Instance, bool)

Instance mocks base method.

func (*MockPlacement) Instances

func (m *MockPlacement) Instances() []Instance

Instances mocks base method.

func (*MockPlacement) InstancesForShard

func (m *MockPlacement) InstancesForShard(shard uint32) []Instance

InstancesForShard mocks base method.

func (*MockPlacement) IsMirrored

func (m *MockPlacement) IsMirrored() bool

IsMirrored mocks base method.

func (*MockPlacement) IsSharded

func (m *MockPlacement) IsSharded() bool

IsSharded mocks base method.

func (*MockPlacement) MaxShardSetID

func (m *MockPlacement) MaxShardSetID() uint32

MaxShardSetID mocks base method.

func (*MockPlacement) NumInstances

func (m *MockPlacement) NumInstances() int

NumInstances mocks base method.

func (*MockPlacement) NumShards

func (m *MockPlacement) NumShards() int

NumShards mocks base method.

func (*MockPlacement) Proto

func (m *MockPlacement) Proto() (*placementpb.Placement, error)

Proto mocks base method.

func (*MockPlacement) ReplicaFactor

func (m *MockPlacement) ReplicaFactor() int

ReplicaFactor mocks base method.

func (*MockPlacement) SetCutoverNanos

func (m *MockPlacement) SetCutoverNanos(cutoverNanos int64) Placement

SetCutoverNanos mocks base method.

func (*MockPlacement) SetInstances

func (m *MockPlacement) SetInstances(instances []Instance) Placement

SetInstances mocks base method.

func (*MockPlacement) SetIsMirrored

func (m *MockPlacement) SetIsMirrored(v bool) Placement

SetIsMirrored mocks base method.

func (*MockPlacement) SetIsSharded

func (m *MockPlacement) SetIsSharded(v bool) Placement

SetIsSharded mocks base method.

func (*MockPlacement) SetMaxShardSetID

func (m *MockPlacement) SetMaxShardSetID(value uint32) Placement

SetMaxShardSetID mocks base method.

func (*MockPlacement) SetReplicaFactor

func (m *MockPlacement) SetReplicaFactor(rf int) Placement

SetReplicaFactor mocks base method.

func (*MockPlacement) SetShards

func (m *MockPlacement) SetShards(s []uint32) Placement

SetShards mocks base method.

func (*MockPlacement) SetVersion

func (m *MockPlacement) SetVersion(v int) Placement

SetVersion mocks base method.

func (*MockPlacement) Shards

func (m *MockPlacement) Shards() []uint32

Shards mocks base method.

func (*MockPlacement) String

func (m *MockPlacement) String() string

String mocks base method.

func (*MockPlacement) Version

func (m *MockPlacement) Version() int

Version mocks base method.

type MockPlacementMockRecorder

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

MockPlacementMockRecorder is the mock recorder for MockPlacement.

func (*MockPlacementMockRecorder) Clone

func (mr *MockPlacementMockRecorder) Clone() *gomock.Call

Clone indicates an expected call of Clone.

func (*MockPlacementMockRecorder) CutoverNanos

func (mr *MockPlacementMockRecorder) CutoverNanos() *gomock.Call

CutoverNanos indicates an expected call of CutoverNanos.

func (*MockPlacementMockRecorder) Instance

func (mr *MockPlacementMockRecorder) Instance(id interface{}) *gomock.Call

Instance indicates an expected call of Instance.

func (*MockPlacementMockRecorder) Instances

func (mr *MockPlacementMockRecorder) Instances() *gomock.Call

Instances indicates an expected call of Instances.

func (*MockPlacementMockRecorder) InstancesForShard

func (mr *MockPlacementMockRecorder) InstancesForShard(shard interface{}) *gomock.Call

InstancesForShard indicates an expected call of InstancesForShard.

func (*MockPlacementMockRecorder) IsMirrored

func (mr *MockPlacementMockRecorder) IsMirrored() *gomock.Call

IsMirrored indicates an expected call of IsMirrored.

func (*MockPlacementMockRecorder) IsSharded

func (mr *MockPlacementMockRecorder) IsSharded() *gomock.Call

IsSharded indicates an expected call of IsSharded.

func (*MockPlacementMockRecorder) MaxShardSetID

func (mr *MockPlacementMockRecorder) MaxShardSetID() *gomock.Call

MaxShardSetID indicates an expected call of MaxShardSetID.

func (*MockPlacementMockRecorder) NumInstances

func (mr *MockPlacementMockRecorder) NumInstances() *gomock.Call

NumInstances indicates an expected call of NumInstances.

func (*MockPlacementMockRecorder) NumShards

func (mr *MockPlacementMockRecorder) NumShards() *gomock.Call

NumShards indicates an expected call of NumShards.

func (*MockPlacementMockRecorder) Proto

func (mr *MockPlacementMockRecorder) Proto() *gomock.Call

Proto indicates an expected call of Proto.

func (*MockPlacementMockRecorder) ReplicaFactor

func (mr *MockPlacementMockRecorder) ReplicaFactor() *gomock.Call

ReplicaFactor indicates an expected call of ReplicaFactor.

func (*MockPlacementMockRecorder) SetCutoverNanos

func (mr *MockPlacementMockRecorder) SetCutoverNanos(cutoverNanos interface{}) *gomock.Call

SetCutoverNanos indicates an expected call of SetCutoverNanos.

func (*MockPlacementMockRecorder) SetInstances

func (mr *MockPlacementMockRecorder) SetInstances(instances interface{}) *gomock.Call

SetInstances indicates an expected call of SetInstances.

func (*MockPlacementMockRecorder) SetIsMirrored

func (mr *MockPlacementMockRecorder) SetIsMirrored(v interface{}) *gomock.Call

SetIsMirrored indicates an expected call of SetIsMirrored.

func (*MockPlacementMockRecorder) SetIsSharded

func (mr *MockPlacementMockRecorder) SetIsSharded(v interface{}) *gomock.Call

SetIsSharded indicates an expected call of SetIsSharded.

func (*MockPlacementMockRecorder) SetMaxShardSetID

func (mr *MockPlacementMockRecorder) SetMaxShardSetID(value interface{}) *gomock.Call

SetMaxShardSetID indicates an expected call of SetMaxShardSetID.

func (*MockPlacementMockRecorder) SetReplicaFactor

func (mr *MockPlacementMockRecorder) SetReplicaFactor(rf interface{}) *gomock.Call

SetReplicaFactor indicates an expected call of SetReplicaFactor.

func (*MockPlacementMockRecorder) SetShards

func (mr *MockPlacementMockRecorder) SetShards(s interface{}) *gomock.Call

SetShards indicates an expected call of SetShards.

func (*MockPlacementMockRecorder) SetVersion

func (mr *MockPlacementMockRecorder) SetVersion(v interface{}) *gomock.Call

SetVersion indicates an expected call of SetVersion.

func (*MockPlacementMockRecorder) Shards

func (mr *MockPlacementMockRecorder) Shards() *gomock.Call

Shards indicates an expected call of Shards.

func (*MockPlacementMockRecorder) String

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

String indicates an expected call of String.

func (*MockPlacementMockRecorder) Version

func (mr *MockPlacementMockRecorder) Version() *gomock.Call

Version indicates an expected call of Version.

type MockService

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

MockService is a mock of Service interface.

func NewMockService

func NewMockService(ctrl *gomock.Controller) *MockService

NewMockService creates a new mock instance.

func (*MockService) AddInstances

func (m *MockService) AddInstances(candidates []Instance) (Placement, []Instance, error)

AddInstances mocks base method.

func (*MockService) AddReplica

func (m *MockService) AddReplica() (Placement, error)

AddReplica mocks base method.

func (*MockService) BalanceShards added in v1.2.0

func (m *MockService) BalanceShards() (Placement, error)

BalanceShards mocks base method.

func (*MockService) BuildInitialPlacement

func (m *MockService) BuildInitialPlacement(instances []Instance, numShards, rf int) (Placement, error)

BuildInitialPlacement mocks base method.

func (*MockService) CheckAndSet

func (m *MockService) CheckAndSet(p Placement, version int) (Placement, error)

CheckAndSet mocks base method.

func (*MockService) CheckAndSetProto

func (m *MockService) CheckAndSetProto(p proto.Message, version int) (int, error)

CheckAndSetProto mocks base method.

func (*MockService) Delete

func (m *MockService) Delete() error

Delete mocks base method.

func (*MockService) EXPECT

func (m *MockService) EXPECT() *MockServiceMockRecorder

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

func (*MockService) MarkAllShardsAvailable

func (m *MockService) MarkAllShardsAvailable() (Placement, error)

MarkAllShardsAvailable mocks base method.

func (*MockService) MarkInstanceAvailable

func (m *MockService) MarkInstanceAvailable(instanceID string) (Placement, error)

MarkInstanceAvailable mocks base method.

func (*MockService) MarkShardsAvailable

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

MarkShardsAvailable mocks base method.

func (*MockService) Placement

func (m *MockService) Placement() (Placement, error)

Placement mocks base method.

func (*MockService) PlacementForVersion

func (m *MockService) PlacementForVersion(version int) (Placement, error)

PlacementForVersion mocks base method.

func (*MockService) Proto

func (m *MockService) Proto() (proto.Message, int, error)

Proto mocks base method.

func (*MockService) RemoveInstances

func (m *MockService) RemoveInstances(leavingInstanceIDs []string) (Placement, error)

RemoveInstances mocks base method.

func (*MockService) ReplaceInstances

func (m *MockService) ReplaceInstances(leavingInstanceIDs []string, candidates []Instance) (Placement, []Instance, error)

ReplaceInstances mocks base method.

func (*MockService) Set

func (m *MockService) Set(p Placement) (Placement, error)

Set mocks base method.

func (*MockService) SetIfNotExist

func (m *MockService) SetIfNotExist(p Placement) (Placement, error)

SetIfNotExist mocks base method.

func (*MockService) SetProto

func (m *MockService) SetProto(p proto.Message) (int, error)

SetProto mocks base method.

func (*MockService) Watch

func (m *MockService) Watch() (Watch, error)

Watch mocks base method.

type MockServiceMockRecorder

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

MockServiceMockRecorder is the mock recorder for MockService.

func (*MockServiceMockRecorder) AddInstances

func (mr *MockServiceMockRecorder) AddInstances(candidates interface{}) *gomock.Call

AddInstances indicates an expected call of AddInstances.

func (*MockServiceMockRecorder) AddReplica

func (mr *MockServiceMockRecorder) AddReplica() *gomock.Call

AddReplica indicates an expected call of AddReplica.

func (*MockServiceMockRecorder) BalanceShards added in v1.2.0

func (mr *MockServiceMockRecorder) BalanceShards() *gomock.Call

BalanceShards indicates an expected call of BalanceShards.

func (*MockServiceMockRecorder) BuildInitialPlacement

func (mr *MockServiceMockRecorder) BuildInitialPlacement(instances, numShards, rf interface{}) *gomock.Call

BuildInitialPlacement indicates an expected call of BuildInitialPlacement.

func (*MockServiceMockRecorder) CheckAndSet

func (mr *MockServiceMockRecorder) CheckAndSet(p, version interface{}) *gomock.Call

CheckAndSet indicates an expected call of CheckAndSet.

func (*MockServiceMockRecorder) CheckAndSetProto

func (mr *MockServiceMockRecorder) CheckAndSetProto(p, version interface{}) *gomock.Call

CheckAndSetProto indicates an expected call of CheckAndSetProto.

func (*MockServiceMockRecorder) Delete

func (mr *MockServiceMockRecorder) Delete() *gomock.Call

Delete indicates an expected call of Delete.

func (*MockServiceMockRecorder) MarkAllShardsAvailable

func (mr *MockServiceMockRecorder) MarkAllShardsAvailable() *gomock.Call

MarkAllShardsAvailable indicates an expected call of MarkAllShardsAvailable.

func (*MockServiceMockRecorder) MarkInstanceAvailable

func (mr *MockServiceMockRecorder) MarkInstanceAvailable(instanceID interface{}) *gomock.Call

MarkInstanceAvailable indicates an expected call of MarkInstanceAvailable.

func (*MockServiceMockRecorder) MarkShardsAvailable

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

MarkShardsAvailable indicates an expected call of MarkShardsAvailable.

func (*MockServiceMockRecorder) Placement

func (mr *MockServiceMockRecorder) Placement() *gomock.Call

Placement indicates an expected call of Placement.

func (*MockServiceMockRecorder) PlacementForVersion

func (mr *MockServiceMockRecorder) PlacementForVersion(version interface{}) *gomock.Call

PlacementForVersion indicates an expected call of PlacementForVersion.

func (*MockServiceMockRecorder) Proto

func (mr *MockServiceMockRecorder) Proto() *gomock.Call

Proto indicates an expected call of Proto.

func (*MockServiceMockRecorder) RemoveInstances

func (mr *MockServiceMockRecorder) RemoveInstances(leavingInstanceIDs interface{}) *gomock.Call

RemoveInstances indicates an expected call of RemoveInstances.

func (*MockServiceMockRecorder) ReplaceInstances

func (mr *MockServiceMockRecorder) ReplaceInstances(leavingInstanceIDs, candidates interface{}) *gomock.Call

ReplaceInstances indicates an expected call of ReplaceInstances.

func (*MockServiceMockRecorder) Set

func (mr *MockServiceMockRecorder) Set(p interface{}) *gomock.Call

Set indicates an expected call of Set.

func (*MockServiceMockRecorder) SetIfNotExist

func (mr *MockServiceMockRecorder) SetIfNotExist(p interface{}) *gomock.Call

SetIfNotExist indicates an expected call of SetIfNotExist.

func (*MockServiceMockRecorder) SetProto

func (mr *MockServiceMockRecorder) SetProto(p interface{}) *gomock.Call

SetProto indicates an expected call of SetProto.

func (*MockServiceMockRecorder) Watch

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

Watch indicates an expected call of Watch.

type MockStorage

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

MockStorage is a mock of Storage interface.

func NewMockStorage

func NewMockStorage(ctrl *gomock.Controller) *MockStorage

NewMockStorage creates a new mock instance.

func (*MockStorage) CheckAndSet

func (m *MockStorage) CheckAndSet(p Placement, version int) (Placement, error)

CheckAndSet mocks base method.

func (*MockStorage) CheckAndSetProto

func (m *MockStorage) CheckAndSetProto(p proto.Message, version int) (int, error)

CheckAndSetProto mocks base method.

func (*MockStorage) Delete

func (m *MockStorage) Delete() error

Delete mocks base method.

func (*MockStorage) EXPECT

func (m *MockStorage) EXPECT() *MockStorageMockRecorder

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

func (*MockStorage) Placement

func (m *MockStorage) Placement() (Placement, error)

Placement mocks base method.

func (*MockStorage) PlacementForVersion

func (m *MockStorage) PlacementForVersion(version int) (Placement, error)

PlacementForVersion mocks base method.

func (*MockStorage) Proto

func (m *MockStorage) Proto() (proto.Message, int, error)

Proto mocks base method.

func (*MockStorage) Set

func (m *MockStorage) Set(p Placement) (Placement, error)

Set mocks base method.

func (*MockStorage) SetIfNotExist

func (m *MockStorage) SetIfNotExist(p Placement) (Placement, error)

SetIfNotExist mocks base method.

func (*MockStorage) SetProto

func (m *MockStorage) SetProto(p proto.Message) (int, error)

SetProto mocks base method.

func (*MockStorage) Watch

func (m *MockStorage) Watch() (Watch, error)

Watch mocks base method.

type MockStorageMockRecorder

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

MockStorageMockRecorder is the mock recorder for MockStorage.

func (*MockStorageMockRecorder) CheckAndSet

func (mr *MockStorageMockRecorder) CheckAndSet(p, version interface{}) *gomock.Call

CheckAndSet indicates an expected call of CheckAndSet.

func (*MockStorageMockRecorder) CheckAndSetProto

func (mr *MockStorageMockRecorder) CheckAndSetProto(p, version interface{}) *gomock.Call

CheckAndSetProto indicates an expected call of CheckAndSetProto.

func (*MockStorageMockRecorder) Delete

func (mr *MockStorageMockRecorder) Delete() *gomock.Call

Delete indicates an expected call of Delete.

func (*MockStorageMockRecorder) Placement

func (mr *MockStorageMockRecorder) Placement() *gomock.Call

Placement indicates an expected call of Placement.

func (*MockStorageMockRecorder) PlacementForVersion

func (mr *MockStorageMockRecorder) PlacementForVersion(version interface{}) *gomock.Call

PlacementForVersion indicates an expected call of PlacementForVersion.

func (*MockStorageMockRecorder) Proto

func (mr *MockStorageMockRecorder) Proto() *gomock.Call

Proto indicates an expected call of Proto.

func (*MockStorageMockRecorder) Set

func (mr *MockStorageMockRecorder) Set(p interface{}) *gomock.Call

Set indicates an expected call of Set.

func (*MockStorageMockRecorder) SetIfNotExist

func (mr *MockStorageMockRecorder) SetIfNotExist(p interface{}) *gomock.Call

SetIfNotExist indicates an expected call of SetIfNotExist.

func (*MockStorageMockRecorder) SetProto

func (mr *MockStorageMockRecorder) SetProto(p interface{}) *gomock.Call

SetProto indicates an expected call of SetProto.

func (*MockStorageMockRecorder) Watch

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

Watch indicates an expected call of Watch.

type MockWatch

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

MockWatch is a mock of Watch interface.

func NewMockWatch

func NewMockWatch(ctrl *gomock.Controller) *MockWatch

NewMockWatch creates a new mock instance.

func (*MockWatch) C

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

C mocks base method.

func (*MockWatch) Close

func (m *MockWatch) Close()

Close mocks base method.

func (*MockWatch) EXPECT

func (m *MockWatch) EXPECT() *MockWatchMockRecorder

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

func (*MockWatch) Get

func (m *MockWatch) Get() (Placement, error)

Get mocks base method.

type MockWatchMockRecorder

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

MockWatchMockRecorder is the mock recorder for MockWatch.

func (*MockWatchMockRecorder) C

C indicates an expected call of C.

func (*MockWatchMockRecorder) Close

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

Close indicates an expected call of Close.

func (*MockWatchMockRecorder) Get

func (mr *MockWatchMockRecorder) Get() *gomock.Call

Get indicates an expected call of Get.

type MockWatcher added in v1.2.0

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

MockWatcher is a mock of Watcher interface.

func NewMockWatcher added in v1.2.0

func NewMockWatcher(ctrl *gomock.Controller) *MockWatcher

NewMockWatcher creates a new mock instance.

func (*MockWatcher) EXPECT added in v1.2.0

func (m *MockWatcher) EXPECT() *MockWatcherMockRecorder

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

func (*MockWatcher) Get added in v1.2.0

func (m *MockWatcher) Get() (Placement, error)

Get mocks base method.

func (*MockWatcher) Unwatch added in v1.2.0

func (m *MockWatcher) Unwatch() error

Unwatch mocks base method.

func (*MockWatcher) Watch added in v1.2.0

func (m *MockWatcher) Watch() error

Watch mocks base method.

type MockWatcherMockRecorder added in v1.2.0

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

MockWatcherMockRecorder is the mock recorder for MockWatcher.

func (*MockWatcherMockRecorder) Get added in v1.2.0

func (mr *MockWatcherMockRecorder) Get() *gomock.Call

Get indicates an expected call of Get.

func (*MockWatcherMockRecorder) Unwatch added in v1.2.0

func (mr *MockWatcherMockRecorder) Unwatch() *gomock.Call

Unwatch indicates an expected call of Unwatch.

func (*MockWatcherMockRecorder) Watch added in v1.2.0

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

Watch indicates an expected call of Watch.

type MockWatcherOptions added in v1.2.0

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

MockWatcherOptions is a mock of WatcherOptions interface.

func NewMockWatcherOptions added in v1.2.0

func NewMockWatcherOptions(ctrl *gomock.Controller) *MockWatcherOptions

NewMockWatcherOptions creates a new mock instance.

func (*MockWatcherOptions) EXPECT added in v1.2.0

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

func (*MockWatcherOptions) InitWatchTimeout added in v1.2.0

func (m *MockWatcherOptions) InitWatchTimeout() time.Duration

InitWatchTimeout mocks base method.

func (*MockWatcherOptions) InstrumentOptions added in v1.2.0

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

InstrumentOptions mocks base method.

func (*MockWatcherOptions) OnPlacementChangedFn added in v1.2.0

func (m *MockWatcherOptions) OnPlacementChangedFn() OnPlacementChangedFn

OnPlacementChangedFn mocks base method.

func (*MockWatcherOptions) SetInitWatchTimeout added in v1.2.0

func (m *MockWatcherOptions) SetInitWatchTimeout(value time.Duration) WatcherOptions

SetInitWatchTimeout mocks base method.

func (*MockWatcherOptions) SetInstrumentOptions added in v1.2.0

func (m *MockWatcherOptions) SetInstrumentOptions(value instrument.Options) WatcherOptions

SetInstrumentOptions mocks base method.

func (*MockWatcherOptions) SetOnPlacementChangedFn added in v1.2.0

func (m *MockWatcherOptions) SetOnPlacementChangedFn(value OnPlacementChangedFn) WatcherOptions

SetOnPlacementChangedFn mocks base method.

func (*MockWatcherOptions) SetStagedPlacementKey added in v1.2.0

func (m *MockWatcherOptions) SetStagedPlacementKey(value string) WatcherOptions

SetStagedPlacementKey mocks base method.

func (*MockWatcherOptions) SetStagedPlacementStore added in v1.2.0

func (m *MockWatcherOptions) SetStagedPlacementStore(store kv.Store) WatcherOptions

SetStagedPlacementStore mocks base method.

func (*MockWatcherOptions) StagedPlacementKey added in v1.2.0

func (m *MockWatcherOptions) StagedPlacementKey() string

StagedPlacementKey mocks base method.

func (*MockWatcherOptions) StagedPlacementStore added in v1.2.0

func (m *MockWatcherOptions) StagedPlacementStore() kv.Store

StagedPlacementStore mocks base method.

type MockWatcherOptionsMockRecorder added in v1.2.0

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

MockWatcherOptionsMockRecorder is the mock recorder for MockWatcherOptions.

func (*MockWatcherOptionsMockRecorder) InitWatchTimeout added in v1.2.0

func (mr *MockWatcherOptionsMockRecorder) InitWatchTimeout() *gomock.Call

InitWatchTimeout indicates an expected call of InitWatchTimeout.

func (*MockWatcherOptionsMockRecorder) InstrumentOptions added in v1.2.0

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

InstrumentOptions indicates an expected call of InstrumentOptions.

func (*MockWatcherOptionsMockRecorder) OnPlacementChangedFn added in v1.2.0

func (mr *MockWatcherOptionsMockRecorder) OnPlacementChangedFn() *gomock.Call

OnPlacementChangedFn indicates an expected call of OnPlacementChangedFn.

func (*MockWatcherOptionsMockRecorder) SetInitWatchTimeout added in v1.2.0

func (mr *MockWatcherOptionsMockRecorder) SetInitWatchTimeout(value interface{}) *gomock.Call

SetInitWatchTimeout indicates an expected call of SetInitWatchTimeout.

func (*MockWatcherOptionsMockRecorder) SetInstrumentOptions added in v1.2.0

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

SetInstrumentOptions indicates an expected call of SetInstrumentOptions.

func (*MockWatcherOptionsMockRecorder) SetOnPlacementChangedFn added in v1.2.0

func (mr *MockWatcherOptionsMockRecorder) SetOnPlacementChangedFn(value interface{}) *gomock.Call

SetOnPlacementChangedFn indicates an expected call of SetOnPlacementChangedFn.

func (*MockWatcherOptionsMockRecorder) SetStagedPlacementKey added in v1.2.0

func (mr *MockWatcherOptionsMockRecorder) SetStagedPlacementKey(value interface{}) *gomock.Call

SetStagedPlacementKey indicates an expected call of SetStagedPlacementKey.

func (*MockWatcherOptionsMockRecorder) SetStagedPlacementStore added in v1.2.0

func (mr *MockWatcherOptionsMockRecorder) SetStagedPlacementStore(store interface{}) *gomock.Call

SetStagedPlacementStore indicates an expected call of SetStagedPlacementStore.

func (*MockWatcherOptionsMockRecorder) StagedPlacementKey added in v1.2.0

func (mr *MockWatcherOptionsMockRecorder) StagedPlacementKey() *gomock.Call

StagedPlacementKey indicates an expected call of StagedPlacementKey.

func (*MockWatcherOptionsMockRecorder) StagedPlacementStore added in v1.2.0

func (mr *MockWatcherOptionsMockRecorder) StagedPlacementStore() *gomock.Call

StagedPlacementStore indicates an expected call of StagedPlacementStore.

type Mockoperations added in v0.15.13

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

Mockoperations is a mock of operations interface.

func NewMockoperations added in v0.15.13

func NewMockoperations(ctrl *gomock.Controller) *Mockoperations

NewMockoperations creates a new mock instance.

func (*Mockoperations) AddInstances added in v0.15.13

func (m *Mockoperations) AddInstances(candidates []Instance) (Placement, []Instance, error)

AddInstances mocks base method.

func (*Mockoperations) AddReplica added in v0.15.13

func (m *Mockoperations) AddReplica() (Placement, error)

AddReplica mocks base method.

func (*Mockoperations) BalanceShards added in v1.2.0

func (m *Mockoperations) BalanceShards() (Placement, error)

BalanceShards mocks base method.

func (*Mockoperations) BuildInitialPlacement added in v0.15.13

func (m *Mockoperations) BuildInitialPlacement(instances []Instance, numShards, rf int) (Placement, error)

BuildInitialPlacement mocks base method.

func (*Mockoperations) EXPECT added in v0.15.13

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

func (*Mockoperations) MarkAllShardsAvailable added in v0.15.13

func (m *Mockoperations) MarkAllShardsAvailable() (Placement, error)

MarkAllShardsAvailable mocks base method.

func (*Mockoperations) MarkInstanceAvailable added in v0.15.13

func (m *Mockoperations) MarkInstanceAvailable(instanceID string) (Placement, error)

MarkInstanceAvailable mocks base method.

func (*Mockoperations) MarkShardsAvailable added in v0.15.13

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

MarkShardsAvailable mocks base method.

func (*Mockoperations) RemoveInstances added in v0.15.13

func (m *Mockoperations) RemoveInstances(leavingInstanceIDs []string) (Placement, error)

RemoveInstances mocks base method.

func (*Mockoperations) ReplaceInstances added in v0.15.13

func (m *Mockoperations) ReplaceInstances(leavingInstanceIDs []string, candidates []Instance) (Placement, []Instance, error)

ReplaceInstances mocks base method.

type MockoperationsMockRecorder added in v0.15.13

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

MockoperationsMockRecorder is the mock recorder for Mockoperations.

func (*MockoperationsMockRecorder) AddInstances added in v0.15.13

func (mr *MockoperationsMockRecorder) AddInstances(candidates interface{}) *gomock.Call

AddInstances indicates an expected call of AddInstances.

func (*MockoperationsMockRecorder) AddReplica added in v0.15.13

func (mr *MockoperationsMockRecorder) AddReplica() *gomock.Call

AddReplica indicates an expected call of AddReplica.

func (*MockoperationsMockRecorder) BalanceShards added in v1.2.0

func (mr *MockoperationsMockRecorder) BalanceShards() *gomock.Call

BalanceShards indicates an expected call of BalanceShards.

func (*MockoperationsMockRecorder) BuildInitialPlacement added in v0.15.13

func (mr *MockoperationsMockRecorder) BuildInitialPlacement(instances, numShards, rf interface{}) *gomock.Call

BuildInitialPlacement indicates an expected call of BuildInitialPlacement.

func (*MockoperationsMockRecorder) MarkAllShardsAvailable added in v0.15.13

func (mr *MockoperationsMockRecorder) MarkAllShardsAvailable() *gomock.Call

MarkAllShardsAvailable indicates an expected call of MarkAllShardsAvailable.

func (*MockoperationsMockRecorder) MarkInstanceAvailable added in v0.15.13

func (mr *MockoperationsMockRecorder) MarkInstanceAvailable(instanceID interface{}) *gomock.Call

MarkInstanceAvailable indicates an expected call of MarkInstanceAvailable.

func (*MockoperationsMockRecorder) MarkShardsAvailable added in v0.15.13

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

MarkShardsAvailable indicates an expected call of MarkShardsAvailable.

func (*MockoperationsMockRecorder) RemoveInstances added in v0.15.13

func (mr *MockoperationsMockRecorder) RemoveInstances(leavingInstanceIDs interface{}) *gomock.Call

RemoveInstances indicates an expected call of RemoveInstances.

func (*MockoperationsMockRecorder) ReplaceInstances added in v0.15.13

func (mr *MockoperationsMockRecorder) ReplaceInstances(leavingInstanceIDs, candidates interface{}) *gomock.Call

ReplaceInstances indicates an expected call of ReplaceInstances.

type OnPlacementChangedFn added in v1.2.0

type OnPlacementChangedFn func(prev, curr Placement)

OnPlacementChangedFn is called when placement has changed in the store, or when it is loaded first time when watcher starts. In the latter case, the prev value is nil.

type Operator added in v0.15.13

type Operator interface {
	Placement() Placement
	// contains filtered or unexported methods
}

Operator is a purely in-memory version of Service; it applies placement related operations to a local copy of a placement without persisting anything to backing storage. This can be useful to apply multiple placement operations in a row before persisting them, e.g.:

func DoMultipleOps(opts placement.Options, store placement.Storage) {
   curPlacement := store.Placement()
   op := placement.NewOperator(curPlacement, opts)
   op.ReplaceInstances(...)
   op.MarkAllShardsAvailable()
   store.CheckAndSet(op.Placement())
}

type Options

type Options interface {
	// AllowPartialReplace allows shards from the leaving instance to be
	// placed on instances other than the new instances in a replace operation
	AllowPartialReplace() bool

	// SetAllowPartialReplace sets AllowPartialReplace.
	SetAllowPartialReplace(allowPartialReplace bool) Options

	// AllowAllZones will enable the placement to contain hosts that
	// are not contained within the same zone of the actual placement. This is
	// needed for services that require cross zone communication.
	AllowAllZones() bool

	// SetAllowAllZones sets AllowAllZones.
	SetAllowAllZones(allowAllZones bool) Options

	// AddAllCandidates determines whether the placement will attempt to add all
	// candidates when adding instances or just a single one.
	AddAllCandidates() bool

	// SetAddAllCandidates sets AddAllCandidates.
	SetAddAllCandidates(addAllCandidates bool) Options

	// InstanceSelector defines the strategy used to select new instances from a list of
	// candidates when adding or replacing nodes in the placement. The default is determined
	// by IsMirrored(); false => selector.NewNonMirroredSelector, true => NewPortMirroredSelector.
	InstanceSelector() InstanceSelector

	// SetInstanceSelector -- see InstanceSelector.
	SetInstanceSelector(s InstanceSelector) Options

	// IsSharded describes whether a placement needs to be sharded,
	// when set to false, no specific shards will be assigned to any instance.
	IsSharded() bool

	// SetIsSharded sets IsSharded.
	SetIsSharded(sharded bool) Options

	// ShardStateMode describes the mode to manage shard state in the placement.
	ShardStateMode() ShardStateMode

	// SetShardStateMode sets ShardStateMode.
	SetShardStateMode(value ShardStateMode) Options

	// Dryrun will try to perform the placement operation but will not persist the final result.
	Dryrun() bool

	// SetDryrun sets whether the Dryrun value.
	SetDryrun(d bool) Options

	// IsMirrored returns whether the shard distribution should be mirrored
	// to support master/slave model.
	IsMirrored() bool

	// SetIsMirrored sets IsMirrored.
	SetIsMirrored(m bool) Options

	// IsStaged returns whether the placement should keep all the snapshots.
	IsStaged() bool

	// SetIsStaged sets whether the placement should keep all the snapshots.
	SetIsStaged(v bool) Options

	// Compress returns whether the placement is compressed when written to storage.
	Compress() bool

	// SetCompress sets whether the placement is compressed when written to storage.
	SetCompress(v bool) Options

	// InstrumentOptions is the options for instrument.
	InstrumentOptions() instrument.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(iopts instrument.Options) Options

	// ValidZone returns the zone that added instances must be in in order
	// to be added to a placement.
	ValidZone() string

	// SetValidZone sets the zone that added instances must be in in order to
	// be added to a placement. By default the valid zone will be the zone of
	// instances already in a placement, however if a placement is empty then
	// it is necessary to specify the valid zone when adding the first
	// instance.
	SetValidZone(z string) Options

	// PlacementCutoverNanosFn returns the TimeNanosFn for placement cutover time.
	PlacementCutoverNanosFn() TimeNanosFn

	// SetPlacementCutoverNanosFn sets the TimeNanosFn for placement cutover time.
	SetPlacementCutoverNanosFn(fn TimeNanosFn) Options

	// ShardCutoverNanosFn returns the TimeNanosFn for shard cutover time.
	ShardCutoverNanosFn() TimeNanosFn

	// SetShardCutoverNanosFn sets the TimeNanosFn for shard cutover time.
	SetShardCutoverNanosFn(fn TimeNanosFn) Options

	// ShardCutoffNanosFn returns the TimeNanosFn for shard cutoff time.
	ShardCutoffNanosFn() TimeNanosFn

	// SetShardCutoffNanosFn sets the TimeNanosFn for shard cutoff time.
	SetShardCutoffNanosFn(fn TimeNanosFn) Options

	// IsShardCutoverFn returns the validation function for shard cutover.
	IsShardCutoverFn() ShardValidateFn

	// SetIsShardCutoverFn sets the validation function for shard cutover.
	SetIsShardCutoverFn(fn ShardValidateFn) Options

	// IsShardCutoffFn returns the validation function for shard cutoff.
	IsShardCutoffFn() ShardValidateFn

	// SetIsShardCutoffFn sets the validation function for shard cutoff.
	SetIsShardCutoffFn(fn ShardValidateFn) Options

	// ValidateFnBeforeUpdate returns the validate function to be applied before
	// a placement update.
	ValidateFnBeforeUpdate() ValidateFn

	// SetValidateFnBeforeUpdate sets the validate function to be applied before
	// a placement update.
	SetValidateFnBeforeUpdate(fn ValidateFn) Options

	// NowFn returns the function to get time now.
	NowFn() clock.NowFn

	// SetNowFn sets the function to get time now.
	SetNowFn(fn clock.NowFn) Options
}

Options is the interface for placement options.

func NewOptions

func NewOptions() Options

NewOptions returns a default Options.

type Placement

type Placement interface {
	// InstancesForShard returns the instances for a given shard id.
	InstancesForShard(shard uint32) []Instance

	// Instances returns all instances in the placement
	Instances() []Instance

	// SetInstances sets the instances
	SetInstances(instances []Instance) Placement

	// NumInstances returns the number of instances in the placement
	NumInstances() int

	// Instance returns the instance for the requested id
	Instance(id string) (Instance, bool)

	// ReplicaFactor returns the replica factor in the placement
	ReplicaFactor() int

	// SetReplicaFactor sets the ReplicaFactor
	SetReplicaFactor(rf int) Placement

	// Shards returns all the unique shard ids for a replica
	Shards() []uint32

	// SetShards sets the unique shard ids for a replica
	SetShards(s []uint32) Placement

	// NumShards returns the number of shards in a replica
	NumShards() int

	// IsSharded returns whether this placement is sharded
	IsSharded() bool

	// SetIsSharded sets IsSharded
	SetIsSharded(v bool) Placement

	// CutoverNanos returns the cutover time in nanoseconds.
	CutoverNanos() int64

	// SetCutoverNanos sets the cutover time in nanoseconds.
	SetCutoverNanos(cutoverNanos int64) Placement

	// IsMirrored returns whether the placement is mirrored.
	IsMirrored() bool

	// SetIsMirrored sets IsMirrored.
	SetIsMirrored(v bool) Placement

	// MaxShardSetID returns the maximum shard set id used before to guarantee unique
	// shard set id generations across placement changes.
	MaxShardSetID() uint32

	// SetMaxShardSetID sets the maximum shard set id used before to guarantee unique
	// shard set id generations across placement changes.
	SetMaxShardSetID(value uint32) Placement

	// String returns a description of the placement
	String() string

	// Version returns the version of the placement retrieved from the backing MVCC store.
	Version() int

	// SetVersion sets the version of the placement object. Since version
	// is determined by the backing MVCC store, calling this method has no
	// effect in terms of the updated ServicePlacement that is written back
	// to the MVCC store.
	SetVersion(v int) Placement

	// Proto returns the proto representation for the Placement.
	Proto() (*placementpb.Placement, error)

	// Clone returns a clone of the Placement.
	Clone() Placement
}

Placement describes how instances are placed.

func NewPlacement

func NewPlacement() Placement

NewPlacement returns a ServicePlacement

func NewPlacementFromProto

func NewPlacementFromProto(p *placementpb.Placement) (Placement, error)

NewPlacementFromProto creates a new placement from proto.

type Placements

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

Placements represents a placement that is backward compatible with the deprecated concept of staged placement.

func NewPlacementsFromLatest added in v1.2.0

func NewPlacementsFromLatest(p Placement) (*Placements, error)

NewPlacementsFromLatest creates Placements from latest placement.

func NewPlacementsFromProto

func NewPlacementsFromProto(p *placementpb.PlacementSnapshots) (*Placements, error)

NewPlacementsFromProto creates Placements from proto.

func (*Placements) Latest added in v1.2.0

func (placements *Placements) Latest() Placement

Latest returns the latest placement.

func (*Placements) Proto

func (placements *Placements) Proto() (*placementpb.PlacementSnapshots, error)

Proto converts Placements to a proto.

func (*Placements) ProtoCompressed added in v1.2.0

func (placements *Placements) ProtoCompressed() (*placementpb.PlacementSnapshots, error)

ProtoCompressed converts Placements to a proto with compressed placement.

type Service

type Service interface {
	Storage
	// contains filtered or unexported methods
}

Service handles the placement related operations for registered services all write or update operations will persist the generated placement before returning success.

type ShardStateMode

type ShardStateMode int

ShardStateMode describes the way to manage shard state in the placement.

const (
	// StableShardStateOnly means the placement should only keep stable shard state.
	StableShardStateOnly ShardStateMode = iota

	// IncludeTransitionalShardStates means the placement will include transitional shard states.
	IncludeTransitionalShardStates
)

type ShardValidateFn

type ShardValidateFn func(s shard.Shard) error

ShardValidateFn validates the shard.

type Storage

type Storage interface {
	// Set writes a placement.
	Set(p Placement) (Placement, error)

	// CheckAndSet writes a placement if the current version
	// matches the expected version.
	CheckAndSet(p Placement, version int) (Placement, error)

	// SetIfNotExist writes a placement.
	SetIfNotExist(p Placement) (Placement, error)

	// Placement reads placement.
	Placement() (Placement, error)

	// Watch returns a watch for the placement updates.
	Watch() (Watch, error)

	// Delete deletes the placement.
	Delete() error

	// SetProto sets the proto as the placement.
	SetProto(p proto.Message) (int, error)

	// CheckAndSetProto writes a proto if the current version
	// matches the expected version.
	CheckAndSetProto(p proto.Message, version int) (int, error)

	// Proto returns the placement proto.
	Proto() (proto.Message, int, error)

	// PlacementForVersion returns the placement of a specific version.
	PlacementForVersion(version int) (Placement, error)
}

Storage provides read and write access to placement.

type TimeNanosFn

type TimeNanosFn func() int64

TimeNanosFn returns the time in the format of Unix nanoseconds.

type ValidateFn

type ValidateFn func(p Placement) error

ValidateFn validates the placement.

type Watch

type Watch interface {
	// C returns the notification channel.
	C() <-chan struct{}

	// Get returns the latest version of the placement.
	Get() (Placement, error)

	// Close stops watching for placement updates.
	Close()
}

Watch watches for updates of a placement.

type Watcher added in v1.2.0

type Watcher interface {
	// Watch starts watching the updates.
	Watch() error

	// Get returns the latest version of the placement.
	Get() (Placement, error)

	// Unwatch stops watching the updates.
	Unwatch() error
}

Watcher watches for updates of the placement. Unlike above type Watch, it notifies the client of placement changes via a callback function.

func NewPlacementsWatcher added in v1.2.0

func NewPlacementsWatcher(opts WatcherOptions) Watcher

NewPlacementsWatcher creates a new staged placement watcher.

type WatcherConfiguration

type WatcherConfiguration struct {
	// Placement key.
	Key string `yaml:"key" validate:"nonzero"`

	// Initial watch timeout.
	InitWatchTimeout time.Duration `yaml:"initWatchTimeout"`
}

WatcherConfiguration contains placement watcher configuration.

func (*WatcherConfiguration) NewOptions

func (c *WatcherConfiguration) NewOptions(
	store kv.Store,
	instrumentOpts instrument.Options,
) WatcherOptions

NewOptions creates a placement watcher option.

type WatcherOptions added in v1.2.0

type WatcherOptions interface {
	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) WatcherOptions

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

	// SetStagedPlacementKey sets the kv key to watch for staged placement.
	SetStagedPlacementKey(value string) WatcherOptions

	// StagedPlacementKey returns the kv key to watch for staged placement.
	StagedPlacementKey() string

	// SetStagedPlacementStore sets the staged placement store.
	SetStagedPlacementStore(store kv.Store) WatcherOptions

	// StagedPlacementStore returns the staged placement store.
	StagedPlacementStore() kv.Store

	// SetInitWatchTimeout sets the initial watch timeout.
	SetInitWatchTimeout(value time.Duration) WatcherOptions

	// InitWatchTimeout returns the initial watch timeout.
	InitWatchTimeout() time.Duration

	// SetOnPlacementChangedFn sets the callback function for placement change.
	SetOnPlacementChangedFn(value OnPlacementChangedFn) WatcherOptions

	// OnPlacementChangedFn returns the callback function for placement change.
	OnPlacementChangedFn() OnPlacementChangedFn
}

WatcherOptions provide a set of placement watcher options.

func NewWatcherOptions added in v1.2.0

func NewWatcherOptions() WatcherOptions

NewWatcherOptions create a new set of options.

Directories

Path Synopsis
Package algo implements different types of placement algorithms
Package algo implements different types of placement algorithms

Jump to

Keyboard shortcuts

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