coordinator

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePartitionTableRequest added in v1.0.0

type CreatePartitionTableRequest struct {
	Cluster   *cluster.Cluster
	SourceReq *metaservicepb.CreateTableRequest

	PartitionTableRatioOfNodes float32

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

type CreateTableRequest added in v1.0.0

type CreateTableRequest struct {
	Cluster   *cluster.Cluster
	SourceReq *metaservicepb.CreateTableRequest

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

type DropTableRequest added in v1.0.0

type DropTableRequest struct {
	Cluster   *cluster.Cluster
	SourceReq *metaservicepb.DropTableRequest

	OnSucceeded func(cluster.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, manager cluster.Manager, partitionTableProportionOfNodes float32) *Factory

func (*Factory) CreateDropTableProcedure added in v1.0.0

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

func (*Factory) CreateScatterProcedure added in v1.0.0

func (f *Factory) CreateScatterProcedure(ctx context.Context, request ScatterRequest) (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 RandomBalancedShardPicker added in v1.0.0

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

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(ctx context.Context, clusterName string, expectShardNum int, enableDuplicateNode bool) ([]cluster.ShardNodeWithVersion, error)

PickShards will pick a specified number of shards as expectShardNum.

type ScatterRequest added in v1.0.0

type ScatterRequest struct {
	Cluster  *cluster.Cluster
	ShardIDs []storage.ShardID
}

type Scheduler

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

func NewScheduler

func NewScheduler(clusterManager cluster.Manager, procedureManager procedure.Manager, procedureFactory *Factory, dispatch eventdispatch.Dispatch) *Scheduler

func (*Scheduler) ProcessHeartbeat

func (s *Scheduler) ProcessHeartbeat(_ context.Context, _ *metaservicepb.NodeInfo)

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context) error

func (*Scheduler) Stop

func (s *Scheduler) Stop(_ context.Context) error

type ShardPicker added in v1.0.0

type ShardPicker interface {
	PickShards(ctx context.Context, clusterName string, expectShardNum int, enableDuplicateNode bool) ([]cluster.ShardNodeWithVersion, 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: If enableDuplicateNode is false, pick shards will be failed and return error. If enableDuplicateNode is true, pick shard will return shards on the same node. TODO: Consider refactor this interface, abstracts the parameters of PickShards as PickStrategy.

func NewRandomBalancedShardPicker added in v1.0.0

func NewRandomBalancedShardPicker(manager cluster.Manager) ShardPicker

type SplitRequest added in v1.0.0

type SplitRequest struct {
	ClusterName    string
	SchemaName     string
	TableNames     []string
	ShardID        storage.ShardID
	NewShardID     storage.ShardID
	TargetNodeName string
	ClusterVersion uint64
}

type TransferLeaderRequest added in v1.0.0

type TransferLeaderRequest struct {
	ClusterName       string
	ShardID           storage.ShardID
	OldLeaderNodeName string
	NewLeaderNodeName string
	ClusterVersion    uint64
}

Jump to

Keyboard shortcuts

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