mem

package
v0.0.0-...-01d9b8a Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage memory storage

func NewStorage

func NewStorage() *Storage

NewStorage returns a mem data storage

func (*Storage) ApplySnapshot

func (s *Storage) ApplySnapshot(path string) error

ApplySnapshot apply a snapshort file from giving path

func (*Storage) BatchDelete

func (s *Storage) BatchDelete(keys ...[]byte) error

BatchDelete batch delete

func (*Storage) BatchSet

func (s *Storage) BatchSet(pairs ...[]byte) error

BatchSet batch set

func (*Storage) Close

func (s *Storage) Close() error

Close close the storage

func (*Storage) CreateSnapshot

func (s *Storage) CreateSnapshot(path string, start, end []byte) error

CreateSnapshot create a snapshot file under the giving path

func (*Storage) Delete

func (s *Storage) Delete(key []byte) error

Delete remove the key from the storage

func (*Storage) Free

func (s *Storage) Free(pooled []byte)

Free free the pooled bytes

func (*Storage) Get

func (s *Storage) Get(key []byte) ([]byte, error)

Get returns the value of the key

func (*Storage) MGet

func (s *Storage) MGet(keys ...[]byte) ([][]byte, error)

MGet returns multi values

func (*Storage) RangeDelete

func (s *Storage) RangeDelete(start, end []byte) error

RangeDelete remove data in [start,end)

func (*Storage) Scan

func (s *Storage) Scan(start, end []byte, handler func(key, value []byte) (bool, error), pooledKey bool) error

Scan scans the key-value paire in [start, end), and perform with a handler function, if the function returns false, the scan will be terminated, if the `pooledKey` is true, raftstore will call `Free` when scan completed.

func (*Storage) Seek

func (s *Storage) Seek(key []byte) ([]byte, []byte, error)

Seek returns the first key-value that >= key

func (*Storage) Set

func (s *Storage) Set(key []byte, value []byte) error

Set put the key, value pair to the storage

func (*Storage) SetWithTTL

func (s *Storage) SetWithTTL(key []byte, value []byte, ttl int32) error

SetWithTTL put the key, value pair to the storage with a ttl in seconds

func (*Storage) SplitCheck

func (s *Storage) SplitCheck(start []byte, end []byte, size uint64) (uint64, []byte, error)

SplitCheck Find a key from [start, end), so that the sum of bytes of the value of [start, key) <=size, returns the current bytes in [start,end), and the founded key

func (*Storage) Write

func (s *Storage) Write(wb *util.WriteBatch, sync bool) error

Write write the data in batch

Jump to

Keyboard shortcuts

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