placement

package
v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

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 ActiveStagedPlacement

type ActiveStagedPlacement interface {
	// ActivePlacement returns the currently active placement for a given time, the callback
	// function when the caller is done using the placement, and any errors encountered.
	ActivePlacement() (Placement, DoneFn, error)

	// Close closes the active staged placement.
	Close() error
}

ActiveStagedPlacement describes active staged placement.

type ActiveStagedPlacementOptions

type ActiveStagedPlacementOptions interface {
	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) ActiveStagedPlacementOptions

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetOnPlacementsAddedFn sets the callback function for adding placement.
	SetOnPlacementsAddedFn(value OnPlacementsAddedFn) ActiveStagedPlacementOptions

	// OnPlacementsAddedFn returns the callback function for adding placement.
	OnPlacementsAddedFn() OnPlacementsAddedFn

	// SetOnPlacementsRemovedFn sets the callback function for removing placement.
	SetOnPlacementsRemovedFn(value OnPlacementsRemovedFn) ActiveStagedPlacementOptions

	// OnPlacementsRemovedFn returns the callback function for removing placement.
	OnPlacementsRemovedFn() OnPlacementsRemovedFn
}

ActiveStagedPlacementOptions provide a set of options for active staged placement.

func NewActiveStagedPlacementOptions

func NewActiveStagedPlacementOptions() ActiveStagedPlacementOptions

NewActiveStagedPlacementOptions create a new set of active staged placement options.

type Algorithm

type Algorithm interface {
	// InitPlacement 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)

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

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 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 DoneFn

type DoneFn func()

DoneFn is called when caller is done using the resource.

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

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

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

MockActiveStagedPlacement is a mock of ActiveStagedPlacement interface

func NewMockActiveStagedPlacement

func NewMockActiveStagedPlacement(ctrl *gomock.Controller) *MockActiveStagedPlacement

NewMockActiveStagedPlacement creates a new mock instance

func (*MockActiveStagedPlacement) ActivePlacement

func (m *MockActiveStagedPlacement) ActivePlacement() (Placement, DoneFn, error)

ActivePlacement mocks base method

func (*MockActiveStagedPlacement) Close

func (m *MockActiveStagedPlacement) Close() error

Close mocks base method

func (*MockActiveStagedPlacement) EXPECT

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

type MockActiveStagedPlacementMockRecorder

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

MockActiveStagedPlacementMockRecorder is the mock recorder for MockActiveStagedPlacement

func (*MockActiveStagedPlacementMockRecorder) ActivePlacement

func (mr *MockActiveStagedPlacementMockRecorder) ActivePlacement() *gomock.Call

ActivePlacement indicates an expected call of ActivePlacement

func (*MockActiveStagedPlacementMockRecorder) Close

Close indicates an expected call of Close

type MockActiveStagedPlacementOptions

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

MockActiveStagedPlacementOptions is a mock of ActiveStagedPlacementOptions interface

func NewMockActiveStagedPlacementOptions

func NewMockActiveStagedPlacementOptions(ctrl *gomock.Controller) *MockActiveStagedPlacementOptions

NewMockActiveStagedPlacementOptions creates a new mock instance

func (*MockActiveStagedPlacementOptions) ClockOptions

ClockOptions mocks base method

func (*MockActiveStagedPlacementOptions) EXPECT

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

func (*MockActiveStagedPlacementOptions) OnPlacementsAddedFn

func (m *MockActiveStagedPlacementOptions) OnPlacementsAddedFn() OnPlacementsAddedFn

OnPlacementsAddedFn mocks base method

func (*MockActiveStagedPlacementOptions) OnPlacementsRemovedFn

func (m *MockActiveStagedPlacementOptions) OnPlacementsRemovedFn() OnPlacementsRemovedFn

OnPlacementsRemovedFn mocks base method

func (*MockActiveStagedPlacementOptions) SetClockOptions

SetClockOptions mocks base method

func (*MockActiveStagedPlacementOptions) SetOnPlacementsAddedFn

SetOnPlacementsAddedFn mocks base method

func (*MockActiveStagedPlacementOptions) SetOnPlacementsRemovedFn

SetOnPlacementsRemovedFn mocks base method

type MockActiveStagedPlacementOptionsMockRecorder

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

MockActiveStagedPlacementOptionsMockRecorder is the mock recorder for MockActiveStagedPlacementOptions

func (*MockActiveStagedPlacementOptionsMockRecorder) ClockOptions

ClockOptions indicates an expected call of ClockOptions

func (*MockActiveStagedPlacementOptionsMockRecorder) OnPlacementsAddedFn

func (mr *MockActiveStagedPlacementOptionsMockRecorder) OnPlacementsAddedFn() *gomock.Call

OnPlacementsAddedFn indicates an expected call of OnPlacementsAddedFn

func (*MockActiveStagedPlacementOptionsMockRecorder) OnPlacementsRemovedFn

func (mr *MockActiveStagedPlacementOptionsMockRecorder) OnPlacementsRemovedFn() *gomock.Call

OnPlacementsRemovedFn indicates an expected call of OnPlacementsRemovedFn

func (*MockActiveStagedPlacementOptionsMockRecorder) SetClockOptions

func (mr *MockActiveStagedPlacementOptionsMockRecorder) SetClockOptions(value interface{}) *gomock.Call

SetClockOptions indicates an expected call of SetClockOptions

func (*MockActiveStagedPlacementOptionsMockRecorder) SetOnPlacementsAddedFn

func (mr *MockActiveStagedPlacementOptionsMockRecorder) SetOnPlacementsAddedFn(value interface{}) *gomock.Call

SetOnPlacementsAddedFn indicates an expected call of SetOnPlacementsAddedFn

func (*MockActiveStagedPlacementOptionsMockRecorder) SetOnPlacementsRemovedFn

func (mr *MockActiveStagedPlacementOptionsMockRecorder) SetOnPlacementsRemovedFn(value interface{}) *gomock.Call

SetOnPlacementsRemovedFn indicates an expected call of SetOnPlacementsRemovedFn

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

func (m *MockOptions) AllowAllZones() bool

AllowAllZones mocks base method

func (*MockOptions) AllowPartialReplace

func (m *MockOptions) AllowPartialReplace() bool

AllowPartialReplace 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) 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

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) SetDryrun

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

