Documentation ¶
Index ¶
- Constants
- Variables
- func BlocksToExtent2(path string, records RecordSlice) bool
- func BytesToUint64(bytes []byte) uint64
- func CompactExtent2(path string) bool
- func CompactMemExtent(ext *Extent)
- func DecodeHead(head []byte) (byte, uint64, uint64, uint64)
- func EncodeDrop(table []byte) []byte
- func EncodeGet(table, key []byte) []byte
- func EncodeHead(code byte, tlen, klen, vlen uint64) []byte
- func EncodeSet(table, key, value []byte) []byte
- func EncodeSym(code byte) []byte
- func GpollAdd(state *GpollState, ev *EpollEvent) bool
- func GpollDel(state *GpollState, ev *EpollEvent) bool
- func GpollMod(state *GpollState, ev *EpollEvent) bool
- func GpollWait(state *GpollState) int
- func HashTableKey(table, key []byte) uint64
- func MergeExtents2(path string, ext0, ext1 *Extent) bool
- func MoreCmd(code byte) bool
- func Reallocate(addr string)
- func SetKeepAlive(sockfd, v int) error
- func SetLinger(sockfd int, sec int) error
- func SetNoDelay(sockfd int) error
- func StartServer(addr string)
- func Uint64ToBytes(x uint64) []byte
- func WriteBlocks(blx *Blocks) bool
- type Blocks
- type COLA
- type Extent
- type GpollLoop
- type GpollState
- type Record
- type RecordSlice
- type Storage
- func (strg *Storage) COLA(name []byte) *COLA
- func (strg *Storage) Drop(table []byte) bool
- func (strg *Storage) ExistentCOLA(name []byte) *COLA
- func (strg *Storage) Get(table, key []byte) []byte
- func (strg *Storage) Keys(table []byte) []string
- func (strg *Storage) OpenAll() bool
- func (strg *Storage) Set(table, key, value []byte) bool
- func (strg *Storage) Size(table []byte) uint64
- type WriteBuf
Constants ¶
View Source
const ( S_IRALL uint32 = S_IRUSR | S_IRGRP | S_IROTH S_IWALL uint32 = S_IWUSR | S_IWGRP | S_IWOTH S_IXALL uint32 = S_IXUSR | S_IXGRP | S_IXOTH S_IRWXA uint32 = S_IRALL | S_IWALL | S_IXALL MAX_RECORDS uint64 = 1 << 12 BLX_BUF_SIZE int64 = int64(1) << 20 * 16 MAX_CONNS int = 10000 MAX_TABLES int = 10000 REPLICA_FACTOR int = 3 )
* DO NOT MODIFY THE VALUES BELOW IF YOU HAVE NO IDEA WHAT THEY ARE.
View Source
const ( /* | CMD_CODE : 7 bits | ======== | TABLE_NAME_LEN : 7 bits | Head | KEY_LEN : 20 bits | 64 bits | VALUE_LEN : 30 bits | ======== | TABLE_NAME : $TABLE_NAME_LEN bytes | | KEY : $KEY_LEN bytes | | VALUE : $VALUE_LEN bytes | */ CMD_CODE_BITS = 7 TABLE_NAME_BITS = 7 KEY_BITS = 20 VALUE_BITS = 30 MAX_TABLE_NAME_LEN = uint64(1)<<TABLE_NAME_BITS - 1 MAX_KEY_LEN = uint64(1)<<KEY_BITS - 1 MAX_VALUE_LEN = uint64(1)<<VALUE_BITS - 1 GET_CODE byte = 0x01 SET_CODE byte = 0x02 DEL_CODE byte = 0x03 SIZE_CODE byte = 0x0D KEYS_CODE byte = 0x0E DROP_CODE byte = 0x0F MGET_CODE byte = 0x11 MSET_CODE byte = 0x12 MDEL_CODE byte = 0x13 QUIT_CODE byte = 0x21 /* Client quits */ WORK_CODE byte = 0x22 /* Server ready */ RALC_CODE byte = 0x23 /* Reallocate */ DSTR_CODE byte = 0x24 /* Distribute */ EXPL_CODE byte = 0x25 /* Expel */ OK_CODE byte = 0x30 ERR_CODE byte = 0x3F )
View Source
const DB_DIR string = "/home/wiza/mpdb"
Variables ¶
View Source
var CLUSTER_TAG uint64
View Source
var REPLICA bool = false
View Source
var SERVERS = [...]string{
"192.168.3.139:6631",
}
Functions ¶
func BlocksToExtent2 ¶
func BlocksToExtent2(path string, records RecordSlice) bool
* THE FUNCTIONS BELOW ARE OF NO USE ANYMORE.
func BytesToUint64 ¶
func CompactExtent2 ¶
func CompactMemExtent ¶
func CompactMemExtent(ext *Extent)
func EncodeDrop ¶
func EncodeHead ¶
func GpollAdd ¶
func GpollAdd(state *GpollState, ev *EpollEvent) bool
func GpollDel ¶
func GpollDel(state *GpollState, ev *EpollEvent) bool
func GpollMod ¶
func GpollMod(state *GpollState, ev *EpollEvent) bool
func GpollWait ¶
func GpollWait(state *GpollState) int
func HashTableKey ¶
func MergeExtents2 ¶
func Reallocate ¶
func Reallocate(addr string)
func SetKeepAlive ¶
func SetNoDelay ¶
func StartServer ¶
func StartServer(addr string)
func Uint64ToBytes ¶
func WriteBlocks ¶
Types ¶
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
func LoadBlocks ¶
func OpenBlocks ¶
func (*Blocks) Records ¶
func (blx *Blocks) Records() RecordSlice
type Extent ¶
type Extent struct {
// contains filtered or unexported fields
}
func BlocksToMemExtent ¶
func BlocksToMemExtent(records RecordSlice) *Extent
func MergeMemExtents ¶
func OpenExtent ¶
func OpenMemExtent ¶
type GpollLoop ¶
type GpollLoop struct { Lfd int32 State *GpollState Ready int }
type GpollState ¶
type GpollState struct { Epfd int Events []EpollEvent }
func GpollCreate ¶
func GpollCreate(maxEvents int) (*GpollState, bool)
type RecordSlice ¶
type RecordSlice []Record
func (RecordSlice) Len ¶
func (recs RecordSlice) Len() int
func (RecordSlice) Less ¶
func (recs RecordSlice) Less(i, j int) bool
func (RecordSlice) Swap ¶
func (recs RecordSlice) Swap(i, j int)
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func NewStorage() *Storage
func (*Storage) ExistentCOLA ¶
Click to show internal directories.
Click to hide internal directories.