Help us shape the future of Go! Take the 2026 Go Developer Survey

rdb

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 14 Imported by: 0

README

Go Reference

RDB

An RDB (Redis Database) reader and writer written in Go.

Introduction

RDB is a very compact single-file point-in-time representation of your Redis data.

Source: https://redis.io/docs/management/persistence/#rdb-advantages

The goal of this project is to create an implementation based on the documents and during the implementation, learn.

Production readiness

This project is still in development phase. In this stage the public API can change any time.

Beta version will be considered when the feature set covers the documents the implementation is based on, and the public API is reached a mature state.

Stable version will be considered only if enough positive feedback is gathered to lock the public API.

rdbc

rdbc is a CLI tool that is part of this project. I found that the best way to design the API of the library is to use it. "Eating your own dog food."

usage: rdbc <command> [flags] [args...]

commands:
  client    connect to a Redis compatible server and read/write to it
  transfer  transfer the keys between files and Redis compatible servers
  serve     serve an RDB file to connecting replicas
  stat      show size statistics of the keyspace of a server

Documents

Official sites
Unofficial sites

Inspiration

Inspiration for the implementation comes from the following places:

Similar libraries

Last updated: 2026-10-12

URL Status
https://github.com/HDT3213/rdb In active development
https://github.com/siddontang/rdb Last updated on 17 Mar 2015
https://github.com/tent/rdb Archived
https://github.com/tommy351/rdb-go Last updated on 31 Oct 2023

Documentation

Overview

Package rdb implements reading and writing of the RDB dump file format of Redis and its compatible forks.

An RDB file is a sequence of records: a header with a magic string and a version, metadata records such as the selected database, the expiry timestamps and the auxiliary fields, and the key value records themselves. The FileDecoder and FileEncoder types read and write an RDB file: the header names the dialect and the version of the file, the records follow it, and the checksum at its end is verified or written. The Encoder and Decoder types are used to write or read the records of a file.

Tokens and Op Codes

A Token is the unit of data a Decoder reads and an Encoder writes. Every value record starts with an OpCode that dispatches the shape of the tokens that follow it, the handlers behind the op code produce them one by one: the key of a record, the number of the entries of a list, the entries themselves, and so on.

A token stores its value in one of two forms. Tokens read from a stream hold the raw bytes of the value, which stay volatile until Token.Clone copies them out. Tokens built by the constructors (e.g., Str, Uint) hold their values instead, and the [Blob] and Packed constructors hold the raw bytes to write verbatim. Both provide the same view: the value methods return the value wherever it is stored, and Token.AsBytes returns the wire format.

Dialects

Compatible forks of Redis reuse the file format but drift in their op codes and headers. A Dialect abstracts those differences: a FileDecoder detects the dialect of a file from its header using a registry, a FileEncoder writes the header of the dialect it is constructed with. RegisterDialect adds support for a fork the package does not ship.

The dialects are version aware. A dialect value represents the format of one version, Dialect.WithVersion binds another one, and a version out of range falls back to the newest one the dialect supports. The dispatch of the op codes fails for the op codes the dialect does not support and for the ones introduced after the version of the dialect: a decoder rejects the records a file of its version cannot carry, an encoder rejects them when the file is written with an earlier one.

Index

Examples

Constants

View Source
const (
	ModuleOpCodeEOF = iota
	ModuleOpCodeSInt
	ModuleOpCodeUInt
	ModuleOpCodeFloat
	ModuleOpCodeDouble
	ModuleOpCodeString
)

The op codes of a module value.

View Source
const (

	// DefaultBufferLen is the initial size of the buffer
	// each Decoder allocates.
	DefaultBufferLen = 8 * kB
)

Variables

View Source
var (
	// ErrMissingMagicString indicates that a file could not be decoded
	// because it does not start with a magic string followed by a
	// version number.
	ErrMissingMagicString = errors.New("rdb: missing magic string")
	// ErrInvalidVersion indicates that a version is not a version of
	// the RDB format: the digits of a header do not parse as a version
	// number, or an encoder is given a version its dialect does not
	// support.
	ErrInvalidVersion = errors.New("rdb: invalid version")
	// ErrUnsupportedVersion indicates that a file could not be decoded
	// because no dialect in the registry accepts its header.
	// See [RegisterDialect] to add support for a fork of Redis.
	ErrUnsupportedVersion = errors.New("rdb: unsupported version")
	// ErrInvalidChecksum indicates that a file could not be decoded
	// because the checksum at its end does not match its content.
	// An all-zero checksum passes the validation, the way Redis
	// disables it.
	ErrInvalidChecksum = errors.New("rdb: invalid checksum")
	// ErrUnexpectedToken indicates that a token could not be encoded
	// because it cannot appear at the current position of the stream:
	// every record starts with an op code.
	ErrUnexpectedToken = errors.New("rdb: unexpected token")
	// ErrInvalidOpCode indicates that a token could not be encoded or
	// decoded because the dialect of the file assigns no meaning to
	// its op code.
	ErrInvalidOpCode = errors.New("rdb: invalid opcode")
	// ErrOpCodeTooNew indicates that a record could not be encoded or
	// decoded because its op code was introduced in a version of the
	// RDB format newer than the version of the dialect.
	ErrOpCodeTooNew = errors.New("rdb: op code newer than the file version")
	// ErrCorruptPayload indicates that a value could not be decoded
	// because a packed encoding inside it is malformed.
	ErrCorruptPayload = errors.New("rdb: corrupt payload")
)

Functions

func LenBytes

func LenBytes(v uint64) []byte

LenBytes returns the canonical length encoding of v, using the shortest possible form.

func RegisterDialect

func RegisterDialect(d Dialect)

RegisterDialect adds d to the registry Decoders use to detect the dialect of a file from its header. It allows supporting forks of Redis that ship their own header or assign different meanings to op codes. The dialects of the registry are unbound, a bound one only detects the files of the version it represents.

