ctrl

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotSlave       = iota // Not a normal slave (also not a migration slave)
	SlaveInit             // Just receive slave or migration command
	SlaveNeedClear        // Slave has old data, need to clear old data
	SlaveClear            // Slave clearing(deleting) old data
	SlaveFullSync         // Doing full sync right now
	SlaveIncrSync         // Doing incremental sync right now
	SlaveReady            // Slave is up to date with master
)

Slave/Migration status

View Source
const (
	TotalUnitNum = 8192
)

Variables

This section is empty.

Functions

func Decode

func Decode(pkg []byte, head *proto.PkgHead, v interface{}) error

func Encode

func Encode(cmd, dbId uint8, seq uint64, v interface{}) ([]byte, error)

func GetUnitId added in v1.0.3

func GetUnitId(dbId, tableId uint8, rowKey []byte) uint16

Types

type PkgDelUnit added in v1.0.3

type PkgDelUnit struct {
	UnitId uint16 // The unit to delete
	ErrMsg string // error msg, nil means no error
}

Delete unit data

type PkgMigrate

type PkgMigrate struct {
	ClientReq  bool   // true: from client api; false: from slave to master
	MasterAddr string // ip:host, stop migration if empty
	SlaveAddr  string // ip:host
	UnitId     uint16 // The unit to be migrated
	ErrMsg     string // error msg, nil means no error
}

Migrate command pkg. When stop migration: If all data migrated, switch client requests to new servers. If migration failed, wait for delete unit command. Steps in cluster mode when migration succeeds: 1. new servers switch to normal status (but still hold the master/slave connection) 2. switch proxy and client requests routed to new servers 3. wait for 10 seconds, and close the master/slave connection 4. delete the unit data from old servers

type PkgSlaveOf

type PkgSlaveOf struct {
	ClientReq  bool   // true: from client api; false: from slave to master
	MasterAddr string // ip:host, no master if emtpy
	SlaveAddr  string // ip:host
	LastSeq    uint64
	ErrMsg     string // error msg, nil means no error
}

SlaveOf command pkg

type PkgSlaveStatus

type PkgSlaveStatus struct {
	Migration bool   // true: Migration status; false: Normal slave status
	UnitId    uint16 // The unit under migration
	Status    int
	ErrMsg    string // error msg, nil means no error
}

Get migration/slave status

Jump to

Keyboard shortcuts

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