rdb

package
v0.0.0-...-8bd0779 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

README

rdb

suport redis RDB format, in order to support migrate (restore) <-> redis.

  1. support redis RDB version 6 dump encode.
  2. support redis RDB version 1 <= version <= 10(Redis 7.0) parse decode.

reference

Documentation

Overview

Package crc64 implements the Jones coefficients with an init value of 0.

Index

Constants

View Source
const (
	RDBFlagAux      = 0xfa
	RDBFlagResizeDB = 0xfb
	RDBFlagExpiryMS = 0xfc
	RDBFlagExpiry   = 0xfd
	RDBFlagSelectDB = 0xfe
	RDBFlagEOF      = 0xff
)
View Source
const Version = 6

Variables

This section is empty.

Functions

func DecodeDump

func DecodeDump(p []byte) (interface{}, error)

func Digest

func Digest(b []byte) uint64

func DumpHashValue

func DumpHashValue(v Hash) []byte

RDB payload: | RDB TYPE HASH | len (encode hash) | len(encode field) | encode field | len(encode value) | encode value |.....|

func DumpListValue

func DumpListValue(v List) []byte

RDB payload: | RDB TYPE LIST | len (encode list) | len(encode value) | encode value |.....|

func DumpSetValue

func DumpSetValue(v Set) []byte

RDB payload: | RDB TYPE SET | len (encode set) | len(encode value) | encode value |.....|

func DumpStringValue

func DumpStringValue(v String) []byte

RDB payload: | RDB TYPE STRING | len (encode string) | encode string |

func DumpZSetValue

func DumpZSetValue(v ZSet) []byte

RDB payload: | RDB TYPE ZSET | len (encode zset) | len(encode member) | encode member | len(encode score) | encode score |.....|

func NewCrc64

func NewCrc64() hash.Hash64

Types

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) EncodeDatabase

func (e *Encoder) EncodeDatabase(n int) error

func (*Encoder) EncodeDumpFooter

func (e *Encoder) EncodeDumpFooter() error

func (*Encoder) EncodeExpiry

func (e *Encoder) EncodeExpiry(expiry uint64) error

func (*Encoder) EncodeFloat

func (e *Encoder) EncodeFloat(f float64) (err error)

func (*Encoder) EncodeFooter

func (e *Encoder) EncodeFooter() error

func (*Encoder) EncodeHeader

func (e *Encoder) EncodeHeader() error

func (*Encoder) EncodeLength

func (e *Encoder) EncodeLength(l uint32) (err error)

func (*Encoder) EncodeString

func (e *Encoder) EncodeString(s []byte) error

func (*Encoder) EncodeType

func (e *Encoder) EncodeType(v ValueType) error

type Hash

type Hash []struct {
	Field, Value []byte
}

type List

type List [][]byte

type Set

type Set [][]byte

type String

type String []byte

type ValueType

type ValueType byte

type ZSet

type ZSet []struct {
	Member []byte
	Score  float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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