Documentation
¶
Overview ¶
TODO:(searce) Organize code in go style format to make this file more readable.
public constants first key public type definitions next (although often it makes sense to put them next to public functions that use them) then public functions (and relevant type definitions) and helper functions and other non-public definitions last (generally in order of importance)
Index ¶
- func ConnectionConfig(sourceProfile profiles.SourceProfile) (interface{}, error)
- func ReadSessionFile(conv *internal.Conv, sessionJSON string) error
- func ValidateTables(ctx context.Context, client *sp.Client, spDialect string) (string, error)
- func WriteBadData(bw *writer.BatchWriter, conv *internal.Conv, banner, name string, out *os.File)
- func WriteConvGeneratedFiles(conv *internal.Conv, dbName string, driver string, BytesRead int64, ...) (string, error)
- func WriteOverridesFile(conv *internal.Conv, name string, out *os.File)
- func WriteSchemaFile(conv *internal.Conv, now time.Time, name string, out *os.File, driver string)
- func WriteSessionFile(conv *internal.Conv, name string, out *os.File)
- type ConnectionProfile
- type ConnectionProfileReq
- type ConvImpl
- type ConvInterface
- type DataFromDatabaseImpl
- type DataFromDatabaseInterface
- type DataFromSourceImpl
- type DataFromSourceInterface
- type GetInfoImpl
- type GetInfoInterface
- type MockDataFromSource
- type MockGetInfo
- type MockProcessDumpByDialect
- type MockResourceGeneration
- func (mrg *MockResourceGeneration) GetConnectionProfilesForResources(ctx context.Context, projectId string, sourceProfile profiles.SourceProfile, ...) ([]*ConnectionProfileReq, []*ConnectionProfileReq, error)
- func (mrg *MockResourceGeneration) PrepareMinimalDowntimeResources(createResourceData *ConnectionProfileReq, mutex *sync.Mutex) task.TaskResult[*ConnectionProfileReq]
- func (mrg *MockResourceGeneration) RollbackResourceCreation(ctx context.Context, profiles []*ConnectionProfileReq) error
- type MockSchemaFromSource
- type MockValidateOrCreateResources
- type MockValidateResources
- type PopulateDataConvImpl
- type PopulateDataConvInterface
- type ProcessDumpByDialectImpl
- type ProcessDumpByDialectInterface
- type ReportImpl
- type ReportInterface
- type SchemaFromSourceImpl
- type SchemaFromSourceInterface
- type SnapshotMigrationImpl
- type SnapshotMigrationInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectionConfig ¶
func ConnectionConfig(sourceProfile profiles.SourceProfile) (interface{}, error)
func ReadSessionFile ¶
ReadSessionFile reads a session JSON file and unmarshal it's content into *internal.Conv.
func ValidateTables ¶
ValidateTables validates that all the tables in the database are empty. It returns the name of the first non-empty table if found, and an empty string otherwise.
func WriteBadData ¶
WriteBadData prints summary stats about bad rows and writes detailed info to file 'name'.
func WriteConvGeneratedFiles ¶
func WriteConvGeneratedFiles(conv *internal.Conv, dbName string, driver string, BytesRead int64, out *os.File) (string, error)
WriteConvGeneratedFiles creates a directory labeled downloads with the current timestamp where it writes the sessionfile, report summary and DDLs then returns the directory where it writes.
func WriteOverridesFile ¶
WriteOverridesFile writes the overrides file in JSON format.
func WriteSchemaFile ¶
WriteSchemaFile writes DDL statements in a file. It includes CREATE TABLE statements and ALTER TABLE statements to add foreign keys. The parameter name should end with a .txt.
Types ¶
type ConnectionProfile ¶
type ConnectionProfile struct {
// Project Id of the resource
ProjectId string
// Datashard Id for the resource
DatashardId string
// Name of connection profile
Id string
// If true, don't create resource, only validate if creation is possible. If false, create resource.
ValidateOnly bool
// If true, create source connection profile, else create target connection profile and gcs bucket.
IsSource bool
// For source connection profile host of MySql instance
Host string
// For source connection profile port of MySql instance
Port string
// For source connection profile password of MySql instance
Password string
// For source connection profile user name of MySql instance
User string
// Region of connection profile to be created
Region string
// For target connection profile name of gcs bucket to be created
BucketName string
}
type ConnectionProfileReq ¶
type ConnectionProfileReq struct {
ConnectionProfile ConnectionProfile
Error error
Ctx context.Context
}
type ConvImpl ¶
type ConvImpl struct{}
func (*ConvImpl) DataConv ¶
func (ci *ConvImpl) DataConv(ctx context.Context, migrationProjectId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile, ioHelper *utils.IOStreams, client *sp.Client, conv *internal.Conv, dataOnly bool, writeLimit int64, dataFromSource DataFromSourceInterface) (*writer.BatchWriter, error)
DataConv performs the data conversion The SourceProfile param provides the connection details to use the go SQL library.
func (*ConvImpl) SchemaConv ¶
func (ci *ConvImpl) SchemaConv(migrationProjectId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile, ioHelper *utils.IOStreams, schemaFromSource SchemaFromSourceInterface) (*internal.Conv, error)
SchemaConv performs the schema conversion The SourceProfile param provides the connection details to use the go SQL library.
type ConvInterface ¶
type ConvInterface interface {
SchemaConv(migrationProjectId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile, ioHelper *utils.IOStreams, schemaFromSource SchemaFromSourceInterface) (*internal.Conv, error)
DataConv(ctx context.Context, migrationProjectId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile, ioHelper *utils.IOStreams, client *sp.Client, conv *internal.Conv, dataOnly bool, writeLimit int64, dataFromSource DataFromSourceInterface) (*writer.BatchWriter, error)
}
type DataFromDatabaseImpl ¶
type DataFromDatabaseImpl struct{}
type DataFromDatabaseInterface ¶
type DataFromDatabaseInterface interface {
// contains filtered or unexported methods
}
type DataFromSourceImpl ¶
type DataFromSourceImpl struct{}
type DataFromSourceInterface ¶
type DataFromSourceInterface interface {
// contains filtered or unexported methods
}
type GetInfoImpl ¶
type GetInfoImpl struct{}
func (*GetInfoImpl) GetInfoSchema ¶
func (gi *GetInfoImpl) GetInfoSchema(migrationProjectId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile) (common.InfoSchema, error)
func (*GetInfoImpl) GetInfoSchemaFromCloudSQL ¶
func (gi *GetInfoImpl) GetInfoSchemaFromCloudSQL(migrationProjectId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile) (common.InfoSchema, error)
type GetInfoInterface ¶
type GetInfoInterface interface {
GetInfoSchemaFromCloudSQL(migrationProjectId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile) (common.InfoSchema, error)
GetInfoSchema(migrationProjectId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile) (common.InfoSchema, error)
// contains filtered or unexported methods
}
type MockDataFromSource ¶
type MockGetInfo ¶
func (*MockGetInfo) GetInfoSchema ¶
func (mgi *MockGetInfo) GetInfoSchema(migrationShardId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile) (common.InfoSchema, error)
func (*MockGetInfo) GetInfoSchemaFromCloudSQL ¶
func (mgi *MockGetInfo) GetInfoSchemaFromCloudSQL(migrationShardId string, sourceProfile profiles.SourceProfile, targetProfile profiles.TargetProfile) (common.InfoSchema, error)
type MockProcessDumpByDialect ¶
MockProcessDumpByDialect is a mock implementation of ProcessDumpByDialectInterface.
func (*MockProcessDumpByDialect) ProcessDump ¶
func (m *MockProcessDumpByDialect) ProcessDump(driver string, conv *internal.Conv, r *internal.Reader) error
ProcessDump mocks the ProcessDump method of ProcessDumpByDialectInterface.
type MockResourceGeneration ¶
func (*MockResourceGeneration) GetConnectionProfilesForResources ¶
func (mrg *MockResourceGeneration) GetConnectionProfilesForResources(ctx context.Context, projectId string, sourceProfile profiles.SourceProfile, region string, validateOnly bool) ([]*ConnectionProfileReq, []*ConnectionProfileReq, error)
func (*MockResourceGeneration) PrepareMinimalDowntimeResources ¶
func (mrg *MockResourceGeneration) PrepareMinimalDowntimeResources(createResourceData *ConnectionProfileReq, mutex *sync.Mutex) task.TaskResult[*ConnectionProfileReq]
func (*MockResourceGeneration) RollbackResourceCreation ¶
func (mrg *MockResourceGeneration) RollbackResourceCreation(ctx context.Context, profiles []*ConnectionProfileReq) error
type MockSchemaFromSource ¶
func (*MockSchemaFromSource) SchemaFromDump ¶
func (msads *MockSchemaFromSource) SchemaFromDump(SpProjectId string, SpInstanceId string, driver string, spDialect string, ioHelper *utils.IOStreams, processDump ProcessDumpByDialectInterface, defaultIdentityOptions profiles.DefaultIdentityOptions) (*internal.Conv, error)
type MockValidateOrCreateResources ¶
func (*MockValidateOrCreateResources) ValidateOrCreateResourcesForShardedMigration ¶
func (mcr *MockValidateOrCreateResources) ValidateOrCreateResourcesForShardedMigration(ctx context.Context, projectId string, instanceName string, validateOnly bool, region string, sourceProfile profiles.SourceProfile) error
type MockValidateResources ¶
func (*MockValidateResources) ValidateResourceGeneration ¶
func (mvr *MockValidateResources) ValidateResourceGeneration(ctx context.Context, projectId string, instanceId string, sourceProfile profiles.SourceProfile, conv *internal.Conv) error
type PopulateDataConvImpl ¶
type PopulateDataConvImpl struct{}
type PopulateDataConvInterface ¶
type PopulateDataConvInterface interface {
// contains filtered or unexported methods
}
type ProcessDumpByDialectImpl ¶
type ProcessDumpByDialectImpl struct {
ExpressionVerificationAccessor expressions_api.ExpressionVerificationAccessor
DdlVerifier expressions_api.DDLVerifier
}
func (*ProcessDumpByDialectImpl) ProcessDump ¶
func (pdd *ProcessDumpByDialectImpl) ProcessDump(driver string, conv *internal.Conv, r *internal.Reader) error
ProcessDump invokes process dump function from a sql package based on driver selected.
type ReportImpl ¶
type ReportImpl struct{}
type ReportInterface ¶
type SchemaFromSourceImpl ¶
type SchemaFromSourceImpl struct {
DdlVerifier expressions_api.DDLVerifier
}
func (*SchemaFromSourceImpl) SchemaFromDump ¶
func (sads *SchemaFromSourceImpl) SchemaFromDump(SpProjectId string, SpInstanceId string, driver string, spDialect string, ioHelper *utils.IOStreams, processDump ProcessDumpByDialectInterface, defaultIdentityOptions profiles.DefaultIdentityOptions) (*internal.Conv, error)
type SchemaFromSourceInterface ¶
type SchemaFromSourceInterface interface {
SchemaFromDump(SpProjectId string, SpInstanceId string, driver string, spDialect string, ioHelper *utils.IOStreams, processDump ProcessDumpByDialectInterface, defaultIdentityOptions profiles.DefaultIdentityOptions) (*internal.Conv, error)
// contains filtered or unexported methods
}
type SnapshotMigrationImpl ¶
type SnapshotMigrationImpl struct{}
type SnapshotMigrationInterface ¶
type SnapshotMigrationInterface interface {
// contains filtered or unexported methods
}