https://github.com/purehyperbole/lunar
Embedded go database
https://github.com/purehyperbole/lunar
database embedded golang mmap persistence radix
Last synced: 6 months ago
JSON representation
Embedded go database
- Host: GitHub
- URL: https://github.com/purehyperbole/lunar
- Owner: purehyperbole
- License: mit
- Created: 2018-03-28T11:49:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-22T20:30:05.000Z (about 3 years ago)
- Last Synced: 2025-04-24T00:03:58.957Z (6 months ago)
- Topics: database, embedded, golang, mmap, persistence, radix
- Language: Go
- Size: 76.2 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LunarDB [](https://godoc.org/github.com/purehyperbole/lunar) [](https://goreportcard.com/report/github.com/purehyperbole/lunar) [](https://travis-ci.org/purehyperbole/lunar)
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).
# Motivation
This project was built for fun and learning. It probably has lots of bugs and shouldn't be used for any real workloads (yet!)
# Installation
To start using lunar, you can run:
`$ go get github.com/purehyperbole/lunar`
# Usage
`Open` will open a database file. This will create a data and accompanying index file if the specified file(s) don't exist.
```go
package mainimport (
"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.
```go
data, err := db.Get([]byte("myKey1234"))
````Set` allows data to be stored.
```go
err := db.Set([]byte("myKey1234"), []byte(`{"status": "ok"}`))
```# Features/Wishlist
- [x] Persistence
- [x] Lock free index (Radix)
- [ ] Data file compaction
- [ ] Configurable sync on write options
- [ ] Transactions (MVCC)## Versioning
For transparency into our release cycle and in striving to maintain backward
compatibility, this project is maintained under [the Semantic Versioning guidelines](http://semver.org/).## Copyright and License
Code and documentation copyright since 2018 purehyperbole.
Code released under
[the MIT License](LICENSE).