SetDryrun 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

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) Dryrun

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

Dryrun indicates an expected call of Dryrun

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

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) SetDryrun

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

SetDryrun indicates an expected call of SetDryrun

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) 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) 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 MockStagedPlacement

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

MockStagedPlacement is a mock of StagedPlacement interface

func NewMockStagedPlacement

func NewMockStagedPlacement(ctrl *gomock.Controller) *MockStagedPlacement

NewMockStagedPlacement creates a new mock instance

func (*MockStagedPlacement) ActiveStagedPlacement

func (m *MockStagedPlacement) ActiveStagedPlacement(timeNanos int64) ActiveStagedPlacement

ActiveStagedPlacement mocks base method

func (*MockStagedPlacement) ActiveStagedPlacementOptions

func (m *MockStagedPlacement) ActiveStagedPlacementOptions() ActiveStagedPlacementOptions

ActiveStagedPlacementOptions mocks base method

func (*MockStagedPlacement) EXPECT

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

func (*MockStagedPlacement) Placements

func (m *MockStagedPlacement) Placements() Placements

Placements mocks base method

func (*MockStagedPlacement) Proto

Proto mocks base method

func (*MockStagedPlacement) SetActiveStagedPlacementOptions

func (m *MockStagedPlacement) SetActiveStagedPlacementOptions(opts ActiveStagedPlacementOptions) StagedPlacement

SetActiveStagedPlacementOptions mocks base method

func (*MockStagedPlacement) SetPlacements

func (m *MockStagedPlacement) SetPlacements(placements []Placement) StagedPlacement

SetPlacements mocks base method

func (*MockStagedPlacement) SetVersion

func (m *MockStagedPlacement) SetVersion(version int) StagedPlacement

SetVersion mocks base method

func (*MockStagedPlacement) Version

func (m *MockStagedPlacement) Version() int

Version mocks base method

type MockStagedPlacementMockRecorder

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

MockStagedPlacementMockRecorder is the mock recorder for MockStagedPlacement

func (*MockStagedPlacementMockRecorder) ActiveStagedPlacement

