coordinator

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeNumberNotEnough = coderr.NewCodeError(coderr.Internal, "node number not enough")
	ErrPickNode            = coderr.NewCodeError(coderr.Internal, "no node is picked")
)

Functions

This section is empty.

Types

type ConsistentHashNodePicker added in v1.2.0

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

func (*ConsistentHashNodePicker) PickNode added in v1.2.0

type CreatePartitionTableRequest added in v1.0.0

type CreatePartitionTableRequest struct {
	ClusterMetadata *metadata.ClusterMetadata
	SourceReq       *metaservicepb.CreateTableRequest

	PartitionTableRatioOfNodes float32

	OnSucceeded func(metadata.CreateTableResult) error
	OnFailed    func(error) error
}

type CreateTableRequest added in v1.0.0

type CreateTableRequest struct {
	ClusterMetadata *metadata.ClusterMetadata
	SourceReq       *metaservicepb.CreateTableRequest

	OnSucceeded func(metadata.CreateTableResult) error
	OnFailed    func(error) error
}

type DropTableRequest added in v1.0.0

type DropTableRequest struct {
	ClusterMetadata *metadata.ClusterMetadata
	ClusterSnapshot metadata.Snapshot
	SourceReq       *metaservicepb.DropTableRequest

	OnSucceeded func(metadata.TableInfo) error
	OnFailed    func(error) error
}

func (DropTableRequest) IsPartitionTable added in v1.0.0

func (d DropTableRequest) IsPartitionTable() bool

type Factory added in v1.0.0

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

func NewFactory added in v1.0.0

func NewFactory(allocator id.Allocator, dispatch eventdispatch.Dispatch, storage procedure.Storage) *Factory

func (*Factory) CreateDropTableProcedure added in v1.0.0

func (f *Factory) CreateDropTableProcedure(ctx context.Context, request DropTableRequest) (procedure.Procedure, error)

func (*Factory) CreateSplitProcedure added in v1.0.0

func (f *Factory) CreateSplitProcedure(ctx context.Context, request SplitRequest) (procedure.Procedure, error)

func (*Factory) CreateTransferLeaderProcedure added in v1.0.0

func (f *Factory) CreateTransferLeaderProcedure(ctx context.Context, request TransferLeaderRequest) (procedure.Procedure, error)

func (*Factory) MakeCreateTableProcedure added in v1.0.0

func (f *Factory) MakeCreateTableProcedure(ctx context.Context, request CreateTableRequest) (procedure.Procedure, error)

type NodePicker added in v1.2.0

type NodePicker interface {
	PickNode(ctx context.Context, shardID storage.ShardID, registerNodes []metadata.RegisteredNode) (metadata.RegisteredNode, error)
}

func NewConsistentHashNodePicker added in v1.2.0

func NewConsistentHashNodePicker(logger *zap.Logger, hashReplicas int) NodePicker

type RandomBalancedShardPicker added in v1.0.0

type RandomBalancedShardPicker struct{}

RandomBalancedShardPicker randomly pick up shards that are not on the same node in the current cluster.

func (*RandomBalancedShardPicker) PickShards added in v1.0.0

func (p *RandomBalancedShardPicker) PickShards(_ context.Context, snapshot metadata.Snapshot, expectShardNum int) ([]storage.ShardNode, error)

PickShards will pick a specified number of shards as expectShardNum.

type ShardPicker added in v1.0.0

type ShardPicker interface {
	PickShards(ctx context.Context, snapshot metadata.Snapshot, expectShardNum int) ([]storage.ShardNode, error)
}

ShardPicker is used to pick up the shards suitable for scheduling in the cluster. If expectShardNum bigger than cluster node number, the result depends on enableDuplicateNode: TODO: Consider refactor this interface, abstracts the parameters of PickShards as PickStrategy.

func NewRandomBalancedShardPicker added in v1.0.0

func NewRandomBalancedShardPicker() ShardPicker

type SplitRequest added in v1.0.0

type SplitRequest struct {
	ClusterMetadata *metadata.ClusterMetadata
	SchemaName      string
	TableNames      []string
	Snapshot        metadata.Snapshot
	ShardID         storage.ShardID
	NewShardID      storage.ShardID
	TargetNodeName  string
}

type TransferLeaderRequest added in v1.0.0

type TransferLeaderRequest struct {
	Snapshot          metadata.Snapshot
	ShardID           storage.ShardID
	OldLeaderNodeName string
	NewLeaderNodeName string
}

Jump to

Keyboard shortcuts

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