Skip to content

Allyedge/allydb

Repository files navigation

Made with Elixir

Latest Docker Image Version

License

Documentation

An in-memory database similar to Redis, built using Elixir.

Warning
AllyDB now includes all the essential features as originally planned.
Additional roadmap features may or may not be added in the future.
However, the project remains a great resource for learning how to create a similar project, and AllyDB can still be used since all the basic features are available.
Thank you for your interest and support!

Roadmap

(?) means that the item is an idea, but it is unclear how it will be implemented, or how the implementation will look like.

(!) means that the item will probably be implemented in the future, but it is not a priority.

Features Roadmap

  • Basic key value store
  • Lists
  • Usage Guide
  • Persistence
  • Hashes
  • Sets
  • Sorted Sets (!)
  • Pub/Sub (!)
  • Clustering/Distribution (?)
  • Custom database and persistence settings (?)

Performance Roadmap

  • Better usage of OTP (?)
  • Better usage of ETS (?)
  • Optimize persistence (?)
  • Rust NIFs for heavy operations (?)

Development Roadmap

  • Testing
  • Improve code quality
  • Extract repetitive code into functions

Usage

Environment Variables

Name Description Default
ALLYDB_PORT The port on which the server will listen 4000
PERSISTENCE_LOCATION The location where the database will be persisted allydb.tab
PERSISTENCE_INTERVAL The interval at which the database will be persisted 3000
LOG_PERSISTENCE_LOCATION The location where the log file will be stored allydb.log

Installation

Using Docker

You can use the docker image to run the database.

> docker pull allyedge/allydb

> docker run -p 4000:4000 allyedge/allydb

Build from source

You can also build the project from source.

> git clone https://github.com/Allyedge/allydb

> cd allydb

> mix deps.get

> mix compile

> mix release --env=prod

> _build/prod/rel/allydb/bin/allydb start

Documentation

You can find the documentation here.

Example Usage

Basic Key Value Store

> SET hello world
world

> GET hello
world

> DEL hello
hello

Lists

> lpush list 1
1

> lpush list 2
2

> lpush list 3
3

> lpop list
3

Hashes

> hset user id 1 name john age 20
3

> hget user name
john

> hgetall user
age
20
id
1
name
john

> hdel user age
1

Persistence

The database is persisted to an append only log file. This means that the database can be restored to a previous state.

The database is also persisted on a regular interval, in case something happens to the log file.

The interval can be configured using the PERSISTENCE_INTERVAL environment variable. The default value is 3000ms.

License

AllyDB is licensed under the Apache License 2.0. You can find the license here.