Documentation
¶
Index ¶
- Constants
- Variables
- type CreateTableProcedure
- type CreateTableRequest
- type DropTableProcedure
- type DropTableRequest
- type EtcdStorageImpl
- type Factory
- func (f *Factory) CreateCreateTableProcedure(ctx context.Context, request *CreateTableRequest) (Procedure, error)
- func (f *Factory) CreateDropTableProcedure(ctx context.Context, request *DropTableRequest) (Procedure, error)
- func (f *Factory) CreateScatterProcedure(ctx context.Context, request *ScatterRequest) (Procedure, error)
- type Info
- type Manager
- type ManagerImpl
- func (m *ManagerImpl) Cancel(ctx context.Context, procedureID uint64) error
- func (m *ManagerImpl) ListRunningProcedure(_ context.Context) ([]*Info, error)
- func (m *ManagerImpl) Start(ctx context.Context) error
- func (m *ManagerImpl) Stop(ctx context.Context) error
- func (m *ManagerImpl) Submit(_ context.Context, procedure Procedure) error
- type Meta
- type Procedure
- func NewCreateTableProcedure(dispatch eventdispatch.Dispatch, cluster *cluster.Cluster, id uint64, ...) Procedure
- func NewDropTableProcedure(dispatch eventdispatch.Dispatch, cluster *cluster.Cluster, id uint64, ...) Procedure
- func NewScatterProcedure(dispatch eventdispatch.Dispatch, cluster *cluster.Cluster, id uint64, ...) Procedure
- type ScatterCallbackRequest
- type ScatterProcedure
- type ScatterRequest
- type State
- type Storage
- type Typ
- type Write
Constants ¶
View Source
const ( StateInit = "init" StateRunning = "running" StateFinished = "finished" StateFailed = "failed" StateCancelled = "cancelled" )
View Source
const ( Version = "v1" PathProcedure = "procedure" PathDeletedProcedure = "deletedProcedure" )
Variables ¶
View Source
var ( ErrShardLeaderNotFound = coderr.NewCodeError(coderr.Internal, "shard leader not found") ErrProcedureNotFound = coderr.NewCodeError(coderr.Internal, "procedure not found") ErrClusterConfigChanged = coderr.NewCodeError(coderr.Internal, "cluster config changed") ErrTableAlreadyExists = coderr.NewCodeError(coderr.Internal, "table already exists") )
Functions ¶
This section is empty.
Types ¶
type CreateTableProcedure ¶
type CreateTableProcedure struct {
// contains filtered or unexported fields
}
func (*CreateTableProcedure) Cancel ¶
func (p *CreateTableProcedure) Cancel(_ context.Context) error
func (*CreateTableProcedure) ID ¶
func (p *CreateTableProcedure) ID() uint64
func (*CreateTableProcedure) Start ¶
func (p *CreateTableProcedure) Start(ctx context.Context) error
func (*CreateTableProcedure) State ¶
func (p *CreateTableProcedure) State() State
func (*CreateTableProcedure) Typ ¶
func (p *CreateTableProcedure) Typ() Typ
type CreateTableRequest ¶
type CreateTableRequest struct {
Cluster *cluster.Cluster
SourceReq *metaservicepb.CreateTableRequest
OnSucceeded func(*cluster.CreateTableResult) error
OnFailed func(error) error
}
type DropTableProcedure ¶
type DropTableProcedure struct {
// contains filtered or unexported fields
}
func (*DropTableProcedure) ID ¶
func (p *DropTableProcedure) ID() uint64
func (*DropTableProcedure) State ¶
func (p *DropTableProcedure) State() State
func (*DropTableProcedure) Typ ¶
func (p *DropTableProcedure) Typ() Typ
type DropTableRequest ¶
type DropTableRequest struct {
Cluster *cluster.Cluster
SourceReq *metaservicepb.DropTableRequest
OnSucceeded func(*cluster.TableInfo) error
OnFailed func(error) error
}
type EtcdStorageImpl ¶
type EtcdStorageImpl struct {
// contains filtered or unexported fields
}
func (EtcdStorageImpl) CreateOrUpdate ¶
func (e EtcdStorageImpl) CreateOrUpdate(ctx context.Context, meta *Meta) error
CreateOrUpdate example: /{rootPath}/v1/procedure/{procedureID} -> {procedureType} + {procedureState} + {data}
func (EtcdStorageImpl) MarkDeleted ¶
func (e EtcdStorageImpl) MarkDeleted(ctx context.Context, id uint64) error
MarkDeleted Do a soft deletion, and the deleted key's format is: /{rootPath}/v1/historyProcedure/{clusterID}/{procedureID}
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func NewFactory(allocator id.Allocator, dispatch eventdispatch.Dispatch) *Factory
func (*Factory) CreateCreateTableProcedure ¶
func (*Factory) CreateDropTableProcedure ¶
func (*Factory) CreateScatterProcedure ¶
type Manager ¶
type Manager interface {
// Start must be called before manager is used.
Start(ctx context.Context) error
// Stop must be called before manager is dropped.
Stop(ctx context.Context) error
// Submit procedure to be executed asynchronously.
// TODO: change result type, add channel to get whether the procedure executed successfully
Submit(ctx context.Context, procedure Procedure) error
// Cancel procedure that has been submitted.
Cancel(ctx context.Context, procedureID uint64) error
ListRunningProcedure(ctx context.Context) ([]*Info, error)
}
type ManagerImpl ¶
type ManagerImpl struct {
// contains filtered or unexported fields
}
func (*ManagerImpl) Cancel ¶
func (m *ManagerImpl) Cancel(ctx context.Context, procedureID uint64) error
func (*ManagerImpl) ListRunningProcedure ¶
func (m *ManagerImpl) ListRunningProcedure(_ context.Context) ([]*Info, error)
type Procedure ¶
type Procedure interface {
// ID of the procedure.
ID() uint64
// Typ of the procedure.
Typ() Typ
// Start the procedure.
Start(ctx context.Context) error
// Cancel the procedure.
Cancel(ctx context.Context) error
// State of the procedure. Retrieve the state of this procedure.
State() State
}
Procedure is used to describe how to execute a set of operations from the scheduler, e.g. SwitchLeaderProcedure, MergeShardProcedure.
func NewCreateTableProcedure ¶
func NewCreateTableProcedure(dispatch eventdispatch.Dispatch, cluster *cluster.Cluster, id uint64, req *metaservicepb.CreateTableRequest, onSucceeded func(*cluster.CreateTableResult) error, onFailed func(error) error) Procedure
func NewDropTableProcedure ¶
func NewDropTableProcedure(dispatch eventdispatch.Dispatch, cluster *cluster.Cluster, id uint64, req *metaservicepb.DropTableRequest, onSucceeded func(*cluster.TableInfo) error, onFailed func(error) error) Procedure
func NewScatterProcedure ¶
type ScatterCallbackRequest ¶
type ScatterCallbackRequest struct {
// contains filtered or unexported fields
}
ScatterCallbackRequest is fsm callbacks param.
type ScatterProcedure ¶
type ScatterProcedure struct {
// contains filtered or unexported fields
}
func (*ScatterProcedure) ID ¶
func (p *ScatterProcedure) ID() uint64
func (*ScatterProcedure) State ¶
func (p *ScatterProcedure) State() State
func (*ScatterProcedure) Typ ¶
func (p *ScatterProcedure) Typ() Typ
type ScatterRequest ¶
type Storage ¶
Click to show internal directories.
Click to hide internal directories.