Skip to content

Generic connection for working with stretch storage.

License

Notifications You must be signed in to change notification settings

baibikov/jellydb

Repository files navigation

Jellydb in-memory NoSQL message database.

Licence GitHub release Build Status PkgGoDev Go Report Card

Philosophy:


In-memory Database with the ability to upload / download data from file storage.

File storage:

├── PATH_KEY
├────── STORAGE_MESSAGES_PATH_KEY
├──────────── log.jelly.db
└──────────── meta.jelly.format

log.jelly.db:

A monotonically growing string of bytes having the following data set:

Message size: 4 bytes
Message: 512 bytes

Example:

When saving the message “my very important message” to the store, the message is converted to the following form:

10101my very important message\0\0\0\0\0\0\0\0….(up to 512)

size: 10101
message: my very important message\0\0\0\0\0\0\0\0….(up to 512)

meta.jelly.format:

A file that contains the "meta" information of each key. Stores the following data: Offset of committed messages Offset recorded messages

Example:

When saving the “my very important message” message to the repository and committing it, the message will be converted to the following form:

00010001

To decrypt a string, do the following:

take the first 4 bytes - the offset of the recorded messages
take the next 4 bytes - the offset of the comic messages

Quick Start:

Run tcp server on current port

go run cmd/tcp/main.go -addr :7777

Run CLI

go run cmd/cli/main.go -addr :7777

Commands for use

(sys)
-help:  Navigating existing Commands
exit:  Exit from CLI
clear: Carriage cleaning

(store)
SET: Adding an entry to the read queue, as soon as the entry
example:
> SET my_super_important SOME_VALUE_1

GET [N]: Getting uncommitted messages from the batch queue and n is batch elements
example:
> GET my_super_important 2
> SOME_VALUE_1
> SOME_VALUE_2

COM [N]: Commenting on a batch of messages
example:
> COMMIT my_super_important 2

SET command:

> SET my_key_1 object_1
👌
> SET my_key_1 object_2
👌
> SET my_key_1 object_3
👌

GET command:

> GET my_key_1 3
object_1
object_2
object_3

COM (commit) command:

> COM my_key_1 3
👌