db

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRestartAfterClone = errors.New("Error 3707: Restart server failed (mysqld is not managed by supervisor process).")

Functions

This section is empty.

Types

type DB

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

func NewDatabase

func NewDatabase(ctx context.Context, params DBParams) (*DB, error)

func (*DB) CheckIfInPrimaryPartition

func (d *DB) CheckIfInPrimaryPartition(ctx context.Context) (bool, error)

func (*DB) Clone

func (d *DB) Clone(ctx context.Context, donor, user, pass string, port int32, cloneTimeoutSeconds, stallTimeoutSeconds uint32) error

func (*DB) CloneInProgress

func (d *DB) CloneInProgress(ctx context.Context) (bool, error)

func (*DB) Close

func (d *DB) Close() error

func (*DB) DisableSuperReadonly

func (d *DB) DisableSuperReadonly(ctx context.Context) error

func (*DB) DumbQuery

func (d *DB) DumbQuery(ctx context.Context) error

func (*DB) EnableSuperReadonly

func (d *DB) EnableSuperReadonly(ctx context.Context) error

func (*DB) FlushRelayLogs added in v1.3.0

func (d *DB) FlushRelayLogs(ctx context.Context) error

func (*DB) GTIDSubtract added in v1.3.0

func (d *DB) GTIDSubtract(ctx context.Context, set, other string) (string, error)

func (*DB) GetGTIDExecuted added in v1.1.0

func (d *DB) GetGTIDExecuted(ctx context.Context) (string, error)

func (*DB) GetGTIDPurged added in v1.3.0

func (d *DB) GetGTIDPurged(ctx context.Context) (string, error)

func (*DB) GetMemberState

func (d *DB) GetMemberState(ctx context.Context, host string) (db.MemberState, error)

func (*DB) GetSelfState added in v1.3.0

func (d *DB) GetSelfState(ctx context.Context) (db.MemberState, error)

func (*DB) GetSourceLogPos added in v1.3.0

func (d *DB) GetSourceLogPos(ctx context.Context) (ReplicaPosition, error)

func (*DB) IsGRConfigured added in v1.2.0

func (d *DB) IsGRConfigured(ctx context.Context) (bool, error)

func (*DB) IsReadonly

func (d *DB) IsReadonly(ctx context.Context) (bool, error)

func (*DB) IsReplica

func (d *DB) IsReplica(ctx context.Context) (bool, error)

func (*DB) IsWritable added in v1.3.0

func (d *DB) IsWritable(ctx context.Context) (bool, error)

func (*DB) RelayLogPaths added in v1.3.0

func (d *DB) RelayLogPaths(ctx context.Context) (string, string, error)

RelayLogPaths returns the full path prefix shared by relay log files and the path of the relay log index file.

func (*DB) ReplicationStatus

func (d *DB) ReplicationStatus(ctx context.Context) (db.ReplicationStatus, string, error)

func (*DB) ReportHost

func (d *DB) ReportHost(ctx context.Context) (string, error)

func (*DB) ResetReplication

func (d *DB) ResetReplication(ctx context.Context) error

func (*DB) ShowReplicaStatus added in v1.3.0

func (d *DB) ShowReplicaStatus(ctx context.Context) (map[string]string, error)

func (*DB) StartIOThread added in v1.3.0

func (d *DB) StartIOThread(ctx context.Context) error

func (*DB) StartReplicaThreads added in v1.3.0

func (d *DB) StartReplicaThreads(ctx context.Context) error

StartReplicaThreads starts whichever replication threads are stopped, leaving the channel's configuration as it is.

func (*DB) StartReplication

func (d *DB) StartReplication(ctx context.Context, host, replicaPass string, port int32, sourceRetryCount, sourceConnectRetry uint32) error

func (*DB) StartSQLThread added in v1.3.0

func (d *DB) StartSQLThread(ctx context.Context) error

func (*DB) StopReplication

func (d *DB) StopReplication(ctx context.Context) error

type DBParams

type DBParams struct {
	User apiv1.SystemUser
	Pass string
	Host string
	Port int32

	ReadTimeoutSeconds  uint32
	CloneTimeoutSeconds uint32
	SourceRetryCount    uint32
	SourceConnectRetry  uint32
}

func (*DBParams) DSN

func (p *DBParams) DSN() string

type ReplicaPosition added in v1.3.0

type ReplicaPosition struct {
	SourceHost   string
	SourceLog    string
	SourcePos    uint64
	RelayLog     string
	RelayPos     uint64
	GTIDExecuted string
}

type ReplicationStatus

type ReplicationStatus int8

Jump to

Keyboard shortcuts

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