Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mnwa/reconengine
Fast library realised lsm tree key value store.
https://github.com/mnwa/reconengine
database-engine golang lsm-tree recon
Last synced: about 1 month ago
JSON representation
Fast library realised lsm tree key value store.
- Host: GitHub
- URL: https://github.com/mnwa/reconengine
- Owner: Mnwa
- License: apache-2.0
- Created: 2019-11-05T13:16:02.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-02T17:50:04.000Z (about 5 years ago)
- Last Synced: 2024-10-19T23:58:38.988Z (3 months ago)
- Topics: database-engine, golang, lsm-tree, recon
- Language: Go
- Size: 51.8 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# ReconEngine
[![Github all releases](https://img.shields.io/github/release/Mnwa/ReconEngine.svg)](https://github.com/Mnwa/ReconEngine/releases)
[![Go Report Card](https://goreportcard.com/badge/Mnwa/ReconEngine)](https://goreportcard.com/report/Mnwa/ReconEngine)
[![GitHub license](https://img.shields.io/github/license/Mnwa/ReconEngine.svg)](https://github.com/Mnwa/ReconEngine)
[![Repository Size](https://img.shields.io/github/repo-size/Mnwa/ReconEngine.svg)](https://github.com/Mnwa/ReconEngine)It is the storage engine realised the lsm tree structure, used by [ReconDB](https://github.com/Mnwa/Recon)
## Usage
### Interface MemStorage
```go
//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
}
``````go
// 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
```go
//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
}
``````go
// SsTable constructor, create structure realised SsTableStorage interface
// Dir is the link to directory for data storing
func NewSsTable(dir *string) SsTableStorage
```### Interface SsTablePartitionStorage
```go
//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
}
``````go
// 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
```go
// Error used when key don't exists
var KeyNotFoundErr = errors.New("can't found value by that key")
```
```go
// Error used when key removed
var KeyRemovedErr = errors.New("that key was removed")
```