Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/infinivision/gaeadb
Fast Database engine in Go.
https://github.com/infinivision/gaeadb
Last synced: 2 months ago
JSON representation
Fast Database engine in Go.
- Host: GitHub
- URL: https://github.com/infinivision/gaeadb
- Owner: infinivision
- License: gpl-3.0
- Created: 2019-12-04T07:44:11.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-24T01:21:14.000Z (about 5 years ago)
- Last Synced: 2024-08-03T17:18:00.601Z (5 months ago)
- Language: Go
- Size: 91.8 KB
- Stars: 16
- Watchers: 13
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- go-awesome - gaeadb
README
# gaeadb
gaeadb is a pure Go Database engine designed by nnsgmsone.
The goal of the project is to provide a database engine for table or other complex data structures.## Table of Contents
* [Getting Started](#getting-started)
+ [Opening a Database engine](#opening-a-database-engine)
+ [DB interface](#db-interface)
+ [Transaction interface](#transaction-interface)
* [Benchmarks](#benchmarks)
* [Caveats & Limitations](#caveats--limitations)## Getting Started
### Opening a database
The top-level object in gaeadb is a `DB`. It represents multiple files on disk
in specific directories, which contain the data for a single database.```go
package mainimport (
"log""gaeadb/db"
)func main() {
// Open the gaeadb database located in the /tmp/gaea.db directory.
// It will be created if it doesn't exist.
cfg := db.DefaultConfig()
cfg.DirName = "/tmp/gaea.db"
db, err := db.Open(cfg)
if err != nil {
log.Fatal(err)
}
defer db.Close()
// Your code here…
}
```### DB interface
```go
type DB interface {
Close() errorDel([]byte) error
Set([]byte, []byte) error
Get([]byte) ([]byte, error)NewTransaction(readOnly bool) (Transaction, error)
}
```### Transaction interface
```go
type Transaction interface {
Commit() error
Rollback() error
Del([]byte) error
Set([]byte, []byte) error
Get([]byte) ([]byte, error)
NewForwardIterator([]byte) (Iterator, error)
NewBackwardIterator([]byte) (Iterator, error)
}type Iterator interface {
Close() error
Next() error
Valid() bool
Key() []byte // can use outside
Value() ([]byte, error) // can use outside
}```
## Benchmarks
I have run comprehensive benchmarks against Bolt and Badger, The
benchmarking code, and the detailed logs for the benchmarks can be found in the
[gaeadbBench] repo.[gaeadbBench]: https://github.com/infinivision/gaeadbBench
## Caveats & Limitations
### Caveats
sync is always on and not allowed to close### Limitations
The maximum value of key is 4074 and the maximum value of value is 64k.