dump

package
v0.0.0-...-7332f57 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Apache-2.0 Imports: 25 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

func InitHTMLTmpl

func InitHTMLTmpl()

func Key

func Key(key string) string

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.

Types

type Counter

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

Counter for redis memory useage

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

func (*Counter) GetLargestEntries

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

GetLargestEntries from heap, num max is 500

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
	// 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