Documentation
¶
Index ¶
- Variables
- func GetPartitionTableName(tableName string, partitionName string) string
- type Config
- type PartitionService
- type PartitionStorage
- type PruneResult
- type Service
- func (s *Service) AddPartitions(ctx context.Context, tableID uint64, partitions []*tree.Partition, ...) error
- func (s *Service) Create(ctx context.Context, tableID uint64, stmt *tree.CreateTable, ...) error
- func (s *Service) Delete(ctx context.Context, tableID uint64, txnOp client.TxnOperator) error
- func (s *Service) DropPartitions(ctx context.Context, tableID uint64, partitions []string, ...) error
- func (s *Service) Enabled() bool
- func (s *Service) GetPartitionMetadata(ctx context.Context, tableID uint64, txnOp client.TxnOperator) (partition.PartitionMetadata, error)
- func (s *Service) GetStorage() PartitionStorage
- func (s *Service) Redefine(ctx context.Context, tableID uint64, stmt *tree.PartitionOption, ...) error
- func (s *Service) Rename(ctx context.Context, tableID uint64, oldName, newName string, ...) error
- func (s *Service) TruncatePartitions(ctx context.Context, tableID uint64, partitions []string, ...) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PartitionTableMetadataSQL = fmt.Sprintf(`create table %s.%s( table_id bigint unsigned primary key not null, table_name varchar(500) not null, database_name varchar(500) not null, partition_method varchar(13) not null, partition_description text not null, partition_count int unsigned )`, catalog.MO_CATALOG, catalog.MOPartitionMetadata) PartitionTablesSQL = fmt.Sprintf(`create table %s.%s( partition_id bigint unsigned not null, partition_table_name varchar(200) not null, primary_table_id bigint unsigned not null, partition_name varchar(50) not null, partition_ordinal_position int unsigned not null, partition_expression_str varchar(2048) not null, partition_expression varchar(2048) not null )`, catalog.MO_CATALOG, catalog.MOPartitionTables) InitSQLs = []string{ PartitionTablesSQL, PartitionTableMetadataSQL, } )
View Source
var (
DisabledService = NewService(Config{}, nil)
)
Functions ¶
func GetPartitionTableName ¶
Types ¶
type Config ¶
type Config struct {
// ServiceID service id
ServiceID string `toml:"-"`
// Disable disable partition service
Disable bool `toml:"disable"`
}
Config partition service
type PartitionService ¶
type PartitionService interface {
Create(
ctx context.Context,
tableID uint64,
stmt *tree.CreateTable,
txnOp client.TxnOperator,
) error
Redefine(
ctx context.Context,
tableID uint64,
stmt *tree.PartitionOption,
txnOp client.TxnOperator,
) error
Rename(
ctx context.Context,
tableID uint64,
oldName, newName string,
txnOp client.TxnOperator,
) error
Delete(
ctx context.Context,
tableID uint64,
txnOp client.TxnOperator,
) error
AddPartitions(
ctx context.Context,
tableID uint64,
partitions []*tree.Partition,
partitionDefs []*plan.PartitionDef,
txnOp client.TxnOperator,
) error
DropPartitions(
ctx context.Context,
tableID uint64,
partitions []string,
txnOp client.TxnOperator,
) error
TruncatePartitions(
ctx context.Context,
tableID uint64,
partitions []string,
txnOp client.TxnOperator,
) error
GetPartitionMetadata(
ctx context.Context,
tableID uint64,
txnOp client.TxnOperator,
) (partition.PartitionMetadata, error)
GetStorage() PartitionStorage
Enabled() bool
}
PartitionService is used to maintaining the metadata of the partition table.
func GetService ¶
func GetService( sid string, ) PartitionService
type PartitionStorage ¶
type PartitionStorage interface {
GetMetadata(
ctx context.Context,
tableID uint64,
txnOp client.TxnOperator,
) (partition.PartitionMetadata, bool, error)
Create(
ctx context.Context,
def *plan.TableDef,
stmt *tree.CreateTable,
metadata partition.PartitionMetadata,
txnOp client.TxnOperator,
) error
Redefine(
ctx context.Context,
def *plan.TableDef,
options *tree.PartitionOption,
metadata partition.PartitionMetadata,
txnOp client.TxnOperator,
) error
Rename(
ctx context.Context,
def *plan.TableDef,
oldName, newName string,
metadata partition.PartitionMetadata,
txnOp client.TxnOperator,
) error
AddPartitions(
ctx context.Context,
def *plan.TableDef,
metadata partition.PartitionMetadata,
partitions []partition.Partition,
txnOp client.TxnOperator,
) error
DropPartitions(
ctx context.Context,
def *plan.TableDef,
metadata partition.PartitionMetadata,
partitions []string,
txnOp client.TxnOperator,
) error
TruncatePartitions(
ctx context.Context,
def *plan.TableDef,
metadata partition.PartitionMetadata,
partitions []string,
txnOp client.TxnOperator,
) error
Delete(
ctx context.Context,
metadata partition.PartitionMetadata,
txnOp client.TxnOperator,
) error
GetTableDef(
ctx context.Context,
tableID uint64,
txnOp client.TxnOperator,
) (*plan.TableDef, error)
}
func NewStorage ¶
func NewStorage( sid string, exec executor.SQLExecutor, eng engine.Engine, ) PartitionStorage
type PruneResult ¶
type PruneResult struct {
// contains filtered or unexported fields
}
func NewPruneResult ¶
func NewPruneResult(bats []*batch.Batch, partitions []partition.Partition) PruneResult
func (PruneResult) Close ¶
func (res PruneResult) Close()
func (PruneResult) Empty ¶
func (res PruneResult) Empty() bool
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService( cfg Config, store PartitionStorage, ) *Service
func (*Service) AddPartitions ¶
func (*Service) Create ¶
func (s *Service) Create( ctx context.Context, tableID uint64, stmt *tree.CreateTable, txnOp client.TxnOperator, ) error
func (*Service) DropPartitions ¶
func (*Service) GetPartitionMetadata ¶
func (s *Service) GetPartitionMetadata( ctx context.Context, tableID uint64, txnOp client.TxnOperator, ) (partition.PartitionMetadata, error)
func (*Service) GetStorage ¶
func (s *Service) GetStorage() PartitionStorage
func (*Service) Redefine ¶
func (s *Service) Redefine( ctx context.Context, tableID uint64, stmt *tree.PartitionOption, txnOp client.TxnOperator, ) error
func (*Service) TruncatePartitions ¶
Click to show internal directories.
Click to hide internal directories.