A simple embedded, persistent key value store for go.
The index makes use of a lock free radix tree, which is kept only in memory.
Data persistence is handled via a memory mapped file (MMAP).
This project was built for fun and learning. It probably has lots of bugs and shouldn't be used for any real workloads (yet!)
To start using lunar, you can run:
$ go get github.com/purehyperbole/lunar
Open
will open a database file. This will create a data and accompanying index file if the specified file(s) don't exist.
package main
import (
"github.com/purehyperbole/lunar"
)
func main() {
// open a new or existing database file.
db, err := lunar.Open("test.db")
if err != nil {
panic(err)
}
defer db.Close()
}
Get
allows data to be retrieved.
data, err := db.Get([]byte("myKey1234"))
Set
allows data to be stored.
err := db.Set([]byte("myKey1234"), []byte(`{"status": "ok"}`))
- Persistence
- Lock free index (Radix)
- Data file compaction
- Configurable sync on write options
- Transactions (MVCC)
For transparency into our release cycle and in striving to maintain backward compatibility, this project is maintained under the Semantic Versioning guidelines.
Code and documentation copyright since 2018 purehyperbole.
Code released under the MIT License.