storage

package
v0.0.0-...-3a1a44b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delete

type Delete struct {
	Key []byte
	Cf  string
}

type MemStorage

type MemStorage struct {
	CfDefault *llrb.LLRB
	CfLock    *llrb.LLRB
	CfWrite   *llrb.LLRB
}

MemStorage is an in-memory storage engine used for testing. Data is not written to disk, nor sent to other nodes. It is intended for testing only.

func NewMemStorage

func NewMemStorage() *MemStorage

func (*MemStorage) Get

func (s *MemStorage) Get(cf string, key []byte) []byte

func (*MemStorage) HasChanged

func (s *MemStorage) HasChanged(cf string, key []byte) bool

func (*MemStorage) Len

func (s *MemStorage) Len(cf string) int

func (*MemStorage) Reader

func (s *MemStorage) Reader(ctx *kvrpcpb.Context) (StorageReader, error)

func (*MemStorage) Set

func (s *MemStorage) Set(cf string, key []byte, value []byte)

func (*MemStorage) Start

func (s *MemStorage) Start() error

func (*MemStorage) Stop

func (s *MemStorage) Stop() error

func (*MemStorage) Write

func (s *MemStorage) Write(ctx *kvrpcpb.Context, batch []Modify) error

type Modify

type Modify struct {
	Data interface{}
}

Modify is a single modification to TinyKV's underlying storage.

func (*Modify) Cf

func (m *Modify) Cf() string

func (*Modify) Key

func (m *Modify) Key() []byte

func (*Modify) Value

func (m *Modify) Value() []byte

type Put

type Put struct {
	Key   []byte
	Value []byte
	Cf    string
}

type Storage

type Storage interface {
	Start() error
	Stop() error
	Write(ctx *kvrpcpb.Context, batch []Modify) error
	Reader(ctx *kvrpcpb.Context) (StorageReader, error)
}

Storage represents the internal-facing server part of TinyKV, it handles sending and receiving from other TinyKV nodes. As part of that responsibility, it also reads and writes data to disk (or semi-permanent memory).

type StorageReader

type StorageReader interface {
	// When the key doesn't exist, return nil for the value
	GetCF(cf string, key []byte) ([]byte, error)
	IterCF(cf string) engine_util.DBIterator
	Close()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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