dump

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

This code is mostly copied from Beego BeeMap

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(c *cli.Context, decoder *decoder.Decoder, filepath string)

Decode ...

func Dump

func Dump(path string) (map[string]interface{}, error)

Dump rdb file statistical information, 此方法不再用了,因为有了输出到STDOUT 或 file

func Export_All_Keys added in v1.1.3

func Export_All_Keys(cli *cli.Context)

keys is function for command `keys` output all keys in rdb file(s) get from args

func GetData

func GetData(filename string, cnt *Counter, topN int, sizeFilter int64) map[string]interface{}

func InitHTMLTmpl

func InitHTMLTmpl()

func Key

func Key(key string) string

func ParseUnitToBytes added in v1.1.3

func ParseUnitToBytes(sizeStr string) (int64, error)

将带单位的字符串转换为字节数

func ServeHTML

func ServeHTML(w http.ResponseWriter, layout string, content string, data map[string]interface{})

ServeHTML generate and write html to client

func Show

func Show(c *cli.Context)

Show parse rdbfile(s) and show statistical information by html

func Slot

func Slot(key string) int

hashSlot returns a consistent slot number between 0 and 16383 for any given string key.

func ToCliWriter

func ToCliWriter(cli *cli.Context)

ToCliWriter dump rdb file statistical information to STDOUT.

func ToCliWriterToFile added in v1.0.6

func ToCliWriterToFile(cli *cli.Context)

ToCliWriter dump rdb file statistical information to file.

Types

type Counter

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

Counter for redis memory usage

func NewCounter

func NewCounter() *Counter

NewCounter return a pointer of Counter

func (*Counter) Count

func (c *Counter) Count(in <-chan *decoder.Entry)

Count by various dimensions,show.go NewCounter 后,调用此方法,遍历decoder的entry, <-chan表示一个只能接收数据的单向通道

func (*Counter) GetLargestEntries

func (c *Counter) GetLargestEntries(num int, sizeFilter int64) []*decoder.Entry

GetLargestEntries from heap, num max is 500. 过滤掉小于阈值的key

func (*Counter) GetLargestKeyPrefixes

func (c *Counter) GetLargestKeyPrefixes() []*PrefixEntry

GetLargestKeyPrefixes from heap

func (*Counter) GetLenLevelCount

func (c *Counter) GetLenLevelCount() []*PrefixEntry

GetLenLevelCount from map

type PrefixEntry

type PrefixEntry struct {
	Bytes uint64
	Num   uint64
	Db    string //之前为int
	// contains filtered or unexported fields
}

PrefixEntry record value by prefix

type SafeMap

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

SafeMap is a map which concurrency safe

func NewSafeMap

func NewSafeMap() *SafeMap

NewSafeMap return new safemap

func (*SafeMap) Check

func (m *SafeMap) Check(k interface{}) bool

Check seturns true if k is exist in the map.

func (*SafeMap) Delete

func (m *SafeMap) Delete(k interface{})

Delete the given key and value.

func (*SafeMap) Get

func (m *SafeMap) Get(k interface{}) interface{}

Get from maps return the k's value

func (*SafeMap) Items

func (m *SafeMap) Items() map[interface{}]interface{}

Items returns all items in safemap.

func (*SafeMap) Set

func (m *SafeMap) Set(k interface{}, v interface{}) bool

Set the given key and value. Returns false if the key is already in the map and changes nothing.

func (*SafeMap) String

func (m *SafeMap) String() (s string)

String transfer map into json

type SlotEntry

type SlotEntry struct {
	Slot int
	Size uint64
}

support for sorting of slots

Jump to

Keyboard shortcuts

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