coordinator

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 18 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 BatchRequest added in v1.2.4

type BatchRequest struct {
	Batch     []procedure.Procedure
	BatchType procedure.Typ
}

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) CreateBatchTransferLeaderProcedure added in v1.2.4

func (f *Factory) CreateBatchTransferLeaderProcedure(ctx context.Context, request BatchRequest) (procedure.Procedure, error)

func (*Factory) CreateDropTableProcedure added in v1.0.0

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

CreateDropTableProcedure creates a procedure to do drop table.

And if no error is thrown, the returned boolean value is used to tell whether the procedure is created. In some cases, e.g. the table doesn't exist, it should not be an error and false will be returned.

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 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 NewLeastTableShardPicker added in v1.2.7

func NewLeastTableShardPicker() 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
}

Directories

Path Synopsis
ddl
nodepicker/hash
Package hash provides a consistent hashing function with bounded loads.
Package hash provides a consistent hashing function with bounded loads.

Jump to

Keyboard shortcuts

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