8000 GitHub - baibikov/jellydb at 14dc7498467db1535e6af173e1472ef35141cbae
[go: up one dir, main page]

Skip to content

Generic connection for working with stretch storage.

License

Notifications You must be signed in to change notification settings

baibikov/jellydb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jellydb in-memory NoSQL message database.

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:

go get github.com/baibikov/jellydb

Code:

package main

import (
	"fmt"
	"log"

	"github.com/baibikov/jellydb/jellystore"
)

func main() {
	store, err := jellystore.New(&jellystore.Config{
		Path: "YOU_STORE_PATH",
	})
	if err != nil {
		log.Fatal(err)
	}

	err = store.Set("key", []byte("some_message"))
	if err != nil {
		log.Fatal(err)
	}

	bb, err := store.Get("key", 1)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(bb)
}
0