reconEngine

package module
v0.0.0-...-63dbd48 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: Apache-2.0 Imports: 14 Imported by: 1

README

ReconEngine

Github all releases Go Report Card GitHub license Repository Size

It is the storage engine realised the lsm tree structure, used by ReconDB

Usage

Interface MemStorage
//Base mem interface, you can implement own realisation
type MemStorage interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte)
	Del(key string) error
	Sync() error
	Len() int
	SsTable() SsTableStorage
}
// Mem constructor, create structure realised MemStorage interface
// ssTable argument may be a nil
// Dir is the link to directory for data storing
func NewMem(ssTable SsTableStorage, dir *string) MemStorage
Interface SsTableStorage
//Base SsTable interface, you can implement own realisation
type SsTableStorage interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	Del(key string) error
	CreatePartition() SsTablePartitionStorage
	ClosePartition(partition SsTablePartitionStorage) error
	OpenPartition(createdAt int64) SsTablePartitionStorage
	Range(cb func(createdAt int64, partitionStorage SsTablePartitionStorage) bool)
	Len() int
	CloseAll() error
	MergeSort() error
}
// SsTable constructor, create structure realised SsTableStorage interface
// Dir is the link to directory for data storing
func NewSsTable(dir *string) SsTableStorage
Interface SsTablePartitionStorage
//Base ss table partition interface, you can implement own realisation
type SsTablePartitionStorage interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	Del(key string) error
	Range(cb func(key string, value []byte) bool)
	Key() int64
	Close() error
}
// SsTable partition constructor, create structure realised SsTablePartitionStorage interface
// Dir is the link to directory for data storing
func NewSStablePartition(createdAt int64, dir *string) SsTablePartitionStorage
Errors
// Error used when key don't exists
var KeyNotFoundErr = errors.New("can't found value by that key")
// Error used when key removed
var KeyRemovedErr = errors.New("that key was removed")

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyNotFoundErr = errors.New("can't found value by that key")

Key not found error

View Source
var KeyRemovedErr = errors.New("that key was removed")

Removed key error

Functions

This section is empty.

Types

type MemStorage

type MemStorage interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte)
	Del(key string) error
	Scan(subStr string, cb func(key string, value []byte) bool)
	Sync() error
	Len() int
	SsTable() SsTableStorage
}

Base mem interface, you can implement own realisation

func NewMem

func NewMem(ssTable SsTableStorage, dir *string) MemStorage

Mem constructor, create structure realised MemStorage interface ssTable argument may be a nil dir argument that will be stored data for partitions

type SsTablePartitionStorage

type SsTablePartitionStorage interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	Del(key string) error
	Range(cb func(key string, value []byte) bool)
	Key() int64
	Close() error
}

Base ss table partition interface, you can implement own realisation

func NewSStablePartition

func NewSStablePartition(createdAt int64, dir *string) SsTablePartitionStorage

SsTable partition constructor, create structure realised SsTablePartitionStorage interface

type SsTableStorage

type SsTableStorage interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	Del(key string) error
	CreatePartition() SsTablePartitionStorage
	ClosePartition(partition SsTablePartitionStorage) error
	OpenPartition(createdAt int64) SsTablePartitionStorage
	Range(cb func(createdAt int64, partitionStorage SsTablePartitionStorage) bool)
	Len() int
	CloseAll() error
	MergeSort() error
}

Base SsTable interface, you can implement own realisation

func NewSsTable

func NewSsTable(dir *string) SsTableStorage

SsTable constructor, create structure realised SsTableStorage interface

Jump to

Keyboard shortcuts

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