2014-05-16 11:04:35 +04:00
|
|
|
package ledis
|
|
|
|
|
2014-05-20 04:41:24 +04:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
2014-05-16 11:04:35 +04:00
|
|
|
const (
|
|
|
|
kvType byte = iota + 1
|
|
|
|
hashType
|
|
|
|
hSizeType
|
|
|
|
listType
|
|
|
|
lMetaType
|
|
|
|
zsetType
|
|
|
|
zSizeType
|
|
|
|
zScoreType
|
|
|
|
)
|
2014-05-20 04:41:24 +04:00
|
|
|
|
2014-05-23 07:44:50 +04:00
|
|
|
const (
|
2014-05-23 08:39:56 +04:00
|
|
|
defaultScanCount int = 10
|
2014-05-23 07:44:50 +04:00
|
|
|
)
|
|
|
|
|
2014-05-20 04:41:24 +04:00
|
|
|
const (
|
|
|
|
//we don't support too many databases
|
|
|
|
MaxDBNumber uint8 = 16
|
|
|
|
|
|
|
|
//max key size
|
2014-05-28 10:20:34 +04:00
|
|
|
MaxKeySize int = 1024
|
2014-05-20 04:41:24 +04:00
|
|
|
|
|
|
|
//max hash field size
|
2014-05-28 10:20:34 +04:00
|
|
|
MaxHashFieldSize int = 1024
|
2014-05-20 04:41:24 +04:00
|
|
|
|
|
|
|
//max zset member size
|
2014-05-28 10:20:34 +04:00
|
|
|
MaxZSetMemberSize int = 1024
|
|
|
|
|
|
|
|
//max value size
|
|
|
|
MaxValueSize int = 10 * 1024 * 1024
|
2014-05-20 04:41:24 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
ErrKeySize = errors.New("invalid key size")
|
2014-05-28 10:20:34 +04:00
|
|
|
ErrValueSize = errors.New("invalid value size")
|
2014-05-20 04:41:24 +04:00
|
|
|
ErrHashFieldSize = errors.New("invalid hash field size")
|
|
|
|
ErrZSetMemberSize = errors.New("invalid zset member size")
|
|
|
|
)
|
2014-05-27 12:05:24 +04:00
|
|
|
|
|
|
|
const BinLogBaseName = "ledis-bin"
|
|
|
|
const BinLogIndexFile = "ledis-bin.index"
|
|
|
|
|
|
|
|
const (
|
|
|
|
MaxBinLogFileSize int = 1024 * 1024 * 1024
|
|
|
|
MaxBinLogFileNum int = 10000
|
|
|
|
|
|
|
|
DefaultBinLogFileSize int = MaxBinLogFileSize
|
|
|
|
DefaultBinLogFileNum int = 10
|
|
|
|
)
|
|
|
|
|
|
|
|
//like leveldb
|
|
|
|
const (
|
|
|
|
BinLogTypeDeletion uint8 = 0x0
|
|
|
|
BinLogTypeValue uint8 = 0x1
|
|
|
|
)
|