sheepdog

package
v0.0.0-...-83f9fa1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SD_DEFAULT_PORT                = 7000
	SD_PROTO_VER_TRIM_ZERO_SECTORS = 0x02
)
View Source
const (
	// client2sheep
	SD_OP_CREATE_AND_WRITE_OBJ sdOpcode = 0x01
	SD_OP_READ_OBJ             sdOpcode = 0x02
	SD_OP_WRITE_OBJ            sdOpcode = 0x03
	SD_OP_REMOVE_OBJ           sdOpcode = 0x04
	SD_OP_DISCARD_OBJ          sdOpcode = 0x05

	SD_OP_NEW_VDI             sdOpcode = 0x11
	SD_OP_LOCK_VDI            sdOpcode = 0x12
	SD_OP_RELEASE_VDI         sdOpcode = 0x13
	SD_OP_GET_VDI_INFO        sdOpcode = 0x14
	SD_OP_READ_VDIS           sdOpcode = 0x15
	SD_OP_FLUSH_VDI           sdOpcode = 0x16
	SD_OP_DEL_VDI             sdOpcode = 0x17
	SD_OP_GET_CLUSTER_DEFAULT sdOpcode = 0x18

	// sheep2sheep
	SD_OP_GET_NODE_LIST            sdOpcode = 0x82
	SD_OP_MAKE_FS                  sdOpcode = 0x84
	SD_OP_SHUTDOWN                 sdOpcode = 0x85
	SD_OP_STAT_SHEEP               sdOpcode = 0x86
	SD_OP_STAT_CLUSTER             sdOpcode = 0x87
	SD_OP_GET_VDI_ATTR             sdOpcode = 0x89
	SD_OP_FORCE_RECOVER            sdOpcode = 0x8a
	SD_OP_GET_STORE_LIST           sdOpcode = 0x90
	SD_OP_SNAPSHOT                 sdOpcode = 0x91
	SD_OP_RESTORE                  sdOpcode = 0x92
	SD_OP_GET_SNAP_FILE            sdOpcode = 0x93
	SD_OP_CLEANUP                  sdOpcode = 0x94
	SD_OP_TRACE_STATUS             sdOpcode = 0x95
	SD_OP_TRACE_READ_BUF           sdOpcode = 0x96
	SD_OP_STAT_RECOVERY            sdOpcode = 0x97
	SD_OP_FLUSH_DEL_CACHE          sdOpcode = 0x98
	SD_OP_NOTIFY_VDI_DEL           sdOpcode = 0x99
	SD_OP_KILL_NODE                sdOpcode = 0x9A
	SD_OP_TRACE_ENABLE             sdOpcode = 0x9B
	SD_OP_TRACE_DISABLE            sdOpcode = 0x9C
	SD_OP_GET_OBJ_LIST             sdOpcode = 0xA1
	SD_OP_GET_EPOCH                sdOpcode = 0xA2
	SD_OP_CREATE_AND_WRITE_PEER    sdOpcode = 0xA3
	SD_OP_READ_PEER                sdOpcode = 0xA4
	SD_OP_WRITE_PEER               sdOpcode = 0xA5
	SD_OP_REMOVE_PEER              sdOpcode = 0xA6
	SD_OP_ENABLE_RECOVER           sdOpcode = 0xA8
	SD_OP_DISABLE_RECOVER          sdOpcode = 0xA9
	SD_OP_GET_VDI_COPIES           sdOpcode = 0xAB
	SD_OP_COMPLETE_RECOVERY        sdOpcode = 0xAC
	SD_OP_FLUSH_NODES              sdOpcode = 0xAD
	SD_OP_FLUSH_PEER               sdOpcode = 0xAE
	SD_OP_NOTIFY_VDI_ADD           sdOpcode = 0xAF
	SD_OP_MD_INFO                  sdOpcode = 0xB1
	SD_OP_MD_PLUG                  sdOpcode = 0xB2
	SD_OP_MD_UNPLUG                sdOpcode = 0xB3
	SD_OP_GET_HASH                 sdOpcode = 0xB4
	SD_OP_REWEIGHT                 sdOpcode = 0xB5
	SD_OP_STAT                     sdOpcode = 0xB8
	SD_OP_GET_LOGLEVEL             sdOpcode = 0xB9
	SD_OP_SET_LOGLEVEL             sdOpcode = 0xBA
	SD_OP_NFS_CREATE               sdOpcode = 0xBB
	SD_OP_NFS_DELETE               sdOpcode = 0xBC
	SD_OP_EXIST                    sdOpcode = 0xBD
	SD_OP_CLUSTER_INFO             sdOpcode = 0xBE
	SD_OP_ALTER_CLUSTER_COPY       sdOpcode = 0xBF
	SD_OP_ALTER_VDI_COPY           sdOpcode = 0xC0
	SD_OP_DECREF_OBJ               sdOpcode = 0xC1
	SD_OP_DECREF_PEER              sdOpcode = 0xC2
	SD_OP_REPAIR_REPLICA           sdOpcode = 0xC5
	SD_OP_OIDS_EXIST               sdOpcode = 0xC6
	SD_OP_VDI_STATE_CHECKPOINT_CTL sdOpcode = 0xC7
	SD_OP_INODE_COHERENCE          sdOpcode = 0xC8
	SD_OP_READ_DEL_VDIS            sdOpcode = 0xC9
	SD_OP_GET_RECOVERY             sdOpcode = 0xCA
	SD_OP_SET_RECOVERY             sdOpcode = 0xCB
	SD_OP_SET_VNODES               sdOpcode = 0xCC
	SD_OP_GET_VNODES               sdOpcode = 0xCD
)
View Source
const (
	SD_HDR_SIZE = 16
	SD_REQ_SIZE = 48
	SD_RSP_SIZE = 48

	SECTOR_SIZE = 512 // 1 << 9 // get via ioctl BLKBSZGET
)
View Source
const (
	SD_MAX_VDI_LEN              = 256
	SD_MAX_VDI_TAG_LEN          = 256
	SD_MAX_VDI_ATTR_KEY_LEN     = 256
	SD_MAX_VDI_ATTR_VALUE_LEN   = 65536
	SD_MAX_SNAPSHOT_TAG_LEN     = 256
	SD_DEFAULT_BLOCK_SIZE_SHIFT = 22
	SD_NR_VDIS                  = uint64(1) << 24
)
View Source
const (
	SD_FLAG_CMD_WRITE     = 0x01
	SD_FLAG_CMD_COW       = 0x02
	SD_FLAG_CMD_CACHE     = 0x04 /* Writeback mode for cache */
	SD_FLAG_CMD_DIRECT    = 0x08 /* Don't use cache */
	SD_FLAG_CMD_PIGGYBACK = 0x10
	SD_FLAG_CMD_FWD       = 0x40
)
View Source
const (
	SD_RES_SUCCESS         = uint32(0x00) /* Success */
	SD_RES_UNKNOWN         = uint32(0x01) /* Unknown error */
	SD_RES_NO_OBJ          = uint32(0x02) /* No object found */
	SD_RES_EIO             = uint32(0x03) /* I/O error */
	SD_RES_VDI_EXIST       = uint32(0x04) /* Vdi exists already */
	SD_RES_INVALID_PARMS   = uint32(0x05) /* Invalid parameters */
	SD_RES_SYSTEM_ERROR    = uint32(0x06) /* System error */
	SD_RES_VDI_LOCKED      = uint32(0x07) /* Vdi is locked */
	SD_RES_NO_VDI          = uint32(0x08) /* No vdi found */
	SD_RES_NO_BASE_VDI     = uint32(0x09) /* No base vdi found */
	SD_RES_VDI_READ        = uint32(0x0A) /* Cannot read requested vdi */
	SD_RES_VDI_WRITE       = uint32(0x0B) /* Cannot write requested vdi */
	SD_RES_BASE_VDI_READ   = uint32(0x0C) /* Cannot read base vdi */
	SD_RES_BASE_VDI_WRITE  = uint32(0x0D) /* Cannot write base vdi */
	SD_RES_NO_TAG          = uint32(0x0E) /* Requested tag is not found */
	SD_RES_STARTUP         = uint32(0x0F) /* Sheepdog is on starting up */
	SD_RES_VDI_NOT_LOCKED  = uint32(0x10) /* Vdi is not locked */
	SD_RES_SHUTDOWN        = uint32(0x11) /* Sheepdog is shutting down */
	SD_RES_NO_MEM          = uint32(0x12) /* Cannot allocate memory */
	SD_RES_FULL_VDI        = uint32(0x13) /* we already have the maximum vdis */
	SD_RES_VER_MISMATCH    = uint32(0x14) /* Protocol version mismatch */
	SD_RES_NO_SPACE        = uint32(0x15) /* Server has no room for new objects */
	SD_RES_WAIT_FOR_FORMAT = uint32(0x16) /* Waiting for a format operation */
	SD_RES_WAIT_FOR_JOIN   = uint32(0x17) /* Waiting for other nodes joining */
	SD_RES_JOIN_FAILED     = uint32(0x18) /* Target node had failed to join sheepdog */
	SD_RES_HALT            = uint32(0x19) /* Sheepdog is stopped serving IO request */
	SD_RES_READONLY        = uint32(0x1A) /* Object is read-only */

	SD_RES_INODE_INVALIDATED = uint32(0x1D)
)
View Source
const (
	SD_EC_MAX_STRIP = 16
	SD_MAX_COPIES   = (SD_EC_MAX_STRIP*2 - 1)

	CURRENT_VDI_ID = 0

	LOCK_TYPE_NORMAL = 0
	LOCK_TYPE_SHARED = 1 /* for iSCSI multipath */

	VDI_BIT       = uint64(1) << 63
	VMSTATE_BIT   = uint64(1) << 62
	VDI_ATTR_BIT  = uint64(1) << 61
	VDI_BTREE_BIT = uint64(1) << 60
	LEDGER_BIT    = uint64(1) << 59

	VDI_SPACE_SHIFT = 32
	SD_VDI_MASK     = 0x00FFFFFF00000000

	MAX_DATA_OBJS = uint64(1) << 32

	SD_INODE_SIZE            = 10
	SD_INODE_INDEX_SIZE      = 4 * MAX_DATA_OBJS
	SD_INODE_DATA_INDEX      = uint64(1) << 20
	SD_INODE_DATA_INDEX_SIZE = 4 * SD_INODE_DATA_INDEX
	//	SD_INODE_HEADER_SIZE
	SD_INODE_HEADER_SIZE = 4664
	SD_LEDGER_OBJ_SIZE   = uint64(1) << 22
	OLD_MAX_CHILDREN     = uint64(1024)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterInfo

type ClusterInfo struct {
	Proto          uint8
	Recovery       uint8
	NrNodes        uint16
	Epoch          uint32
	Ctime          uint64
	Flags          uint16
	NrCopies       uint8
	CopyPolicy     uint8
	Status         uint8
	BlockSizeShift uint8

	DefaultStore []byte
	// contains filtered or unexported fields
}

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

type DiskInfo

type DiskInfo struct {
	DiskID    uint64
	DiskSpace uint64
}

type GenRef

type GenRef struct {
	Generation uint32
	Count      uint32
}

type Inode

type Inode struct {
	Name           [SD_MAX_VDI_LEN]byte
	Tag            [SD_MAX_VDI_TAG_LEN]byte
	Ctime          uint64
	SnapTime       uint64
	VMClockNSec    uint64
	VDISize        uint64
	VMStateSize    uint64
	CopyPolicy     uint8
	StorePolicy    uint8
	Copies         uint8
	BlockSizeShift uint8
	SnapId         uint32
	VdiId          uint32
	ParentVdiId    uint32
	BtreeCounter   uint32

	DataVdiId [SD_INODE_DATA_INDEX]uint32
	Gref      [SD_INODE_DATA_INDEX]GenRef
	// contains filtered or unexported fields
}

type Node

type Node struct {
	//RB       RBNode
	NID      NodeID
	VNodes   uint16
	Zone     uint32
	Space    uint64
	DiskInfo [0]DiskInfo
}

type NodeID

type NodeID struct {
	Addr      [16]byte
	Port      uint16
	IOAddr    [16]byte
	IOPort    uint16
	Reserved1 [4]byte
}

type ProxySheepdog

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

Internal strect holds data used by internal cluster engine

func (*ProxySheepdog) Configure

func (p *ProxySheepdog) Configure(engine *kv.KV, cfg interface{}) error

func (*ProxySheepdog) Start

func (p *ProxySheepdog) Start() error

func (*ProxySheepdog) Stop

func (p *ProxySheepdog) Stop() error

type SheepdogClusterReq

type SheepdogClusterReq struct {
	SheepdogHdr
	SheepdogClusterReqData
}

type SheepdogClusterReqData

type SheepdogClusterReqData struct {
	OID            uint64
	Ctime          uint64
	Copies         uint8
	CopyPolicy     uint8
	Cflags         uint16
	Tag            uint32
	NrNodes        uint32
	BlockSizeShift uint8
	// contains filtered or unexported fields
}

type SheepdogClusterRsp

type SheepdogClusterRsp struct {
	SheepdogHdr
	SheepdogClusterRspData
}

type SheepdogClusterRspData

type SheepdogClusterRspData struct {
	Result         uint32
	NrCopies       uint8
	CopyPolicy     uint8
	BlockSizeShift uint8
	// contains filtered or unexported fields
}

type SheepdogFwdReq

type SheepdogFwdReq struct {
	SheepdogHdr
	SheepdogFwdReqData
}

type SheepdogFwdReqData

type SheepdogFwdReqData struct {
	OID  uint64
	Addr [16]byte
	Port uint16
	// contains filtered or unexported fields
}

type SheepdogHashRsp

type SheepdogHashRsp struct {
	SheepdogHdr
	SheepdogHashRspData
}

type SheepdogHashRspData

type SheepdogHashRspData struct {
	Result uint32

	Digest [20]byte
	// contains filtered or unexported fields
}

type SheepdogHdr

type SheepdogHdr struct {
	Proto   uint8  // 1
	Opcode  uint8  // 1
	Flags   uint16 // 2
	Epoch   uint32 // 4
	ID      uint32 // 4
	DataLen uint32 // 4

}

type SheepdogInodeCohReq

type SheepdogInodeCohReq struct {
	SheepdogHdr
	SheepdogInodeCohReqData
}

type SheepdogInodeCohReqData

type SheepdogInodeCohReqData struct {
	VID      uint32
	Validate uint32
	// contains filtered or unexported fields
}

type SheepdogIntReq

type SheepdogIntReq struct {
	SheepdogHdr
	SheepdogIntReqData
}

type SheepdogIntReqData

type SheepdogIntReqData struct {
	Result  uint32
	NrNodes uint32
}

type SheepdogIntRsp

type SheepdogIntRsp struct {
	SheepdogHdr
	SheepdogIntRspData
}

type SheepdogIntRspData

type SheepdogIntRspData struct {
	Result uint32

	NrNodes uint32

	StoreSize uint64
	StoreFree uint64
	// contains filtered or unexported fields
}

type SheepdogNodeRsp

type SheepdogNodeRsp struct {
	SheepdogHdr
	SheepdogNodeRspData
}

type SheepdogNodeRspData

type SheepdogNodeRspData struct {
	Result  uint32
	NrNodes uint32

	StoreSize uint64
	StoreFree uint64
	// contains filtered or unexported fields
}

type SheepdogObjReq

type SheepdogObjReq struct {
	SheepdogHdr
	SheepdogObjReqData
}

type SheepdogObjReqData

type SheepdogObjReqData struct {
	OID         uint64 //8
	CowOID      uint64 //8
	Copies      uint8  //1
	CopyPolicy  uint8  //1
	StorePolicy uint8  //1

	Offset uint64 //8
	// contains filtered or unexported fields
}

type SheepdogObjRsp

type SheepdogObjRsp struct {
	SheepdogHdr
	SheepdogObjRspData
}

type SheepdogObjRspData

type SheepdogObjRspData struct {
	Result      uint32 // 4
	Copies      uint8  // 1
	CopyPolicy  uint8  // 1
	StorePolicy uint8  // 1

	Offset uint64
	// contains filtered or unexported fields
}

type SheepdogRawReq

type SheepdogRawReq struct {
	SheepdogHdr
	SheepdogRawReqData []byte
}

type SheepdogRawRsp

type SheepdogRawRsp struct {
	SheepdogHdr
	SheepdogRawRspData
}

type SheepdogRawRspData

type SheepdogRawRspData struct {
	Result uint32
	// contains filtered or unexported fields
}

type SheepdogRefReq

type SheepdogRefReq struct {
	SheepdogHdr
	SheepdogRefReqData
}

type SheepdogRefReqData

type SheepdogRefReqData struct {
	OID        uint64
	Generation uint32
	Count      uint32
	// contains filtered or unexported fields
}

type SheepdogVdiReq

type SheepdogVdiReq struct {
	SheepdogHdr
	SheepdogVdiReqData
}

type SheepdogVdiReqData

type SheepdogVdiReqData struct {
	Size           uint64
	Base           uint32
	Copies         uint8
	CopyPolicy     uint8
	StorePolicy    uint8
	BlockSizeShift uint8
	SnapshotID     uint32
	Type           uint32
	// contains filtered or unexported fields
}

type SheepdogVdiRsp

type SheepdogVdiRsp struct {
	SheepdogHdr
	SheepdogVdiRspData
}

type SheepdogVdiRspData

type SheepdogVdiRspData struct {
	Result         uint32
	Rsvd           uint32
	VdiID          uint32
	AttrID         uint32
	Copies         uint8
	BlockSizeShift uint8
	// contains filtered or unexported fields
}

type SheepdogVdiStateChkpntReq

type SheepdogVdiStateChkpntReq struct {
	SheepdogHdr
	SheepdogVdiStateChkpntReqData
}

type SheepdogVdiStateChkpntReqData

type SheepdogVdiStateChkpntReqData struct {
	Get      uint32
	TgtEpoch uint32
	VID      uint32
	// contains filtered or unexported fields
}

type SheepdogVdiStateReq

type SheepdogVdiStateReq struct {
	SheepdogHdr
	SheepdogVdiStateReqData
}

type SheepdogVdiStateReqData

type SheepdogVdiStateReqData struct {
	OldVID         uint32
	NewVID         uint32
	Copies         uint8
	SetBitmap      uint8
	CopyPolicy     uint8
	BlockSizeShift uint8
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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