Versions in this module Expand all Collapse all v1 v1.2.0 Jun 23, 2020 Changes in this version + const BUCKET_SIZE + const BUCKET_STAT_EMPTY + const BUCKET_STAT_NOT_EMPTY + const BUCKET_STAT_READY + const COMPRESS_RATIO_LIMIT + const FLAG_CLIENT_COMPRESS + const FLAG_COMPRESS + const FLAG_INCR + const HEADER_SIZE + const HINTFILE_HEAD_SIZE + const HINTINDEX_ROW_SIZE + const HINTITEM_HEAD_SIZE + const HINT_SUFFIX + const HTREE_SUFFIX + const HintStateDump + const HintStateGC + const HintStateIdle + const HintStateMerge + const LEN_USE_C_FIND + const MAX_DEPTH + const MAX_KEY_LEN + const MAX_NUM_CHUNK + const MAX_NUM_SPLIT + const MERGED_HINT_SUFFIX + const PADDING + const SecsBeforeDumpDefault + const TREE_ITEM_HEAD_SIZE + const TRY_COMPRESS_SIZE + const ThresholdBigHash + const ThresholdListKeyDefault + var DefaultDBLocalConfig = DBLocalConfig + var DefaultDataConfig = DataConfig + var DefaultHTreeConfig HTreeConfig = HTreeConfig + var DefaultHintConfig = HintConfig + var SecsBeforeDump = SecsBeforeDumpDefault + func DataToHint(path string) (err error) + func DataToHintDir(path string, start, end int) (err error) + func DataToHintFile(path string) (err error) + func FreeMem() + func GetBucketDir(numBucket, bucketID int) string + func GetBucketPath(bucketID int) string + func Getvhash(value []byte) uint16 + func IsValidKeyString(key string) bool + func NeedCompress(header []byte) bool + func NewdataStore(bucketID int, home string) *dataStore + func ParsePathString(pathStr string, buf []int) ([]int, error) + func ParsePathUint64(khash uint64, buf []int) []int + func StartCpuProfile(name string) *os.File + func StopCpuProfile(f *os.File) + func WakeupFlush() + func WriteHeapProfile(name string) + type Bucket struct + GCHistory []GCState + func (bkt *Bucket) GetRecordByKeyHash(ki *KeyInfo) (rec *Record, inbuffer bool, err error) + type BucketInfo struct + DU int64 + HintState int + LastGC *GCState + MaxDumpedHintID HintID + NumGet int64 + NumSameVhash int64 + NumSet int64 + Pos Position + SizeSameVhash int64 + SizeVhashKey string + type BucketStat struct + Home string + ID int + NextGCChunk int + State int + TreeID HintID + type CollisionTable struct + Items map[uint64]map[string]HintItem + type DBLocalConfig struct + Home string + type DU struct + Buckets map[int]int64 + BucketsHex map[string]int64 + Disks map[string]utils.DiskStatus + Errs []string + func NewDU() (du *DU) + type DataConfig struct + BufIOCap int + BufIOCapStr string + CheckVHash bool + DataFileMax int64 + DataFileMaxStr string + FlushInterval int + FlushWake int64 + FlushWakeStr string + NoGCDays int + NotCompress map[string]bool + type DataStreamReader struct + func (stream *DataStreamReader) Close() error + func (stream *DataStreamReader) Next() (res *Record, offset uint32, sizeBroken uint32, err error) + func (stream *DataStreamReader) Offset() uint32 + type DataStreamWriter struct + func GetStreamWriter(path string, isappend bool) (*DataStreamWriter, error) + func (stream *DataStreamWriter) Append(rec *Record) (offset uint32, err error) + func (stream *DataStreamWriter) Close() error + func (stream *DataStreamWriter) Offset() uint32 + type GCFileState struct + NumBefore int64 + NumNotInHtree int64 + NumReleased int64 + NumReleasedDeleted int64 + SizeBefore int64 + SizeBroken int64 + SizeDeleted int64 + SizeReleased int64 + func (s *GCFileState) String() string + type GCMgr struct + func (mgr *GCMgr) AfterBucket(bkt *Bucket) + func (mgr *GCMgr) BeforeBucket(bkt *Bucket, startChunkID, endChunkID int, merge bool) + func (mgr *GCMgr) UpdateCollision(bkt *Bucket, ki *KeyInfo, oldPos, newPos Position, rec *Record) + func (mgr *GCMgr) UpdateHtreePos(bkt *Bucket, ki *KeyInfo, oldPos, newPos Position) + type GCState struct + Begin int + BeginTS time.Time + CancelFlag bool + Dst int + End int + EndTS time.Time + Err error + Running bool + Src int + type HStore struct + func NewHStore() (store *HStore, err error) + func (store *HStore) CancelGC(bucketID int) (src, dst int) + func (store *HStore) ChangeRoute(newConf config.DBRouteConfig) (loaded, unloaded []int, err error) + func (store *HStore) Close() + func (store *HStore) Flusher() + func (store *HStore) GC(bucketID, beginChunkID, endChunkID, noGCDays int, merge, pretend bool) (begin, end int, err error) + func (store *HStore) GCBuckets() map[string][]string + func (store *HStore) Get(ki *KeyInfo, memOnly bool) (payload *Payload, pos Position, err error) + func (store *HStore) GetBucketInfo(bucketID int) *BucketInfo + func (store *HStore) GetCollisionsByBucket(bucketID int) (content []byte) + func (store *HStore) GetDU() (du *DU) + func (store *HStore) GetNumCmdByBuckets() (counts [][]int64) + func (store *HStore) GetRecordByKeyHash(ki *KeyInfo) (*Record, bool, error) + func (store *HStore) HintDumper(interval time.Duration) + func (store *HStore) Incr(ki *KeyInfo, value int) int + func (store *HStore) IsGCRunning() bool + func (store *HStore) ListDir(ki *KeyInfo) ([]byte, error) + func (store *HStore) ListUpper(ki *KeyInfo) ([]byte, error) + func (store *HStore) NumKey() (n int) + func (store *HStore) Set(ki *KeyInfo, p *Payload) error + type HStoreConfig struct + var Conf *HStoreConfig + var KHASH_LENS = [8]int{ ... } + func (c *HStoreConfig) Init() error + func (c *HStoreConfig) InitDefault() + func (c *HStoreConfig) InitTree() error + type HTree struct + func (tree *HTree) ListDir(ki *KeyInfo) (ret []byte, err error) + func (tree *HTree) ListTop() + func (tree *HTree) Update() (node *Node) + type HTreeConfig struct + TreeDump int + TreeHeight int + type HTreeItem HintItemMeta + type HTreeReq struct + type HashFuncType func(key []byte) uint64 + type HintBuffer struct + func NewHintBuffer() *HintBuffer + func (h *HintBuffer) Dump(path string) (index *hintFileIndex, err error) + func (h *HintBuffer) Get(keyhash uint64, key string) (it *HintItem, iscollision bool) + func (h *HintBuffer) Set(it *HintItem, recSize uint32) bool + func (h *HintBuffer) SetMaxOffset(offset uint32) + type HintConfig struct + IndexIntervalSize int64 + IndexIntervalSizeStr string + MergeInterval int + NoMerged bool + SplitCap int64 + SplitCapStr string + type HintID struct + Chunk int + Split int + type HintItem struct + Key string + type HintItemMeta struct + Keyhash uint64 + Pos Position + Ver int32 + Vhash uint16 + type HintStatus struct + MaxRead int + MaxTime time.Duration + NumRead int + type HtreeDerivedConfig struct + TreeDepth int + TreeKeyHashLen int + TreeKeyHashMask uint64 + type ItemFunc func(uint64, *HTreeItem) + type KeyInfo struct + Key []byte + KeyHash uint64 + KeyIsPath bool + StringKey string + func NewKeyInfoFromBytes(key []byte, keyhash uint64, keyIsPath bool) (ki *KeyInfo) + func (ki *KeyInfo) Prepare() (err error) + type KeyPos struct + BucketID int + KeyPath []int + KeyPathBuf [16]int + KeyPathInBucket []int + type Meta struct + Flag uint32 + RecSize uint32 + TS uint32 + ValueHash uint16 + Ver int32 + type Node struct + type NodeInfo struct + type Payload struct + func GetPayloadForDelete() *Payload + func (p *Payload) CalcValueHash() + func (p *Payload) Copy() *Payload + func (p *Payload) Decompress() (err error) + func (p *Payload) DiffSizeAfterDecompressed() int + func (p *Payload) Getvhash() uint16 + func (p *Payload) IsCompressed() bool + func (p *Payload) RawValueSize() int + type Position struct + ChunkID int + Offset uint32 + func (pos *Position) CmpKey() int64 + type Record struct + Key []byte + Payload *Payload + func (rec *Record) Copy() *Record + func (rec *Record) Dumps() []byte + func (rec *Record) LogString() string + func (rec *Record) Size() uint32 + func (rec *Record) Sizes() (uint32, uint32) + func (rec *Record) TryCompress() + type SliceHeader struct + Data uintptr + Len int + func (sh *SliceHeader) Get(req *HTreeReq) (exist bool) + func (sh *SliceHeader) Iter(f ItemFunc, ni *NodeInfo) + func (sh *SliceHeader) Remove(ki *KeyInfo, oldPos Position) (oldm HTreeItem, removed bool) + func (sh *SliceHeader) Set(req *HTreeReq) (oldm HTreeItem, exist bool) + func (sh *SliceHeader) ToBytes() (b []byte) + type WriteRecord struct + func (wrec *WriteRecord) String() string