Documentation
¶
Index ¶
- Constants
- type Decoder
- func (d *Decoder) Aux(key, value []byte)
- func (d *Decoder) EndHash(key []byte)
- func (d *Decoder) EndList(key []byte)
- func (d *Decoder) EndRDB()
- func (d *Decoder) EndSet(key []byte)
- func (d *Decoder) EndStream(key []byte, items uint64, lastEntryID string, cgroupsData rdb.StreamGroups)
- func (d *Decoder) EndZSet(key []byte)
- func (d *Decoder) GetTimestamp() int64
- func (d *Decoder) GetUsedMem() int64
- func (d *Decoder) Hset(key, field, value []byte)
- func (d *Decoder) Rpush(key, value []byte)
- func (d *Decoder) Sadd(key, member []byte)
- func (d *Decoder) Set(key, value []byte, expiry int64, info *rdb.Info)
- func (d *Decoder) StartHash(key []byte, length, expiry int64, info *rdb.Info)
- func (d *Decoder) StartList(key []byte, length, expiry int64, info *rdb.Info)
- func (d *Decoder) StartRDB(ver int)
- func (d *Decoder) StartSet(key []byte, cardinality, expiry int64, info *rdb.Info)
- func (d *Decoder) StartStream(key []byte, cardinality, expiry int64, info *rdb.Info)
- func (d *Decoder) StartZSet(key []byte, cardinality, expiry int64, info *rdb.Info)
- func (d *Decoder) Xadd(key, id, listpack []byte)
- func (d *Decoder) Zadd(key []byte, score float64, member []byte)
- type Entry
- type MemProfiler
- func (m *MemProfiler) ElemLen(element []byte) uint64
- func (m *MemProfiler) HashtableEntryOverhead() uint64
- func (m *MemProfiler) HashtableOverhead(size uint64) uint64
- func (m *MemProfiler) KeyExpiryOverhead(expiry int64) uint64
- func (m *MemProfiler) LinkedListEntryOverhead() uint64
- func (m *MemProfiler) LinkedlistOverhead() uint64
- func (m *MemProfiler) QuicklistOverhead(size uint64) uint64
- func (m *MemProfiler) RobjOverhead() uint64
- func (m *MemProfiler) SizeofStreamRadixTree(numElements uint64) uint64
- func (m *MemProfiler) SizeofString(bytes []byte) uint64
- func (m *MemProfiler) SkiplistEntryOverhead() uint64
- func (m *MemProfiler) SkiplistOverhead(size uint64) uint64
- func (m *MemProfiler) StreamCG() uint64
- func (m *MemProfiler) StreamConsumer(name []byte) uint64
- func (m *MemProfiler) StreamNACK(length uint64) uint64
- func (m *MemProfiler) StreamOverhead() uint64
- func (m *MemProfiler) TopLevelObjOverhead(key []byte, expiry int64) uint64
- func (m *MemProfiler) ZiplistEntryOverhead(value []byte) uint64
- func (m *MemProfiler) ZiplistHeaderOverhead() uint64
Constants ¶
const LRU_BITS = 24
RobjOverhead get memory useage of a robj
typedef struct redisobject { unsigned type:4; unsigned encoding:4; unsigned lru:lru_bits; /* lru time (relative to server.lruclock) */ int refcount; void *ptr; } robj;
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct { Entries chan *Entry nopdecoder.NopDecoder // contains filtered or unexported fields }
Decoder decode rdb file
func (*Decoder) EndRDB ¶
func (d *Decoder) EndRDB()
EndRDB is called when parsing of the RDB file is complete.
func (*Decoder) GetTimestamp ¶
func (*Decoder) GetUsedMem ¶
func (*Decoder) StartHash ¶
StartHash is called at the beginning of a hash. Hset will be called exactly length times before EndHash.
func (*Decoder) StartList ¶
StartList is called at the beginning of a list. Rpush will be called exactly length times before EndList. If length of the list is not known, then length is -1
func (*Decoder) StartSet ¶
StartSet is called at the beginning of a set. Sadd will be called exactly cardinality times before EndSet.
func (*Decoder) StartStream ¶
type Entry ¶
type Entry struct { Key string Bytes uint64 Type string NumOfElem uint64 LenOfLargestElem uint64 FieldOfLargestElem string }
Entry is info of a redis recored
type MemProfiler ¶
type MemProfiler struct{}
MemProfiler get memory use for all kinds of data stuct
func (*MemProfiler) ElemLen ¶
func (m *MemProfiler) ElemLen(element []byte) uint64
ElemLen get length of a element
func (*MemProfiler) HashtableEntryOverhead ¶
func (m *MemProfiler) HashtableEntryOverhead() uint64
HashtableEntryOverhead get memory use of hashtable entry See https://github.com/antirez/redis/blob/unstable/src/dict.h Each dictEntry has 3 pointers
typedef struct dictEntry { void *key; union { void *val; uint64_t u64; int64_t s64; double d; } v; struct dictEntry *next; } dictEntry;
func (*MemProfiler) HashtableOverhead ¶
func (m *MemProfiler) HashtableOverhead(size uint64) uint64
HashtableOverhead get memory use of a hashtable See https://github.com/antirez/redis/blob/unstable/src/dict.h See the structures dict and dictht 2 * (3 unsigned longs + 1 pointer) + int + long + 2 pointers
Additionally, see **table in dictht The length of the table is the next power of 2 When the hashtable is rehashing, another instance of **table is created Due to the possibility of rehashing during loading, we calculate the worse case in which both tables are allocated, and so multiply the size of **table by 1.5
func (*MemProfiler) KeyExpiryOverhead ¶
func (m *MemProfiler) KeyExpiryOverhead(expiry int64) uint64
KeyExpiryOverhead get memory useage of a key expiry Key expiry is stored in a hashtable, so we have to pay for the cost of a hashtable entry The timestamp itself is stored as an int64, which is a 8 bytes
func (*MemProfiler) LinkedListEntryOverhead ¶
func (m *MemProfiler) LinkedListEntryOverhead() uint64
LinkedListEntryOverhead get memory use of a linked list entry See https://github.com/antirez/redis/blob/unstable/src/adlist.h A node has 3 pointers
func (*MemProfiler) LinkedlistOverhead ¶
func (m *MemProfiler) LinkedlistOverhead() uint64
LinkedlistOverhead get memory use of a linked list See https://github.com/antirez/redis/blob/unstable/src/adlist.h A list has 5 pointers + an unsigned long
func (*MemProfiler) QuicklistOverhead ¶
func (m *MemProfiler) QuicklistOverhead(size uint64) uint64
func (*MemProfiler) RobjOverhead ¶
func (m *MemProfiler) RobjOverhead() uint64
func (*MemProfiler) SizeofStreamRadixTree ¶
func (m *MemProfiler) SizeofStreamRadixTree(numElements uint64) uint64
func (*MemProfiler) SizeofString ¶
func (m *MemProfiler) SizeofString(bytes []byte) uint64
SizeofString get memory use of a string https://github.com/antirez/redis/blob/unstable/src/sds.h
func (*MemProfiler) SkiplistEntryOverhead ¶
func (m *MemProfiler) SkiplistEntryOverhead() uint64
SkiplistEntryOverhead get memory use of a skiplist entry
func (*MemProfiler) SkiplistOverhead ¶
func (m *MemProfiler) SkiplistOverhead(size uint64) uint64
SkiplistOverhead get memory use of a skiplist
func (*MemProfiler) StreamCG ¶
func (m *MemProfiler) StreamCG() uint64
func (*MemProfiler) StreamConsumer ¶
func (m *MemProfiler) StreamConsumer(name []byte) uint64
func (*MemProfiler) StreamNACK ¶
func (m *MemProfiler) StreamNACK(length uint64) uint64
func (*MemProfiler) StreamOverhead ¶
func (m *MemProfiler) StreamOverhead() uint64
func (*MemProfiler) TopLevelObjOverhead ¶
func (m *MemProfiler) TopLevelObjOverhead(key []byte, expiry int64) uint64
TopLevelObjOverhead get memory use of a top level object Each top level object is an entry in a dictionary, and so we have to include the overhead of a dictionary entry
func (*MemProfiler) ZiplistEntryOverhead ¶
func (m *MemProfiler) ZiplistEntryOverhead(value []byte) uint64
func (*MemProfiler) ZiplistHeaderOverhead ¶
func (m *MemProfiler) ZiplistHeaderOverhead() uint64