func (mr *MockStagedPlacementMockRecorder) ActiveStagedPlacement(timeNanos interface{}) *gomock.Call

ActiveStagedPlacement indicates an expected call of ActiveStagedPlacement

func (*MockStagedPlacementMockRecorder) ActiveStagedPlacementOptions

func (mr *MockStagedPlacementMockRecorder) ActiveStagedPlacementOptions() *gomock.Call

ActiveStagedPlacementOptions indicates an expected call of ActiveStagedPlacementOptions

func (*MockStagedPlacementMockRecorder) Placements

func (mr *MockStagedPlacementMockRecorder) Placements() *gomock.Call

Placements indicates an expected call of Placements

func (*MockStagedPlacementMockRecorder) Proto

Proto indicates an expected call of Proto

func (*MockStagedPlacementMockRecorder) SetActiveStagedPlacementOptions

func (mr *MockStagedPlacementMockRecorder) SetActiveStagedPlacementOptions(opts interface{}) *gomock.Call

SetActiveStagedPlacementOptions indicates an expected call of SetActiveStagedPlacementOptions

func (*MockStagedPlacementMockRecorder) SetPlacements

func (mr *MockStagedPlacementMockRecorder) SetPlacements(placements interface{}) *gomock.Call

SetPlacements indicates an expected call of SetPlacements

func (*MockStagedPlacementMockRecorder) SetVersion

func (mr *MockStagedPlacementMockRecorder) SetVersion(version interface{}) *gomock.Call

SetVersion indicates an expected call of SetVersion

func (*MockStagedPlacementMockRecorder) Version

Version indicates an expected call of Version

type MockStagedPlacementWatcher

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

MockStagedPlacementWatcher is a mock of StagedPlacementWatcher interface

func NewMockStagedPlacementWatcher

func NewMockStagedPlacementWatcher(ctrl *gomock.Controller) *MockStagedPlacementWatcher

NewMockStagedPlacementWatcher creates a new mock instance

func (*MockStagedPlacementWatcher) ActiveStagedPlacement

func (m *MockStagedPlacementWatcher) ActiveStagedPlacement() (ActiveStagedPlacement, DoneFn, error)

ActiveStagedPlacement mocks base method

func (*MockStagedPlacementWatcher) EXPECT

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

func (*MockStagedPlacementWatcher) Unwatch

func (m *MockStagedPlacementWatcher) Unwatch() error

Unwatch mocks base method

func (*MockStagedPlacementWatcher) Watch

func (m *MockStagedPlacementWatcher) Watch() error

Watch mocks base method

type MockStagedPlacementWatcherMockRecorder

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

MockStagedPlacementWatcherMockRecorder is the mock recorder for MockStagedPlacementWatcher

func (*MockStagedPlacementWatcherMockRecorder) ActiveStagedPlacement

func (mr *MockStagedPlacementWatcherMockRecorder) ActiveStagedPlacement() *gomock.Call

ActiveStagedPlacement indicates an expected call of ActiveStagedPlacement

func (*MockStagedPlacementWatcherMockRecorder) Unwatch

Unwatch indicates an expected call of Unwatch

func (*MockStagedPlacementWatcherMockRecorder) Watch

Watch indicates an expected call of Watch

type MockStagedPlacementWatcherOptions

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

MockStagedPlacementWatcherOptions is a mock of StagedPlacementWatcherOptions interface

func NewMockStagedPlacementWatcherOptions

func NewMockStagedPlacementWatcherOptions(ctrl *gomock.Controller) *MockStagedPlacementWatcherOptions

NewMockStagedPlacementWatcherOptions creates a new mock instance

func (*MockStagedPlacementWatcherOptions) ActiveStagedPlacementOptions

func (m *MockStagedPlacementWatcherOptions) ActiveStagedPlacementOptions() ActiveStagedPlacementOptions

ActiveStagedPlacementOptions mocks base method

func (*MockStagedPlacementWatcherOptions) ClockOptions

ClockOptions mocks base method

func (*MockStagedPlacementWatcherOptions) EXPECT

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

func (*MockStagedPlacementWatcherOptions) InitWatchTimeout

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

InitWatchTimeout mocks base method

func (*MockStagedPlacementWatcherOptions) InstrumentOptions

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