Types

type ArrayDecoder

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

ArrayDecoder reads a sparse array: the element count, the optional insert index and the tagged elements.

func (ArrayDecoder) Handle

func (h ArrayDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type ArrayEncoder

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

ArrayEncoder writes a sparse array: the element count, the optional insert index and the tagged elements.

func (ArrayEncoder) Handle

func (h ArrayEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type ByteTokenDecoder

type ByteTokenDecoder struct {
	// N is the number of bytes the value stores.
	N int
}

ByteTokenDecoder reads N raw bytes.

func (ByteTokenDecoder) Handle

func (h ByteTokenDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type ByteTokenEncoder

type ByteTokenEncoder struct {
	// N is the number of bytes the value stores.
	N int
}

ByteTokenEncoder writes N raw bytes.

func (ByteTokenEncoder) Handle

func (h ByteTokenEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type CronDecoder

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

CronDecoder reads a KeyDB cron job: the script, the start time, the interval and the key and value arguments.

func (CronDecoder) Handle

func (h CronDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type CronEncoder

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

CronEncoder writes a KeyDB cron job: the script, the start time, the interval and the key and value arguments.

func (CronEncoder) Handle

func (h CronEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type Decoder

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

Decoder is a streaming decoder for the records of an RDB file. It is used to read the records of a file token by token.

The tokens of a record are read in the order the file stores them: the op code of a record starts it, the tokens of its key and value follow it, see TokenDecoder. The header of the file and the checksum at its end are the business of FileDecoder.

A Token returned by Decoder.ReadToken points into the internal buffer of the Decoder and is only valid until the next call to any method on that Decoder. Call Token.Clone to keep it.

func NewDecoder

func NewDecoder(r io.Reader, dialect Dialect) *Decoder

NewDecoder constructs a new decoder reading the records of an RDB file from r. The dialect dispatches the op codes of the records and gates the versions they were introduced in. The zero dialect selects the RedisDialect in its newest version.

func (*Decoder) ReadToken

func (d *Decoder) ReadToken() (Token, error)

ReadToken reads the next Token of the file, advancing the read offset. It returns io.EOF when there are no more tokens. The returned token is only valid until the next call to any method on that Decoder, see Token.Clone.

func (*Decoder) SkipValue

func (*Decoder) SkipValue() error

SkipValue is equivalent to calling Decoder.ReadToken and discarding the result until the current value is complete, except that memory is not wasted trying to hold the entire value.

type Dialect

type Dialect interface {
	// Header returns the magic string and the version the dialect
	// represents. The header is padded to nine bytes.
	Header() (magic string, version int)
	// OpCodeInfo returns the info object of the op code in this dialect.
	OpCodeInfo(op OpCode) OpCodeInfo
	// WithVersion returns the dialect bound to the version. A version
	// the dialect does not support falls back to the newest one it
	// supports.
	WithVersion(version int) Dialect
	// Commands returns the command table of the dialect.
	Commands() commands.Table
	// Decoder returns the token decoder of the op code. It fails with
	// [ErrInvalidOpCode] when the dialect assigns no meaning to the op
	// code and with [ErrOpCodeTooNew] when the op code was introduced
	// in a version newer than the one of the dialect.
	Decoder(op OpCode) (TokenDecoder, error)
	// Encoder is the write side of [Dialect.Decoder].
	Encoder(op OpCode) (TokenEncoder, error)
}

Dialect abstracts the differences between implementations of the RDB format. Every dialect owns its op code dispatch, the token handlers they return are shared. Decoders detect the dialect of a file from its header using the registry, Encoders write the header of the dialect they are constructed with.

The dialects are version aware: a dialect value represents the format of one version, every op code was introduced in a version of the format, files of an earlier version cannot contain it.

type Encoder

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

Encoder is a streaming encoder for the records of an RDB file. It is used to write the records of a file token by token.

Every value record starts with an op code token that selects the handler behind it, the tokens of its key and value follow it, see TokenEncoder. The header of the file and the checksum at its end are the business of FileEncoder.

The dialect of the records is fixed when the Encoder is constructed, see NewEncoder.

func NewEncoder

func NewEncoder(w io.Writer, dialect Dialect) *Encoder

NewEncoder constructs a new encoder writing the records of an RDB file to w. The dialect dispatches the op codes of the records and gates the versions they were introduced in. The zero dialect selects the RedisDialect in its newest version.

func (*Encoder) WriteToken

func (e *Encoder) WriteToken(t Token) error

WriteToken writes the next token of the record and advances the internal write offset. The provided token must be consistent with the grammar of the RDB format: an op code token starts a record, the tokens of its value follow it, the end of file token is written verbatim, the checksum of the file is the business of FileEncoder.

func (*Encoder) WriteTokens

func (e *Encoder) WriteTokens(t ...Token) error

WriteTokens writes the tokens of the records in the order they are given.

type ExpiryTokenDecoder

type ExpiryTokenDecoder struct{}

ExpiryTokenDecoder reads the expiry timestamp of a key.

func (ExpiryTokenDecoder) Handle

type ExpiryTokenEncoder

type ExpiryTokenEncoder struct{}

ExpiryTokenEncoder writes the expiry timestamp of a key.

func (ExpiryTokenEncoder) Handle

func (h ExpiryTokenEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type FileDecoder

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

FileDecoder reads an RDB file: the header of the file, the records behind it, and the checksum at its end. The header names the dialect of the file and binds it to the version of the file, the checksum is verified when the end of file token ends the file.

A Token returned by FileDecoder.ReadToken points into the internal buffer of the Decoder behind it and is only valid until the next call to any method on that FileDecoder. Call Token.Clone to keep it.

func NewFileDecoder

func NewFileDecoder(r io.Reader, dialect Dialect) *FileDecoder

NewFileDecoder constructs a new streaming decoder reading the file from r. The checksum of the file is verified transparently while reading. The dialect forces the dispatch of the op codes when it is set, a nil dialect detects it from the magic string of the header, see RegisterDialect to add support for a fork of Redis.

Example
package main

import (
	"fmt"
	"log"
	"strings"

	"github.com/coding-socks/rdb"
)

func main() {
	d := rdb.NewFileDecoder(strings.NewReader(data), nil)
	dial, err := d.Dialect()
	if err != nil {
		log.Fatalf("could not read the header: %v", err)
	}
	magic, ver := dial.Header()
	fmt.Printf("%s%d\n", magic, ver)

}

var data = "REDIS0011"
Output:
REDIS11

func (*FileDecoder) Dialect

func (f *FileDecoder) Dialect() (Dialect, error)

Dialect returns the dialect of the file, the dialect the header names bound to the version of the header. A dialect given to NewFileDecoder skips the detection and binds the version of the header. It reports the header errors (ErrMissingMagicString, ErrInvalidVersion, ErrUnsupportedVersion) when the file does not start a supported dialect.

func (*FileDecoder) ReadToken

func (f *FileDecoder) ReadToken() (Token, error)

ReadToken reads the next Token of the file, advancing the read offset. The end of file token verifies the checksum and is returned with its error, the reads behind a verified end report io.EOF. The returned token is only valid until the next call to any method on that FileDecoder, see Token.Clone.

type FileEncoder

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

FileEncoder writes an RDB file: the header of the file, the records behind it, and the checksum at its end. The header carries the magic string and the version of the dialect, the end of file token closes the file with the checksum of the written bytes. The versions before 5 carry no checksum, the way Redis writes none for them. The tokens behind an end of file token write on, a further end of file token writes another checksum, the merged payloads of a sync transfer among them.

func NewFileEncoder

func NewFileEncoder(w io.Writer, dialect Dialect) *FileEncoder

NewFileEncoder constructs a new streaming encoder writing the file to w. The dialect is the dialect of the output file: the header carries the version the dialect represents and the file may only contain the op codes of the version and the ones before it. The zero dialect selects the RedisDialect in its newest version.

The header of the file is written with the first token and the checksum with the end of file token.

func (*FileEncoder) WriteToken

func (f *FileEncoder) WriteToken(t Token) error

WriteToken writes the next token of the file and advances the internal write offset. The provided token must be consistent with the grammar of the RDB format: an op code token starts a record, the tokens of its value follow it, and the end of file token closes the file with its checksum. A version the dialect does not support fails the first token with ErrInvalidVersion, the bytes of the header are written behind it.

func (*FileEncoder) WriteTokens

func (f *FileEncoder) WriteTokens(t ...Token) error

WriteTokens writes the tokens of the file in the order they are given.

type Hash2Decoder

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

Hash2Decoder reads a Valkey hash with per field expiry: the number of entries and for each entry the field, the value and the expiry. Valkey stores it under the value type Redis uses for HashMetadataPreGa.

func (Hash2Decoder) Handle

func (h Hash2Decoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type Hash2Encoder

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

Hash2Encoder writes a Valkey hash with per field expiry: the number of entries and for each entry the field, the value and the expiry. Valkey stores it under the value type Redis uses for HashMetadataPreGa.

func (Hash2Encoder) Handle

func (h Hash2Encoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type HashDecoder

type HashDecoder struct{}

HashDecoder reads the field count of a hash and continues with the field and value strings.

func (HashDecoder) Handle

func (h HashDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type HashEncoder

type HashEncoder struct{}

HashEncoder writes the field count of a hash and continues with the field and value strings.

func (HashEncoder) Handle

func (h HashEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type HashListpackExDecoder

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

HashListpackExDecoder reads the minimum expiry of the fields and the entries of a hash with per field expiry stored as a listpack.

func (HashListpackExDecoder) Handle

type HashListpackExEncoder

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

HashListpackExEncoder writes the minimum expiry of the fields and the entries of a hash with per field expiry stored as a listpack.

func (HashListpackExEncoder) Handle

type HashMetadataDecoder

type HashMetadataDecoder struct {
	// Step is 0 for the released format and 1 for the pre-release format
	// without the minimum expiry.
	Step uint8
	// contains filtered or unexported fields
}

HashMetadataDecoder reads a hash with per field expiry: the minimum expiry of the fields, the field count and the fields with their expiry. The pre-release format has no minimum expiry, so construct it with Step 1.

func (HashMetadataDecoder) Handle

type HashMetadataEncoder

type HashMetadataEncoder struct {
	// Step is 0 for the released format and 1 for the pre-release format
	// without the minimum expiry.
	Step uint8
	// contains filtered or unexported fields
}

HashMetadataEncoder writes a hash with per field expiry: the minimum expiry of the fields, the field count and the fields with their expiry. The pre-release format has no minimum expiry, so construct it with Step 1.

func (HashMetadataEncoder) Handle

func (h HashMetadataEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type HashTemplateDecoder

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

HashTemplateDecoder reads a hash template record and registers its field count, so hash values can reference it by ID.

func (HashTemplateDecoder) Handle

type HashTemplateEncoder

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

HashTemplateEncoder writes a hash template record and registers its field count, so hash values can reference it by ID.

func (HashTemplateEncoder) Handle

func (h HashTemplateEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type HashTmplArrayRefDecoder

type HashTmplArrayRefDecoder struct{}

HashTmplArrayRefDecoder reads the template ID of an array referenced hash and continues with as many value strings as the template has fields.

func (HashTmplArrayRefDecoder) Handle

type HashTmplArrayRefEncoder

type HashTmplArrayRefEncoder struct{}

HashTmplArrayRefEncoder writes the template ID of an array referenced hash and continues with as many value strings as the template has fields.

func (HashTmplArrayRefEncoder) Handle

type HashTmplSelfDecoder

type HashTmplSelfDecoder struct {
	// LP selects the listpack encoding of the hash values.
	LP bool
	// contains filtered or unexported fields
}

HashTmplSelfDecoder reads a self-contained template encoded hash, which carries its field names inline. LP selects the listpack value encoding.

func (HashTmplSelfDecoder) Handle

type HashTmplSelfEncoder

type HashTmplSelfEncoder struct {
	LP bool
	// contains filtered or unexported fields
}

HashTmplSelfEncoder writes a self-contained template encoded hash, which carries its field names inline. LP selects the listpack value encoding.

func (HashTmplSelfEncoder) Handle

func (h HashTmplSelfEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type KeyDBDialect

type KeyDBDialect struct {
	// V is the version of the RDB format the dialect represents.
	// The zero version selects the newest one the dialect supports.
	V int
}

KeyDBDialect is the dialect of KeyDB. KeyDB files share the Redis magic string, so the dialect cannot be detected from a header and has to be set explicitly on the Decoder.

func (KeyDBDialect) Commands

func (d KeyDBDialect) Commands() commands.Table

func (KeyDBDialect) Decoder

func (d KeyDBDialect) Decoder(op OpCode) (TokenDecoder, error)

Decoder returns the token decoder of the KeyDB op code. It fails with ErrInvalidOpCode when the dialect assigns no meaning to the op code and with ErrOpCodeTooNew when the op code was introduced in a version newer than the one of the dialect.

func (KeyDBDialect) Encoder

func (d KeyDBDialect) Encoder(op OpCode) (TokenEncoder, error)

Encoder is the write side of KeyDBDialect.Decoder.

func (KeyDBDialect) Header

func (d KeyDBDialect) Header() (string, int)

Header returns the magic string of KeyDB and the version of the dialect. The zero V selects the newest one the dialect supports.

func (KeyDBDialect) OpCodeInfo added in v0.1.3

func (KeyDBDialect) OpCodeInfo(op OpCode) OpCodeInfo

func (KeyDBDialect) WithVersion

func (d KeyDBDialect) WithVersion(version int) Dialect

WithVersion returns the dialect bound to the version. The zero version binds the newest one the dialect supports.

type KeyDecoder

type KeyDecoder struct {
	// Next is the handler of the value that follows the key.
	Next TokenDecoder
}

KeyDecoder reads a key name and continues with Next.

func (KeyDecoder) Handle

func (h KeyDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type KeyMetaDecoder

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

KeyMetaDecoder reads key metadata: the number of metadata classes and for each class its specification and module values.

func (KeyMetaDecoder) Handle

func (h KeyMetaDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type KeyMetaEncoder

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

KeyMetaEncoder writes key metadata: the number of metadata classes and for each class its specification and module values.

func (KeyMetaEncoder) Handle

func (h KeyMetaEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type KeyTokenEncoder

type KeyTokenEncoder struct {
	// Next is the encoder of the value that follows the key.
	Next TokenEncoder
}

KeyTokenEncoder writes a key name and continues with Next.

func (KeyTokenEncoder) Handle

func (h KeyTokenEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type Kind

type Kind uint16

Kind tells which of the accessors of a Token carry its value:

A Kind without an accessor carries the raw bytes only. Every kind but KindUnknown, the zero value, has a constructor.

const (
	KindUnknown Kind = iota
	KindExpiry
	KindOpCode
	KindByte
	KindUint
	KindInt
	KindFloat32
	KindFloat64
	KindString

	KindQuickList
	KindZipMap
	KindZipList
	KindSetIntSet
	KindZsetList

	KindStreamID
	KindTime
)

func (Kind) String

func (k Kind) String() string

String returns the name of the kind.

type ListDecoder

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

ListDecoder reads the entries of a list or a set.

func (ListDecoder) Handle

func (h ListDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type ListEncoder

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

ListEncoder writes the entries of a list or a set.

func (ListEncoder) Handle

func (h ListEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type Module2Decoder

type Module2Decoder struct {
	// Step is 0 for a module value and 1 for a module auxiliary value.
	Step uint8
}

Module2Decoder reads a module value: the key name, the module ID and the module values. Module auxiliary values omit the key name. They start from the module ID, so construct them with Step 1.

func (Module2Decoder) Handle

func (h Module2Decoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type Module2Encoder

type Module2Encoder struct {
	// Step is 0 for a module value and 1 for a module auxiliary value.
	Step uint8
}

Module2Encoder writes a module value: the key name, the module ID and the module values. Module auxiliary values omit the key name. They start from the module ID, so construct them with Step 1.

func (Module2Encoder) Handle

func (h Module2Encoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type OpCode

type OpCode byte

OpCode is one byte of an RDB file that dispatches the record it starts. Its meaning depends on the Dialect of the file.

const (
	// KeyDBOpCodeEndOfRDB indicates the end of an RDB file.
	KeyDBOpCodeEndOfRDB OpCode = 0xff - iota
	// KeyDBOpCodeSelectDB indicates a new database.
	KeyDBOpCodeSelectDB
	// KeyDBOpCodeExpirySeconds indicates an expiry time in seconds.
	KeyDBOpCodeExpirySeconds
	// KeyDBOpCodeExpiryMilli indicates an expiry time in milliseconds.
	KeyDBOpCodeExpiryMilli
	// KeyDBOpCodeResizeDB indicates a hash table resize.
	KeyDBOpCodeResizeDB
	// KeyDBOpCodeAux indicates an auxiliary field.
	KeyDBOpCodeAux
	// KeyDBOpCodeFreq indicates an LFU frequency.
	KeyDBOpCodeFreq
	// KeyDBOpCodeIdle indicates an LRU idle time.
	KeyDBOpCodeIdle
	// KeyDBOpCodeModuleAux indicates module auxiliary data.
	KeyDBOpCodeModuleAux
)

The op codes of the KeyDB dialect.

const (
	KeyDBOpCodeString OpCode = iota
	KeyDBOpCodeList
	KeyDBOpCodeSet
	KeyDBOpCodeZset
	KeyDBOpCodeHash
	KeyDBOpCodeZset2
	// KeyDBOpCodeModulePreGa indicates module data for 4.0 release candidate.
	//
	// Deprecated: KeyDBOpCodeModulePreGa exists for historical compatibility.
	KeyDBOpCodeModulePreGa
	KeyDBOpCodeModule2

	KeyDBOpCodeHashZipmap
	KeyDBOpCodeListZiplist
	KeyDBOpCodeSetIntset
	KeyDBOpCodeZsetZiplist
	KeyDBOpCodeHashZiplist
	KeyDBOpCodeListQuicklist
	KeyDBOpCodeStreamListpacks
)
const (
	// RedisOpCodeEndOfRDB indicates the end of an RDB file.
	RedisOpCodeEndOfRDB OpCode = 0xff - iota
	// RedisOpCodeSelectDB indicates a new database.
	RedisOpCodeSelectDB
	// RedisOpCodeExpirySeconds indicates an expiry time in seconds.
	RedisOpCodeExpirySeconds
	// RedisOpCodeExpiryMilli indicates an expiry time in milliseconds.
	RedisOpCodeExpiryMilli
	// RedisOpCodeResizeDB indicates a hash table resize.
	RedisOpCodeResizeDB
	// RedisOpCodeAux indicates an auxiliary field.
	RedisOpCodeAux
	// RedisOpCodeFreq indicates an LFU frequency.
	RedisOpCodeFreq
	// RedisOpCodeIdle indicates an LRU idle time.
	RedisOpCodeIdle
	// RedisOpCodeModuleAux indicates module auxiliary data.
	RedisOpCodeModuleAux
	// RedisOpCodeFunc indicates function library data for 7.0 release candidate.
	//
	// Deprecated: RedisOpCodeFunc exists for historical compatibility.
	RedisOpCodeFunc
	// RedisOpCodeFunc2 indicates function library data.
	RedisOpCodeFunc2
	// RedisOpCodeSlotInfo indicates a slot ID and size, cluster mode only.
	RedisOpCodeSlotInfo
	// RedisOpCodeKeyMeta indicates key metadata.
	RedisOpCodeKeyMeta
	// RedisOpCodeHashTemplate indicates a hash template record (v15).
	RedisOpCodeHashTemplate
)

The op codes of the Redis dialect.

const (
	RedisOpCodeString OpCode = iota
	RedisOpCodeList
	RedisOpCodeSet
	RedisOpCodeZset
	RedisOpCodeHash
	RedisOpCodeZset2
	// RedisOpCodeModulePreGa indicates module data for 4.0 release candidate.
	//
	// Deprecated: RedisOpCodeModulePreGa exists for historical compatibility.
	RedisOpCodeModulePreGa
	RedisOpCodeModule2

	RedisOpCodeHashZipmap
	RedisOpCodeListZiplist
	RedisOpCodeSetIntset
	RedisOpCodeZsetZiplist
	RedisOpCodeHashZiplist
	RedisOpCodeListQuicklist
	RedisOpCodeStreamListpacks
	RedisOpCodeHashListpack
	RedisOpCodeZsetListpack
	RedisOpCodeListQuicklist2
	RedisOpCodeStreamListpacks2
	RedisOpCodeSetListpack
	RedisOpCodeStreamListpacks3
	// RedisOpCodeHashMetadataPreGa indicates a hash with a minimum expiry of
	// the fields for the 7.4 release candidate.
	//
	// Deprecated: RedisOpCodeHashMetadataPreGa exists for historical
	// compatibility, use RedisOpCodeHashMetadata instead.
	RedisOpCodeHashMetadataPreGa
	// RedisOpCodeHashListpackExPreGa indicates a hash with per field expiry
	// for the 7.4 release candidate.
	//
	// Deprecated: RedisOpCodeHashListpackExPreGa exists for historical
	// compatibility, use RedisOpCodeHashListpackEx instead.
	RedisOpCodeHashListpackExPreGa
	RedisOpCodeHashMetadata
	RedisOpCodeHashListpackEx
	RedisOpCodeStreamListpacks4
	RedisOpCodeStreamListpacks5
	RedisOpCodeArray
	RedisOpCodeHashTmplLP
	RedisOpCodeHashTmplLpRef
	RedisOpCodeHashTmplArray
	RedisOpCodeHashTmplArrayRef
	RedisOpCodeGCRA
)
const (
	RedisOpCodeRamLru  OpCode = 107
	RedisOpCodeSlotNum OpCode = 121
)

Redis Enterprise specific op codes.

const (
	// ValkeyOpCodeEndOfRDB indicates the end of an RDB file.
	ValkeyOpCodeEndOfRDB OpCode = 0xff - iota
	// ValkeyOpCodeSelectDB indicates a new database.
	ValkeyOpCodeSelectDB
	// ValkeyOpCodeExpirySeconds indicates expiry time in seconds.
	ValkeyOpCodeExpirySeconds
	// ValkeyOpCodeExpiryMilli indicates expiry time in ms.
	ValkeyOpCodeExpiryMilli
	// ValkeyOpCodeResizeDB indicates Hash table resize.
	ValkeyOpCodeResizeDB
	// ValkeyOpCodeAux indicates RDB aux field.
	ValkeyOpCodeAux
	// ValkeyOpCodeFreq indicates LFU frequency.
	ValkeyOpCodeFreq
	// ValkeyOpCodeIdle indicates LRU idle time.
	ValkeyOpCodeIdle
	// ValkeyOpCodeModuleAux indicates Module auxiliary data.
	ValkeyOpCodeModuleAux
	// ValkeyOpCodeFunc indicates function library data for 7.0 release candidate.
	//
	// Deprecated: ValkeyOpCodeFunc exists for historical compatibility.
	ValkeyOpCodeFunc
	// ValkeyOpCodeFunc2 indicates function library data.
	ValkeyOpCodeFunc2
	// ValkeyOpCodeSlotInfo indicates slot id and size (cluster mode only).
	ValkeyOpCodeSlotInfo
	// ValkeyOpCodeSlotImport stores the state of a slot import.
	ValkeyOpCodeSlotImport
)

The op codes of the Valkey dialect.

const (
	ValkeyOpCodeString OpCode = iota
	ValkeyOpCodeList
	ValkeyOpCodeSet
	ValkeyOpCodeZset
	ValkeyOpCodeHash
	ValkeyOpCodeZset2

	ValkeyOpCodeModule2

	ValkeyOpCodeHashZipmap
	ValkeyOpCodeListZiplist
	ValkeyOpCodeSetIntset
	ValkeyOpCodeZsetZiplist
	ValkeyOpCodeHashZiplist
	ValkeyOpCodeListQuicklist
	ValkeyOpCodeStreamListpacks
	ValkeyOpCodeHashListpack
	ValkeyOpCodeZsetListpack
	ValkeyOpCodeListQuicklist2
	ValkeyOpCodeStreamListpacks2
	ValkeyOpCodeSetListpack
	ValkeyOpCodeStreamListpacks3

	// ValkeyOpCodeHash2 is a hash with per field expiry.
	ValkeyOpCodeHash2
)
const (
	// KeyDBOpCodeCron stores a cron job.
	KeyDBOpCodeCron OpCode = 64
)

KeyDB specific op codes.

type OpCodeInfo added in v0.1.3

type OpCodeInfo struct {
	Ver  int
	Name string
}

func (OpCodeInfo) String added in v0.1.3

func (i OpCodeInfo) String() string

type QuickList2Decoder

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

QuickList2Decoder reads the nodes of a quicklist, where each node carries its container type.

func (QuickList2Decoder) Handle

type QuickList2Encoder

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

QuickList2Encoder writes the nodes of a quicklist, where each node carries its container type.

func (QuickList2Encoder) Handle

func (h QuickList2Encoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type QuickListDecoder

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

QuickListDecoder reads the nodes of a quicklist.

func (QuickListDecoder) Handle

func (h QuickListDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type QuickListEncoder

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

QuickListEncoder writes the nodes of a quicklist.

func (QuickListEncoder) Handle

func (h QuickListEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type RedisDialect

type RedisDialect struct {
	// V is the version of the RDB format the dialect represents.
	// The zero version selects the newest one the dialect supports.
	V int
}

RedisDialect is the dialect of Redis. It is the default of the Encoder and accepts every file with a Redis header this package understands.

func (RedisDialect) Commands

func (d RedisDialect) Commands() commands.Table

func (RedisDialect) Decoder

func (d RedisDialect) Decoder(op OpCode) (TokenDecoder, error)

Decoder returns the token decoder of the Redis op code. It fails with ErrInvalidOpCode when the dialect assigns no meaning to the op code and with ErrOpCodeTooNew when the op code was introduced in a version newer than the one of the dialect.

func (RedisDialect) Encoder

func (d RedisDialect) Encoder(op OpCode) (TokenEncoder, error)

Encoder is the write side of RedisDialect.Decoder.

func (RedisDialect) Header

func (d RedisDialect) Header() (string, int)

Header returns the magic string of Redis and the version of the dialect. The zero V selects the newest one the dialect supports.

func (RedisDialect) OpCodeInfo added in v0.1.3

func (RedisDialect) OpCodeInfo(op OpCode) OpCodeInfo

func (RedisDialect) WithVersion

func (d RedisDialect) WithVersion(version int) Dialect

WithVersion returns the dialect bound to the version. The zero version binds the newest one the dialect supports.

type SetIntSetDecoder

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

SetIntSetDecoder reads a key and a single set blob.

func (SetIntSetDecoder) Handle

func (h SetIntSetDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type SetIntSetEncoder

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

SetIntSetEncoder writes a key and a single set blob.

func (SetIntSetEncoder) Handle

func (h SetIntSetEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type SlotImportDecoder

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

SlotImportDecoder reads the slot import state: the job name, the number of slot ranges and the ranges themselves.

func (SlotImportDecoder) Handle

type SlotImportEncoder

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

SlotImportEncoder writes the slot import state: the job name, the number of slot ranges and the ranges themselves.

func (SlotImportEncoder) Handle

func (h SlotImportEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type SlotRange

type SlotRange struct {
	// Start is the first slot of the range.
	Start uint16
	// End is the last slot of the range, the range of a single
	// slot carries the slot in Start and End.
	End uint16
}

SlotRange is the inclusive range of the hash slots a node of a cluster serves.

func (SlotRange) Contains

func (r SlotRange) Contains(slot uint16) bool

Contains reports whether the range serves the slot.

type StreamConsumerDecoder

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

StreamConsumerDecoder reads a stream consumer: the times it was seen and active and its pending entries.

func (StreamConsumerDecoder) Handle

type StreamConsumerEncoder

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

StreamConsumerEncoder writes a stream consumer: the times it was seen and active and its pending entries.

func (StreamConsumerEncoder) Handle

type StreamGroupDecoder

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

StreamGroupDecoder reads a stream consumer group: its pending entries, its consumers and its NACK zone.

func (StreamGroupDecoder) Handle

type StreamGroupEncoder

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

StreamGroupEncoder writes a stream consumer group: its pending entries, its consumers and its NACK zone.

func (StreamGroupEncoder) Handle

func (h StreamGroupEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type StreamIdmpDecoder

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

StreamIdmpDecoder reads the IDMP (Idempotent Message Producer) data of a stream: its configuration, its producers with their entries and the stats.

func (StreamIdmpDecoder) Handle

type StreamIdmpEncoder

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

StreamIdmpEncoder writes the IDMP (Idempotent Message Producer) data of a stream: its configuration, its producers with their entries and the stats.

func (StreamIdmpEncoder) Handle

func (h StreamIdmpEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type StreamListDecoder

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

StreamListDecoder reads a stream value of any of the StreamListpacks op codes, including its metadata, its consumer groups and their IDMP and NACK zone data.

func (StreamListDecoder) Handle

type StreamListEncoder

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

StreamListEncoder writes a stream value of any of the StreamListpacks op codes, including its metadata, its consumer groups and their IDMP and NACK zone data.

func (StreamListEncoder) Handle

func (h StreamListEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type StringTokensDecoder

type StringTokensDecoder struct {
	// N is the number of strings the value stores.
	N uint64
	// contains filtered or unexported fields
}

StringTokensDecoder reads N strings.

func (StringTokensDecoder) Handle

type StringTokensEncoder

type StringTokensEncoder struct {
	// N is the number of strings the value stores.
	N uint64
	// contains filtered or unexported fields
}

StringTokensEncoder writes N strings.

func (StringTokensEncoder) Handle

func (h StringTokensEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type Token

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

Token is the unit of data a Decoder reads and an Encoder writes.

A Token stores its value in one of two forms:

  • As raw bytes: the verbatim encoding of the value, produced by Decoder.ReadToken and by the [Blob] and Packed constructors. A token read from a stream is backed by the internal buffer of the Decoder and is only valid until the next call to any method on that Decoder; call Token.Clone to copy the raw bytes into an independent allocation that persists beyond subsequent Decoder calls.

  • As a typed Go value: a self-contained representation produced by the other constructors (e.g., Str, Uint, Float64). Such tokens are valid indefinitely and do not need to be cloned.

Both forms provide the same view: the value methods return the value wherever it is stored, and Token.AsBytes returns the wire format.

func Byte

func Byte(b []byte) Token

Byte constructs a Token representing a byte string written verbatim, e.g. the specification bytes of a key metadata class.

func Expiry

func Expiry(ms uint64) Token

Expiry constructs a Token representing an expiry timestamp in milliseconds since the epoch.

func Float32

func Float32(f float32) Token

Float32 constructs a Token representing a 32-bit floating-point number stored as its IEEE-754 bit pattern.

func Float64

func Float64(f float64) Token

Float64 constructs a Token representing a 64-bit floating-point number stored as its IEEE-754 bit pattern. The scores of a sorted set record that stores them as text carry the op code of the record on the token, which the wire format selects on, see Token.AsBytes.

func Int

func Int(n int64) Token

Int constructs a Token representing a signed integer stored as its two's complement bit pattern.

func Op

func Op(op OpCode) Token

Op constructs a Token representing an op code.

func Packed

func Packed(kind Kind, b []byte) Token

Packed constructs a Token of a packed value encoding, e.g. a quick list, a zip list or an int set. The kind tells the encoding, the raw bytes are written verbatim.

func Str

func Str(s string) Token

Str constructs a Token representing a length prefixed string, e.g. a key name or a string value.

func StreamID

func StreamID(ms, seq uint64) Token

StreamID constructs a Token representing a stream entry ID: the milliseconds time and the sequence number of the entry.

func Time

func Time(t time.Time) Token

Time constructs a Token representing a milliseconds timestamp, the times of the stream metadata and its pending entries among others.

func Uint

func Uint(n uint64) Token

Uint constructs a Token representing a length encoded unsigned integer.

func (Token) AsBytes added in v0.1.2

func (t Token) AsBytes() []byte

AsBytes returns the raw bytes of the token. If the token carries no raw bytes, e.g. it was not read from a stream, the wire format is built from the available values. The bytes of a token read from a stream are only valid until the next Decoder call, see Token.Clone.

func (Token) Clone

func (t Token) Clone() Token

Clone returns a copy of the token with raw bytes that are not backed by the Decoder buffer and therefore remain valid past subsequent Decoder calls. It has no effect on tokens produced by the constructors, since those are already self-contained: such a token is returned unchanged.

func (Token) Float64

func (t Token) Float64() float64

Float64 returns the score of a sorted set member. It panics if the token kind is not KindFloat64.

func (Token) Int64

func (t Token) Int64() int64

Int64 returns the integer value of a numeric string, the way Redis stores the members of an intset and the metadata counters. It panics if the token does not carry a numeric string.

func (Token) Kind

func (t Token) Kind() Kind

Kind returns the kind of the token, see Kind for the accessors that carry its value.

func (Token) OpCode

func (t Token) OpCode() OpCode

OpCode returns the op code of a record token. It panics if the token kind is not KindOpCode.

func (Token) StreamID

func (t Token) StreamID() (uint64, uint64)

StreamID returns the milliseconds time and the sequence number of a stream entry ID. It panics if the token kind is not KindStreamID.

func (Token) String

func (t Token) String() string

String returns the string value of the token. It panics if the token kind is not KindString.

func (Token) Time

func (t Token) Time() time.Time

Time returns the timestamp of an expiry or a pending entry time, in the timezone of the local machine like time.Unix does. It panics if the token kind is neither KindExpiry nor KindTime.

func (Token) Uint64

func (t Token) Uint64() uint64

Uint64 returns the unsigned integer value of a count or a length. It panics if the token kind is not KindUint.

type TokenDecoder

type TokenDecoder interface {
	Handle(d *Decoder) (TokenDecoder, Token, error)
}

TokenDecoder reads the tokens of the value an op code starts. Handle reads the next token from d and returns the handler that reads the token after it: a handler returns itself to continue a sequence, or nil when the value is complete.

type TokenEncoder

type TokenEncoder interface {
	Handle(e *Encoder, t Token) (TokenEncoder, error)
}

TokenEncoder writes the tokens of the value an op code starts. Handle writes t and returns the encoder that writes the token after it: an encoder returns itself to continue a sequence, or nil when the value is complete.

type UintTokensDecoder

type UintTokensDecoder struct {
	// N is the number of values the record stores.
	N uint64
	// contains filtered or unexported fields
}

UintTokensDecoder reads N length encoded values.

func (UintTokensDecoder) Handle

type UintTokensEncoder

type UintTokensEncoder struct {
	// N is the number of values the record stores.
	N uint64
	// contains filtered or unexported fields
}

UintTokensEncoder writes N length encoded values.

func (UintTokensEncoder) Handle

func (h UintTokensEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type ValkeyDialect

type ValkeyDialect struct {
	// V is the version of the RDB format the dialect represents.
	// The zero version selects the newest one the dialect supports.
	V int
}

ValkeyDialect is the dialect of Valkey. Valkey 9.0 restarted the RDB version numbering at 80 under its own magic string, the versions 12 to 79 are reserved for the Redis forks the format does not share, and the versions up to 11 were written with the REDIS magic, which the Redis dialect detects. The Valkey dialect gives a different meaning to value type 22 and op code 243 than Redis, value types and op codes Redis introduced after Valkey forked are not supported.

func (ValkeyDialect) Commands

func (d ValkeyDialect) Commands() commands.Table

func (ValkeyDialect) Decoder

func (d ValkeyDialect) Decoder(op OpCode) (TokenDecoder, error)

Decoder returns the token decoder of the Valkey op code. It fails with ErrInvalidOpCode when the dialect assigns no meaning to the op code and with ErrOpCodeTooNew when the op code was introduced in a version newer than the one of the dialect.

func (ValkeyDialect) Encoder

func (d ValkeyDialect) Encoder(op OpCode) (TokenEncoder, error)

Encoder is the write side of ValkeyDialect.Decoder.

func (ValkeyDialect) Header

func (d ValkeyDialect) Header() (string, int)

Header returns the magic string of Valkey and the version of the dialect. The zero V selects the newest one the dialect supports.

func (ValkeyDialect) OpCodeInfo added in v0.1.3

func (ValkeyDialect) OpCodeInfo(op OpCode) OpCodeInfo

func (ValkeyDialect) WithVersion

func (d ValkeyDialect) WithVersion(version int) Dialect

WithVersion returns the dialect bound to the version. The zero version binds the newest one the dialect supports.

type ZipListDecoder

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

ZipListDecoder reads a key and a single listpack.

func (ZipListDecoder) Handle

func (h ZipListDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type ZipListEncoder

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

ZipListEncoder writes a key and a single listpack.

func (ZipListEncoder) Handle

func (h ZipListEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type ZipPackDecoder

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

ZipPackDecoder reads a key and a single value, e.g. a zipmap.

func (ZipPackDecoder) Handle

func (h ZipPackDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type ZipPackEncoder

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

ZipPackEncoder writes a key and a single value, e.g. a zipmap.

func (ZipPackEncoder) Handle

func (h ZipPackEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type ZsetDecoder

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

ZsetDecoder reads the members and scores of a sorted set.

func (ZsetDecoder) Handle

func (h ZsetDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type ZsetEncoder

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

ZsetEncoder writes the members and scores of a sorted set.

func (ZsetEncoder) Handle

func (h ZsetEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

type ZsetListDecoder

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

ZsetListDecoder reads a key and a single sorted set blob.

func (ZsetListDecoder) Handle

func (h ZsetListDecoder) Handle(d *Decoder) (TokenDecoder, Token, error)

type ZsetListEncoder

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

ZsetListEncoder writes a key and a single sorted set blob.

func (ZsetListEncoder) Handle

func (h ZsetListEncoder) Handle(e *Encoder, t Token) (TokenEncoder, error)

Directories

Path Synopsis
Package aof turns the keys of an RDB file into the AOF commands that recreate them on a server.
Package aof turns the keys of an RDB file into the AOF commands that recreate them on a server.
Package clusters establishes the connections of the nodes of a Redis compatible cluster and routes the keys to them: the CLUSTER command of a server names the primary shards of the cluster and the slots they serve, Dial dials them and Cluster.Target names the node that serves the slot of a key.
Package clusters establishes the connections of the nodes of a Redis compatible cluster and routes the keys to them: the CLUSTER command of a server names the primary shards of the cluster and the slots they serve, Dial dials them and Cluster.Target names the node that serves the slot of a key.
cmd
rdbc command
Command rdbc converts, serves and inspects RDB files and talks to Redis compatible servers.
Command rdbc converts, serves and inspects RDB files and talks to Redis compatible servers.
internal
chain
Package chain wires the stages of a transfer: a Src produces the tokens and pushes them into a Dst, the middlewares between them receive and transform them.
Package chain wires the stages of a transfer: a Src produces the tokens and pushes them into a Dst, the middlewares between them receive and transform them.
crc64jones
Package crc64jones implements the CRC-64 checksum with the Jones polynomial, the one the RDB format closes its files with.
Package crc64jones implements the CRC-64 checksum with the Jones polynomial, the one the RDB format closes its files with.
lzf
Package lzf implements the LZF (FASTLZ) compression the RDB format compresses its strings with.
Package lzf implements the LZF (FASTLZ) compression the RDB format compresses its strings with.
Package resp implements a RESP server for Redis compatible clients with the shape of net/http: a Server accepts connections, a Handler serves the commands of a Conn and a ResponseWriter writes the reply of a command.
Package resp implements a RESP server for Redis compatible clients with the shape of net/http: a Server accepts connections, a Handler serves the commands of a Conn and a ResponseWriter writes the reply of a command.
resptest
Package resptest provides a RESP server for use in end-to-end tests: NewServer serves the handler of a test on a local address of the test, Server.Client dials the connections of its clients and Server.Close shuts it down at the cleanup of the test.
Package resptest provides a RESP server for use in end-to-end tests: NewServer serves the handler of a test on a local address of the test, Server.Client dials the connections of its clients and Server.Close shuts it down at the cleanup of the test.

Jump to

Keyboard shortcuts

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