mock

package
v7.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockDBSourceData

type MockDBSourceData struct {
	Name   string
	Tables map[string]*MockTableSourceData
}

MockDBSourceData defines a mock source information for a database.

type MockImportSource

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

MockImportSource defines a mock import source

func NewMockImportSource

func NewMockImportSource(dbSrcDataMap map[string]*MockDBSourceData) (*MockImportSource, error)

NewMockImportSource creates a MockImportSource object.

func (*MockImportSource) GetAllDBFileMetas

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

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

func (*MockImportSource) GetDBMetaMap

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

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

func (*MockImportSource) GetStorage

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

GetStorage gets the External Storage object on the mock source.

type MockSourceFile

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

MockSourceFile defines a mock source file.

type MockTableInfo

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

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

type MockTableSourceData

type MockTableSourceData struct {
	DBName     string
	TableName  string
	SchemaFile *MockSourceFile
	DataFiles  []*MockSourceFile
}

MockTableSourceData defines a mock source information for a table.

type MockTargetInfo

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

MockTableInfo defines a mock target information.

func NewMockTargetInfo

func NewMockTargetInfo() *MockTargetInfo

NewMockTargetInfo creates a MockTargetInfo object.

func (*MockTargetInfo) CheckVersionRequirements

func (t *MockTargetInfo) CheckVersionRequirements(ctx context.Context) error

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

func (*MockTargetInfo) FetchRemoteTableModels

func (t *MockTargetInfo) FetchRemoteTableModels(ctx context.Context, schemaName string) ([]*model.TableInfo, error)

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

func (*MockTargetInfo) GetEmptyRegionsInfo

func (t *MockTargetInfo) GetEmptyRegionsInfo(ctx context.Context) (*pdtypes.RegionsInfo, error)

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

func (*MockTargetInfo) GetReplicationConfig

func (t *MockTargetInfo) GetReplicationConfig(ctx context.Context) (*pdtypes.ReplicationConfig, error)

GetReplicationConfig gets the replication config on the target. It implements the TargetInfoGetter interface.

func (*MockTargetInfo) GetStorageInfo

func (t *MockTargetInfo) GetStorageInfo(ctx context.Context) (*pdtypes.StoresInfo, error)

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

func (*MockTargetInfo) GetTargetSysVariablesForImport

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

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

func (*MockTargetInfo) IsTableEmpty

func (t *MockTargetInfo) IsTableEmpty(ctx 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 (*MockTargetInfo) SetSysVar

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

SetSysVar sets the system variables of the mock target.

func (*MockTargetInfo) SetTableInfo

func (t *MockTargetInfo) SetTableInfo(schemaName string, tableName string, tblInfo *MockTableInfo)

SetTableInfo sets the table structure information of the mock target.

type StorageInfo

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

StorageInfo defines the storage information for a mock target.

Jump to

Keyboard shortcuts

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