InstrumentOptions mocks base method

func (*MockStagedPlacementWatcherOptions) SetActiveStagedPlacementOptions

SetActiveStagedPlacementOptions mocks base method

func (*MockStagedPlacementWatcherOptions) SetClockOptions

SetClockOptions mocks base method

func (*MockStagedPlacementWatcherOptions) SetInitWatchTimeout

SetInitWatchTimeout mocks base method

func (*MockStagedPlacementWatcherOptions) SetInstrumentOptions

SetInstrumentOptions mocks base method

func (*MockStagedPlacementWatcherOptions) SetStagedPlacementKey

SetStagedPlacementKey mocks base method

func (*MockStagedPlacementWatcherOptions) SetStagedPlacementStore

func (m *MockStagedPlacementWatcherOptions) SetStagedPlacementStore(store kv.Store) StagedPlacementWatcherOptions

SetStagedPlacementStore mocks base method

func (*MockStagedPlacementWatcherOptions) StagedPlacementKey

func (m *MockStagedPlacementWatcherOptions) StagedPlacementKey() string

StagedPlacementKey mocks base method

func (*MockStagedPlacementWatcherOptions) StagedPlacementStore

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

StagedPlacementStore mocks base method

type MockStagedPlacementWatcherOptionsMockRecorder

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

MockStagedPlacementWatcherOptionsMockRecorder is the mock recorder for MockStagedPlacementWatcherOptions

func (*MockStagedPlacementWatcherOptionsMockRecorder) ActiveStagedPlacementOptions

func (mr *MockStagedPlacementWatcherOptionsMockRecorder) ActiveStagedPlacementOptions() *gomock.Call

ActiveStagedPlacementOptions indicates an expected call of ActiveStagedPlacementOptions

func (*MockStagedPlacementWatcherOptionsMockRecorder) ClockOptions

ClockOptions indicates an expected call of ClockOptions

func (*MockStagedPlacementWatcherOptionsMockRecorder) InitWatchTimeout

InitWatchTimeout indicates an expected call of InitWatchTimeout

func (*MockStagedPlacementWatcherOptionsMockRecorder) InstrumentOptions

InstrumentOptions indicates an expected call of InstrumentOptions

func (*MockStagedPlacementWatcherOptionsMockRecorder) SetActiveStagedPlacementOptions

func (mr *MockStagedPlacementWatcherOptionsMockRecorder) SetActiveStagedPlacementOptions(value interface{}) *gomock.Call

SetActiveStagedPlacementOptions indicates an expected call of SetActiveStagedPlacementOptions

func (*MockStagedPlacementWatcherOptionsMockRecorder) SetClockOptions

func (mr *MockStagedPlacementWatcherOptionsMockRecorder) SetClockOptions(value interface{}) *gomock.Call

SetClockOptions indicates an expected call of SetClockOptions

func (*MockStagedPlacementWatcherOptionsMockRecorder) SetInitWatchTimeout

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

SetInitWatchTimeout indicates an expected call of SetInitWatchTimeout

func (*MockStagedPlacementWatcherOptionsMockRecorder) SetInstrumentOptions

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

SetInstrumentOptions indicates an expected call of SetInstrumentOptions

func (*MockStagedPlacementWatcherOptionsMockRecorder) SetStagedPlacementKey

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

SetStagedPlacementKey indicates an expected call of SetStagedPlacementKey

func (*MockStagedPlacementWatcherOptionsMockRecorder) SetStagedPlacementStore

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

SetStagedPlacementStore indicates an expected call of SetStagedPlacementStore

func (*MockStagedPlacementWatcherOptionsMockRecorder) StagedPlacementKey

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

StagedPlacementKey indicates an expected call of StagedPlacementKey

func (*MockStagedPlacementWatcherOptionsMockRecorder) StagedPlacementStore

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

StagedPlacementStore indicates an expected call of StagedPlacementStore

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 OnPlacementsAddedFn

type OnPlacementsAddedFn func(placements []Placement)

OnPlacementsAddedFn is called when placements are added.

type OnPlacementsRemovedFn

type OnPlacementsRemovedFn func(placements []Placement)

OnPlacementsRemovedFn is called when placements are removed.

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

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

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

	// ShardsLen 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 retreived 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 []Placement

