Documentation ¶
Index ¶
- Constants
- func DiffPermissions(leftName string, left *Permissions, rightName string, right *Permissions, ...)
- func DiffPermissionsToArray(leftName string, left *Permissions, rightName string, right *Permissions) (result []string)
- func DiffSchema(leftName string, left *SchemaDefinition, rightName string, ...)
- func DiffSchemaToArray(leftName string, left *SchemaDefinition, rightName string, ...) (result []string)
- type BlpPosition
- type BlpPositionList
- type ByReverseDataLength
- type DbPermission
- type DbPermissionList
- type HostPermission
- type HostPermissionList
- type Permission
- type PermissionList
- type Permissions
- type ReplicationPosition
- type ReplicationState
- type SchemaChange
- type SchemaChangeResult
- type SchemaDefinition
- type TableDefinition
- type TableDefinitions
- type UserPermission
- type UserPermissionList
Constants ¶
View Source
const ( TABLE_BASE_TABLE = "BASE TABLE" TABLE_VIEW = "VIEW" )
View Source
const ( // InvalidLagSeconds is a special value for SecondsBehindMaster // that means replication is not running InvalidLagSeconds = 0xFFFFFFFF )
Variables ¶
This section is empty.
Functions ¶
func DiffPermissions ¶
func DiffPermissions(leftName string, left *Permissions, rightName string, right *Permissions, er concurrency.ErrorRecorder)
func DiffPermissionsToArray ¶
func DiffPermissionsToArray(leftName string, left *Permissions, rightName string, right *Permissions) (result []string)
func DiffSchema ¶
func DiffSchema(leftName string, left *SchemaDefinition, rightName string, right *SchemaDefinition, er concurrency.ErrorRecorder)
generates a report on what's different between two SchemaDefinition for now, we skip the VIEW entirely.
func DiffSchemaToArray ¶
func DiffSchemaToArray(leftName string, left *SchemaDefinition, rightName string, right *SchemaDefinition) (result []string)
Types ¶
type BlpPosition ¶
type BlpPositionList ¶
type BlpPositionList struct {
Entries []BlpPosition
}
func (*BlpPositionList) FindBlpPositionById ¶
func (bpl *BlpPositionList) FindBlpPositionById(id uint32) (*BlpPosition, error)
type ByReverseDataLength ¶
type ByReverseDataLength struct {
TableDefinitions
}
sort by reverse DataLength
func (ByReverseDataLength) Less ¶
func (bdl ByReverseDataLength) Less(i, j int) bool
type DbPermission ¶
DbPermission describes a single row in the mysql.db table Primary key is Host+Db+User
func NewDbPermission ¶
func NewDbPermission(fields []proto.Field, values []sqltypes.Value) *DbPermission
func (*DbPermission) PrimaryKey ¶
func (dp *DbPermission) PrimaryKey() string
func (*DbPermission) String ¶
func (dp *DbPermission) String() string
type DbPermissionList ¶
type DbPermissionList []*DbPermission
func (DbPermissionList) Get ¶
func (upl DbPermissionList) Get(i int) Permission
func (DbPermissionList) Len ¶
func (upl DbPermissionList) Len() int
type HostPermission ¶
HostPermission describes a single row in the mysql.host table Primary key is Host+Db
func NewHostPermission ¶
func NewHostPermission(fields []proto.Field, values []sqltypes.Value) *HostPermission
func (*HostPermission) PrimaryKey ¶
func (hp *HostPermission) PrimaryKey() string
func (*HostPermission) String ¶
func (hp *HostPermission) String() string
type HostPermissionList ¶
type HostPermissionList []*HostPermission
func (HostPermissionList) Get ¶
func (upl HostPermissionList) Get(i int) Permission
func (HostPermissionList) Len ¶
func (upl HostPermissionList) Len() int
type Permission ¶
type PermissionList ¶
type PermissionList interface { Get(int) Permission Len() int }
type Permissions ¶
type Permissions struct { UserPermissions UserPermissionList DbPermissions DbPermissionList HostPermissions HostPermissionList }
Permissions have all the rows in mysql.{user,db,host} tables, (all rows are sorted by primary key)
func (*Permissions) String ¶
func (permissions *Permissions) String() string
type ReplicationPosition ¶
type ReplicationPosition struct { // MasterLogFile, MasterLogPosition and MasterLogGroupId are // the position on the logs for transactions that have been // applied (SQL position): // - on the master, it's File, Position and Group_ID from // 'show master status'. // - on the slave, it's Relay_Master_Log_File, Exec_Master_Log_Pos // and Exec_Master_Group_ID from 'show slave status'. MasterLogFile string MasterLogPosition uint MasterLogGroupId int64 // MasterLogFileIo and MasterLogPositionIo are the position on the logs // that have been downloaded from the master (IO position), // but not necessarely applied yet: // - on the master, same as MasterLogFile and MasterLogPosition. // - on the slave, it's Master_Log_File and Read_Master_Log_Pos // from 'show slave status'. MasterLogFileIo string MasterLogPositionIo uint // SecondsBehindMaster is how far behind we are in applying logs in // replication. If equal to InvalidLagSeconds, it means replication // is not running. SecondsBehindMaster uint }
ReplicationPosition tracks the replication position on both a master and a slave.
func (*ReplicationPosition) MapKey ¶
func (rp *ReplicationPosition) MapKey() string
func (*ReplicationPosition) MapKeyIo ¶
func (rp *ReplicationPosition) MapKeyIo() string
type ReplicationState ¶
type ReplicationState struct { // ReplicationPosition is not anonymous because the default json encoder has begun to fail here. ReplicationPosition ReplicationPosition MasterHost string MasterPort int MasterConnectRetry int }
func NewReplicationState ¶
func NewReplicationState(masterAddr string) (*ReplicationState, error)
func (*ReplicationState) MasterAddr ¶
func (rs *ReplicationState) MasterAddr() string
type SchemaChange ¶
type SchemaChange struct { Sql string Force bool AllowReplication bool BeforeSchema *SchemaDefinition AfterSchema *SchemaDefinition }
type SchemaChangeResult ¶
type SchemaChangeResult struct { BeforeSchema *SchemaDefinition AfterSchema *SchemaDefinition }
func (*SchemaChangeResult) String ¶
func (scr *SchemaChangeResult) String() string
type SchemaDefinition ¶
type SchemaDefinition struct { // the 'CREATE DATABASE...' statement, with db name as {{.DatabaseName}} DatabaseSchema string // ordered by TableDefinition.Name by default TableDefinitions TableDefinitions // the md5 of the concatenation of TableDefinition.Schema Version string }
func (*SchemaDefinition) GenerateSchemaVersion ¶
func (sd *SchemaDefinition) GenerateSchemaVersion()
func (*SchemaDefinition) GetTable ¶
func (sd *SchemaDefinition) GetTable(table string) (td *TableDefinition, ok bool)
func (*SchemaDefinition) SortByReverseDataLength ¶
func (sd *SchemaDefinition) SortByReverseDataLength()
func (*SchemaDefinition) String ¶
func (sd *SchemaDefinition) String() string
type TableDefinition ¶
type TableDefinition struct { Name string // the table name Schema string // the SQL to run to create the table Columns []string // the columns in the order that will be used to dump and load the data PrimaryKeyColumns []string // the columns used by the primary key, in order Type string // TABLE_BASE_TABLE or TABLE_VIEW DataLength uint64 // how much space the data file takes. }
type TableDefinitions ¶
type TableDefinitions []TableDefinition
helper methods for sorting
func (TableDefinitions) Len ¶
func (tds TableDefinitions) Len() int
func (TableDefinitions) Swap ¶
func (tds TableDefinitions) Swap(i, j int)
type UserPermission ¶
type UserPermission struct { Host string User string PasswordChecksum uint64 Privileges map[string]string }
UserPermission describes a single row in the mysql.user table Primary key is Host+User PasswordChecksum is the crc64 of the password, for security reasons
func NewUserPermission ¶
func NewUserPermission(fields []proto.Field, values []sqltypes.Value) *UserPermission
func (*UserPermission) PrimaryKey ¶
func (up *UserPermission) PrimaryKey() string
func (*UserPermission) String ¶
func (up *UserPermission) String() string
type UserPermissionList ¶
type UserPermissionList []*UserPermission
func (UserPermissionList) Get ¶
func (upl UserPermissionList) Get(i int) Permission
func (UserPermissionList) Len ¶
func (upl UserPermissionList) Len() int
Click to show internal directories.
Click to hide internal directories.