mock

package
v1.1.0-beta.0...-d5b6b69 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBSourceData

type DBSourceData struct {
	Name   string
	Tables map[string]*TableSourceData
}

DBSourceData defines a mock source information for a database.

type ImportSource

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

ImportSource defines a mock import source

func NewImportSource

func NewImportSource(dbSrcDataMap map[string]*DBSourceData) (*ImportSource, error)

NewImportSource creates a ImportSource object.

func (*ImportSource) GetAllDBFileMetas

func (m *ImportSource) GetAllDBFileMetas() []*mydump.MDDatabaseMeta

GetAllDBFileMetas gets all the Mydumper database metadatas on the mock source.

func (*ImportSource) GetDBMetaMap

func (m *ImportSource) GetDBMetaMap() map[string]*mydump.MDDatabaseMeta

GetDBMetaMap gets the Mydumper database metadata map on the mock source.

func (*ImportSource) GetStorage

func (m *ImportSource) GetStorage() storage.ExternalStorage

GetStorage gets the External Storage object on the mock source.

type SourceFile

type SourceFile struct {
	FileName  string
	Data      []byte
	TotalSize int
}

SourceFile defines a mock source file.

type StorageInfo

type StorageInfo struct {
	TotalSize     uint64
	UsedSize      uint64
	AvailableSize uint64
	RegionCount   int
}

StorageInfo defines the storage information for a mock target.

type TableInfo

type TableInfo struct {
	RowCount   int
	TableModel *model.TableInfo
}

TableInfo defines a mock table structure information for a mock target.

type TableSourceData

type TableSourceData struct {
	DBName     string
	TableName  string
	SchemaFile *SourceFile
	DataFiles  []*SourceFile
}

TableSourceData defines a mock source information for a table.

type TargetInfo

type TargetInfo struct {
	MaxReplicasPerRegion int
	EmptyRegionCountMap  map[uint64]int
	StorageInfos         []StorageInfo
	// contains filtered or unexported fields
}

TargetInfo defines a mock target information.

func NewTargetInfo

func NewTargetInfo() *TargetInfo

NewTargetInfo creates a TargetInfo object.

func (*TargetInfo) CheckVersionRequirements

func (*TargetInfo) CheckVersionRequirements(_ context.Context) error

CheckVersionRequirements performs the check whether the target satisfies the version requirements. It implements the TargetInfoGetter interface.

func (*TargetInfo) FetchRemoteDBModels

func (t *TargetInfo) FetchRemoteDBModels(_ context.Context) ([]*model.DBInfo, error)

FetchRemoteDBModels implements the TargetInfoGetter interface.

func (*TargetInfo) FetchRemoteTableModels

func (t *TargetInfo) FetchRemoteTableModels(
	_ context.Context,
	schemaName string,
	tableNames []string,
) (map[string]*model.TableInfo, error)

FetchRemoteTableModels fetches the table structures from the remote target. It implements the TargetInfoGetter interface.

func (*TargetInfo) GetEmptyRegionsInfo

func (t *TargetInfo) GetEmptyRegionsInfo(_ context.Context) (*pdhttp.RegionsInfo, error)

GetEmptyRegionsInfo gets the region information of all the empty regions on the target. It implements the TargetInfoGetter interface.

func (*TargetInfo) GetMaxReplica

func (t *TargetInfo) GetMaxReplica(context.Context) (uint64, error)

GetMaxReplica implements the TargetInfoGetter interface.

func (*TargetInfo) GetStorageInfo

func (t *TargetInfo) GetStorageInfo(_ context.Context) (*pdhttp.StoresInfo, error)

GetStorageInfo gets the storage information on the target. It implements the TargetInfoGetter interface.

func (*TargetInfo) GetTargetSysVariablesForImport

func (t *TargetInfo) GetTargetSysVariablesForImport(_ context.Context, _ ...ropts.GetPreInfoOption) map[string]string

GetTargetSysVariablesForImport gets some important systam variables for importing on the target. It implements the TargetInfoGetter interface.

func (*TargetInfo) IsTableEmpty

func (t *TargetInfo) IsTableEmpty(_ context.Context, schemaName string, tableName string) (*bool, error)

IsTableEmpty checks whether the specified table on the target DB contains data or not. It implements the TargetInfoGetter interface.

func (*TargetInfo) SetSysVar

func (t *TargetInfo) SetSysVar(key string, value string)

SetSysVar sets the system variables of the mock target.

func (*TargetInfo) SetTableInfo

func (t *TargetInfo) SetTableInfo(schemaName string, tableName string, tblInfo *TableInfo)

SetTableInfo sets the table structure information of the mock target.

Jump to

Keyboard shortcuts

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