ssdb

package module
v0.0.0-...-f9df7eb Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

README

go-ssdb

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBinlogEventCorrupted = errors.New("ssdb: binlog event corrupted")

Functions

This section is empty.

Types

type Binlog

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

func NewBinlog

func NewBinlog(ldb *leveldb.DB) *Binlog

func (*Binlog) Get

func (b *Binlog) Get(ctx context.Context, seq uint64) (*Event, error)

func (*Binlog) Seq

func (b *Binlog) Seq() uint64

type Config

type Config struct {
	Path string
	Addr string
}

type DB

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

func Open

func Open(path string, opts *Options) (*DB, error)

func (*DB) BeginTxn

func (db *DB) BeginTxn() *Txn

func (*DB) Close

func (db *DB) Close() error

func (*DB) Del

func (db *DB) Del(ctx context.Context, key []byte) error

func (*DB) Get

func (db *DB) Get(ctx context.Context, key []byte) ([]byte, error)

func (*DB) HDel

func (db *DB) HDel(ctx context.Context, key []byte, field []byte) (ok bool, err error)

func (*DB) HGet

func (db *DB) HGet(ctx context.Context, key []byte, field []byte) ([]byte, error)

func (*DB) HGetAll

func (db *DB) HGetAll(ctx context.Context, key []byte) ([][]byte, error)

func (*DB) HKeys

func (db *DB) HKeys(ctx context.Context, key []byte) ([][]byte, error)

func (*DB) HLen

func (db *DB) HLen(ctx context.Context, key []byte) (int64, error)

func (*DB) HSet

func (db *DB) HSet(ctx context.Context, key []byte, field []byte, value []byte) (err error)

func (*DB) HSetNX

func (db *DB) HSetNX(ctx context.Context, key []byte, field []byte, value []byte) (ok bool, err error)

func (*DB) HStrLen

func (db *DB) HStrLen(ctx context.Context, key []byte, field []byte) (int, error)

func (*DB) HVals

func (db *DB) HVals(ctx context.Context, key []byte) ([][]byte, error)

func (*DB) Incr

func (db *DB) Incr(ctx context.Context, key []byte) (int64, error)

func (*DB) Incrby

func (db *DB) Incrby(ctx context.Context, key []byte, increment int64) (int64, error)

func (*DB) LIndex

func (db *DB) LIndex(ctx context.Context, key []byte, index int64) ([]byte, error)

func (*DB) LLen

func (db *DB) LLen(ctx context.Context, key []byte) (int64, error)

func (*DB) LRange

func (db *DB) LRange(ctx context.Context, key []byte, start int64, stop int64) ([][]byte, error)

func (*DB) Set

func (db *DB) Set(ctx context.Context, key []byte, value []byte) error

func (*DB) WithTxn

func (db *DB) WithTxn(f func(txn *Txn) error) error

func (*DB) ZCard

func (db *DB) ZCard(ctx context.Context, key []byte) (int64, error)

func (*DB) ZRank

func (db *DB) ZRank(ctx context.Context, key []byte, member []byte) (uint64, error)

func (*DB) ZScore

func (db *DB) ZScore(ctx context.Context, key []byte, member []byte) (float64, error)

type Event

type Event struct {
	Seq  uint64
	Type EventType
	Cmd  EventCommand
	Key  []byte
}

func (*Event) MarshalBinary

func (e *Event) MarshalBinary() []byte

func (*Event) UnmarshalBinary

func (e *Event) UnmarshalBinary(buf []byte) error

type EventCommand

type EventCommand byte
const (
	None      EventCommand = 0
	StringSet EventCommand = 1
	StringDel EventCommand = 2
	HashSet   EventCommand = 3
	HashDel   EventCommand = 4
	ZSetSet   EventCommand = 5
	ZSetDel   EventCommand = 6

	Begin EventCommand = 7
	End   EventCommand = 8
)

type EventType

type EventType byte
const (
	Noop   EventType = 0
	Sync   EventType = 1
	Mirror EventType = 2
	Copy   EventType = 3
	Ctrl   EventType = 4
)

type KeyMutex

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

func NewKeyMutex

func NewKeyMutex() *KeyMutex

func (*KeyMutex) Lock

func (km *KeyMutex) Lock(key string)

func (*KeyMutex) Unlock

func (km *KeyMutex) Unlock(key string)

type Options

type Options struct {
}

type Server

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

func NewServer

func NewServer(config *Config) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Get

func (s *Server) Get(conn redcon.Conn, cmd redcon.Command)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) Ping

func (s *Server) Ping(conn redcon.Conn, cmd redcon.Command)

func (*Server) Set

func (s *Server) Set(conn redcon.Conn, cmd redcon.Command)

type Txn

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

func NewTxn

func NewTxn(db *DB) *Txn

func (*Txn) Begin

func (txn *Txn) Begin()

func (*Txn) Commit

func (txn *Txn) Commit() error

func (*Txn) Delete

func (txn *Txn) Delete(ctx context.Context, ldbKey []byte)

func (*Txn) DeleteWithEvent

func (txn *Txn) DeleteWithEvent(ctx context.Context, ldbKey []byte,
	eventType EventType, eventCmd EventCommand)

func (*Txn) Get

func (txn *Txn) Get(ctx context.Context, ldbKey []byte) ([]byte, error)

func (*Txn) Put

func (txn *Txn) Put(ctx context.Context, ldbKey []byte, value []byte)

func (*Txn) PutWithEvent

func (txn *Txn) PutWithEvent(ctx context.Context, ldbKey []byte, value []byte,
	eventType EventType, eventCmd EventCommand)

func (*Txn) Rollback

func (txn *Txn) Rollback()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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