Yet another single process KVS server implemented over file-based database.
GOROMDB is a datastore that:
.---------.
| watcher |
'----+----'
|
.--------. .----+----. .---------.
TCP --> | server +---+ handler +---+ storage |-.
'----+---' '----+----' '---------' | <-- Replacable database
| | '---------'
.-----+----. .---+----.
| protocol | | loader |
'----------' '--------'
GOROMDB can be used as an executable binary, or a collection of simple libraries.
Just do:
go install github.com/yowcow/goromdb
An example of booting GOROMDB with BerkeleyDB database is:
goromdb -addr :11211 -storage bdb -file path/to/bdb-data.db -basedir path/to/store
Note that default compilation of the binary only covers basic features of GOROMDB. If full capability, like namespaced database, and/or multiple database file deployment, is required, craft libraries and build GOROMDB for your own.
GOROMDB does not daemonize itself. Look of other tools to daemonize GOROMDB.
Just do:
go get github.com/yowcow/goromdb
and import whatever package into your source code.
GOROMDB should serve fast but maybe not quite as fast as pure memcached. Detailed benchmark is comming up.
When -basedir
of /tmp/path/to/dir
is specified at boot, GOROMDB creates subdirectories data00
and data01
under /tmp/path/to/dir
:
/tmp/path/to/dir
├── db00
└── db01
When -file
of /tmp/path/to/dir/data.db
is specified at boot, GOROMDB will watch for database file /tmp/path/to/dir/data.db
and its MD5 sum file /tmp/path/to/dir/data.db.md5
.
When database and MD5 files are placed in directory /tmp/path/to/dir
, GOROMDB will verify MD5 sum.
/tmp/path/to/dir
├── data00
├── data01
├── data.db
└── data.db.md5
Once MD5 sum verification succeeds, GOROMDB will move data file into subdirectory either data00
or data01
, and load the database into running server.
/tmp/path/to/dir
├── data00
│ └── data.db
└── data01
Placing database and MD5 sum files again will load database into next subdirectory data01
vice versa.