Placements represents a list of placements.

func NewPlacementsFromProto

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

NewPlacementsFromProto creates a list of placements from proto.

func (Placements) ActiveIndex

func (placements Placements) ActiveIndex(timeNanos int64) int

ActiveIndex finds the index of the last placement whose cutover time is no later than timeNanos (a.k.a. the active placement). Assuming the cutover times of the placements are sorted in ascending order (i.e., earliest time first).

func (Placements) Proto

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

Proto converts a list of Placement to a proto.

type Service

type Service interface {
	Storage

	// BuildInitialPlacement initialize a placement.
	BuildInitialPlacement(instances []Instance, numShards int, rf int) (Placement, error)

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

	// AddInstances adds instances from the candidate list to the placement.
	AddInstances(candidates []Instance) (newPlacement Placement, addedInstances []Instance, err error)

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

	// ReplaceInstances picks instances from the candidate list to replace instances in current placement.
	ReplaceInstances(
		leavingInstanceIDs []string,
		candidates []Instance,
	) (
		newPlacement Placement,
		usedInstances []Instance,
		err error,
	)

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

	// MarkInstanceAvailable marks all the shards on a given instance as available.
	MarkInstanceAvailable(instanceID string) (Placement, error)

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

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 StagedPlacement

type StagedPlacement interface {
	// ActiveStagedPlacement returns the active staged placement for a given time.
	ActiveStagedPlacement(timeNanos int64) ActiveStagedPlacement

	// Version returns the version of the staged placement.
	Version() int

	// SetVersion sets the version of the staged placement.
	SetVersion(version int) StagedPlacement

	// Placements return the placements in the staged placement.
	Placements() Placements

	// SetPlacements sets the placements in the staged placement.
	SetPlacements(placements []Placement) StagedPlacement

	// ActiveStagedPlacementOptions returns the active staged placement options.
	ActiveStagedPlacementOptions() ActiveStagedPlacementOptions

	// SetActiveStagedPlacementOptions sets the active staged placement options.
	SetActiveStagedPlacementOptions(opts ActiveStagedPlacementOptions) StagedPlacement

	// Proto returns the proto representation for the StagedPlacement.
	Proto() (*placementpb.PlacementSnapshots, error)
}

StagedPlacement describes a series of placements applied in staged fashion.

func NewStagedPlacement

func NewStagedPlacement() StagedPlacement

NewStagedPlacement creates an empty staged placement.

func NewStagedPlacementFromProto

func NewStagedPlacementFromProto(
	version int,
	p *placementpb.PlacementSnapshots,
	opts ActiveStagedPlacementOptions,
) (StagedPlacement, error)

NewStagedPlacementFromProto creates a new staged placement from proto.

type StagedPlacementWatcher

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

	// ActiveStagedPlacement returns the currently active staged placement, the
	// callback function when the caller is done using the active staged placement,
	// and any errors encountered.
	ActiveStagedPlacement() (ActiveStagedPlacement, DoneFn, error)

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

StagedPlacementWatcher watches for updates to staged placement.

func NewStagedPlacementWatcher

func NewStagedPlacementWatcher(opts StagedPlacementWatcherOptions) StagedPlacementWatcher

NewStagedPlacementWatcher creates a new staged placement watcher.

type StagedPlacementWatcherOptions

type StagedPlacementWatcherOptions interface {
	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) StagedPlacementWatcherOptions

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) StagedPlacementWatcherOptions

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

	// SetActiveStagedPlacementOptions sets the active staged placement options.
	SetActiveStagedPlacementOptions(value ActiveStagedPlacementOptions) StagedPlacementWatcherOptions

	// ActiveStagedPlacementOptions returns the active staged placement options.
	ActiveStagedPlacementOptions() ActiveStagedPlacementOptions

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

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

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

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

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

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

StagedPlacementWatcherOptions provide a set of staged placement watcher options.

func NewStagedPlacementWatcherOptions

func NewStagedPlacementWatcherOptions() StagedPlacementWatcherOptions

NewStagedPlacementWatcherOptions create a new set of topology options.

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 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,
) StagedPlacementWatcherOptions

NewOptions creates a placement watcher option.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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