tmclient

package
v0.0.0-...-d271c08 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2014 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTabletManagerClientFactory

func RegisterTabletManagerClientFactory(name string, factory TabletManagerClientFactory)

Types

type ErrFunc

type ErrFunc func() error

ErrFunc is used by streaming RPCs that don't return a specific result

type MultiSnapshotReplyFunc

type MultiSnapshotReplyFunc func() (*actionnode.MultiSnapshotReply, error)

MultiSnapshotReplyFunc is used by MultiSnapshot to return result and error

type SnapshotReplyFunc

type SnapshotReplyFunc func() (*actionnode.SnapshotReply, error)

SnapshotReplyFunc is used by Snapshot to return result and error

type TabletManagerClient

type TabletManagerClient interface {

	// Ping will try to ping the remote tablet
	Ping(tablet *topo.TabletInfo, waitTime time.Duration) error

	// GetSchema asks the remote tablet for its database schema
	GetSchema(tablet *topo.TabletInfo, tables, excludeTables []string, includeViews bool, waitTime time.Duration) (*myproto.SchemaDefinition, error)

	// GetPermissions asks the remote tablet for its permissions list
	GetPermissions(tablet *topo.TabletInfo, waitTime time.Duration) (*myproto.Permissions, error)

	// SetReadOnly makes the mysql instance read-only
	SetReadOnly(tablet *topo.TabletInfo, waitTime time.Duration) error

	// SetReadWrite makes the mysql instance read-write
	SetReadWrite(tablet *topo.TabletInfo, waitTime time.Duration) error

	// ChangeType asks the remote tablet to change its type
	ChangeType(tablet *topo.TabletInfo, dbType topo.TabletType, waitTime time.Duration) error

	// Scrap scraps the live running tablet
	Scrap(tablet *topo.TabletInfo, waitTime time.Duration) error

	// Sleep will sleep for a duration (used for tests)
	Sleep(tablet *topo.TabletInfo, duration, waitTime time.Duration) error

	// ExecuteHook executes the provided hook remotely
	ExecuteHook(tablet *topo.TabletInfo, hk *hook.Hook, waitTime time.Duration) (*hook.HookResult, error)

	// RefreshState asks the remote tablet to reload its tablet record
	RefreshState(tablet *topo.TabletInfo, waitTime time.Duration) error

	// ReloadSchema asks the remote tablet to reload its schema
	ReloadSchema(tablet *topo.TabletInfo, waitTime time.Duration) error

	// PreflightSchema will test a schema change
	PreflightSchema(tablet *topo.TabletInfo, change string, waitTime time.Duration) (*myproto.SchemaChangeResult, error)

	// ApplySchema will apply a schema change
	ApplySchema(tablet *topo.TabletInfo, change *myproto.SchemaChange, waitTime time.Duration) (*myproto.SchemaChangeResult, error)

	// ExecuteFetch executes a query remotely using the DBA pool
	ExecuteFetch(tablet *topo.TabletInfo, query string, maxRows int, wantFields, disableBinlogs bool, waitTime time.Duration) (*mproto.QueryResult, error)

	// SlaveStatus returns the tablet's mysql slave status.
	SlaveStatus(tablet *topo.TabletInfo, waitTime time.Duration) (*myproto.ReplicationStatus, error)

	// WaitSlavePosition asks the tablet to wait until it reaches that
	// position in mysql replication
	WaitSlavePosition(tablet *topo.TabletInfo, waitPos myproto.ReplicationPosition, waitTime time.Duration) (*myproto.ReplicationStatus, error)

	// MasterPosition returns the tablet's master position
	MasterPosition(tablet *topo.TabletInfo, waitTime time.Duration) (myproto.ReplicationPosition, error)

	// ReparentPosition returns the data for a slave to use to reparent
	// to the target tablet at the given position.
	ReparentPosition(tablet *topo.TabletInfo, rp *myproto.ReplicationPosition, waitTime time.Duration) (*actionnode.RestartSlaveData, error)

	// StopSlave stops the mysql replication
	StopSlave(tablet *topo.TabletInfo, waitTime time.Duration) error

	// StopSlaveMinimum stops the mysql replication after it reaches
	// the provided minimum point
	StopSlaveMinimum(tablet *topo.TabletInfo, stopPos myproto.ReplicationPosition, waitTime time.Duration) (*myproto.ReplicationStatus, error)

	// StartSlave starts the mysql replication
	StartSlave(tablet *topo.TabletInfo, waitTime time.Duration) error

	// TabletExternallyReparented tells a tablet it is now the master
	TabletExternallyReparented(tablet *topo.TabletInfo, waitTime time.Duration) error

	// GetSlaves returns the addresses of the slaves
	GetSlaves(tablet *topo.TabletInfo, waitTime time.Duration) ([]string, error)

	// WaitBlpPosition asks the tablet to wait until it reaches that
	// position in replication
	WaitBlpPosition(tablet *topo.TabletInfo, blpPosition blproto.BlpPosition, waitTime time.Duration) error

	// StopBlp asks the tablet to stop all its binlog players,
	// and returns the current position for all of them
	StopBlp(tablet *topo.TabletInfo, waitTime time.Duration) (*blproto.BlpPositionList, error)

	// StartBlp asks the tablet to restart its binlog players
	StartBlp(tablet *topo.TabletInfo, waitTime time.Duration) error

	// RunBlpUntil asks the tablet to restart its binlog players until
	// it reaches the given positions, if not there yet.
	RunBlpUntil(tablet *topo.TabletInfo, positions *blproto.BlpPositionList, waitTime time.Duration) (myproto.ReplicationPosition, error)

	// DemoteMaster tells the soon-to-be-former master it's gonna change
	DemoteMaster(tablet *topo.TabletInfo, waitTime time.Duration) error

	// PromoteSlave transforms the tablet from a slave to a master.
	PromoteSlave(tablet *topo.TabletInfo, waitTime time.Duration) (*actionnode.RestartSlaveData, error)

	// SlaveWasPromoted tells the remote tablet it is now the master
	SlaveWasPromoted(tablet *topo.TabletInfo, waitTime time.Duration) error

	// RestartSlave tells the remote tablet it has a new master
	RestartSlave(tablet *topo.TabletInfo, rsd *actionnode.RestartSlaveData, waitTime time.Duration) error

	// SlaveWasRestarted tells the remote tablet its master has changed
	SlaveWasRestarted(tablet *topo.TabletInfo, args *actionnode.SlaveWasRestartedArgs, waitTime time.Duration) error

	// BreakSlaves will tinker with the replication stream in a
	// way that will stop all the slaves.
	BreakSlaves(tablet *topo.TabletInfo, waitTime time.Duration) error

	// Snapshot takes a database snapshot
	Snapshot(tablet *topo.TabletInfo, sa *actionnode.SnapshotArgs, waitTime time.Duration) (<-chan *logutil.LoggerEvent, SnapshotReplyFunc, error)

	// SnapshotSourceEnd restarts the mysql server
	SnapshotSourceEnd(tablet *topo.TabletInfo, ssea *actionnode.SnapshotSourceEndArgs, waitTime time.Duration) error

	// ReserveForRestore will prepare a server for restore
	ReserveForRestore(tablet *topo.TabletInfo, rfra *actionnode.ReserveForRestoreArgs, waitTime time.Duration) error

	// Restore restores a database snapshot
	Restore(tablet *topo.TabletInfo, sa *actionnode.RestoreArgs, waitTime time.Duration) (<-chan *logutil.LoggerEvent, ErrFunc, error)

	// MultiSnapshot takes a database snapshot
	MultiSnapshot(tablet *topo.TabletInfo, sa *actionnode.MultiSnapshotArgs, waitTime time.Duration) (<-chan *logutil.LoggerEvent, MultiSnapshotReplyFunc, error)

	// MultiRestore restores a database snapshot
	MultiRestore(tablet *topo.TabletInfo, sa *actionnode.MultiRestoreArgs, waitTime time.Duration) (<-chan *logutil.LoggerEvent, ErrFunc, error)
}

TabletManagerClient defines the interface used to talk to a remote tablet

func NewTabletManagerClient

func NewTabletManagerClient() TabletManagerClient

type TabletManagerClientFactory

type TabletManagerClientFactory func() TabletManagerClient

Jump to

Keyboard shortcuts

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