Simple Distributed key-value database (in-memory/disk) written with Golang.

Kallbaz DB

Simple Distributed key-value store (in-memory/disk) written with Golang.

Installation

go get github.com/msam1r/kallbaz-db

Usage

API

// Get - returns the value of the given key or any error occurs. if the
// key was not found it will return a NotFoundError.
Get(key string) ([]byte, error)
// Put - stores the value. it will return a BadRequestError if the provided
// data was invalid or any other error occured.
Put(key string, value []byte) error
// Delete - deletes the value of the given key.
Delete(key string) error
// Close - closes the database and returns when all internal processes
// has stopped. it returns any error occurs.
Close() error
// IsNotFoundError - check if the error is of type NotFoundError.
IsNotFoundError(err error) bool
// IsBadRequestError - check if the error is of type BadRequestError.
IsBadRequestError(err error) bool

In-memory db

package main

import (
    "fmt"
    "github.com/msam1r/kallbaz-db/db/memory"
)

func main() {
    kdb := memory.NewStore(memory.Config{
		MaxRecordSize: 1024,
		Logger:        &log.Logger{},
	})

    // Put value to the database
    err := kdb.Put("name", []byte("mohamed samir"))
    if err != nil {
		fmt.Println(err.Error())
	}

    // Get value from the database.
    var key string = "name-12"
    v, err := kdb.Get(key)
	if err != nil && kdb.IsNotFoundError(err) {
        fmt.Printf("Key: %s does not exists", key)
	}
    fmt.Println(string(v))

    // Delete the value from the database.
    err := kdb.Delete("name")
    if err != nil && (kdb.IsNotFoundError(err) || kdb.IsBadRequestError(err)) {
		fmt.Println(err.Error())
	}
}

TODO

  • in memory store
  • disk store {in progress}
  • applies aol (append-only log) structure {in progress}
  • binary storage format {in progress}
  • simple index implementation {not started}
  • sharding {not started}
  • replication {not started}
Owner
Mohamed Samir
Another Personal Profile
Mohamed Samir
Similar Resources

kvStore is a simple key/value in-memory store

kvStore is a simple key/value in-memory store. It is designed for the API. kvStore keeps records at /tmp/kvStore/dbName.db. You can specify server port, dbName and, file save interval in your RunServer(Addr, dbName) call.

Feb 24, 2022

Distributed disk storage database based on Raft and Redis protocol.

Distributed disk storage database based on Raft and Redis protocol.

IceFireDB Distributed disk storage system based on Raft and RESP protocol. High performance Distributed consistency Reliable LSM disk storage Cold and

Dec 27, 2022

A rest-api that works with golang as an in-memory key value store

In Store A rest-api that works with golang as an in-memory key value store Usage Fist of all, clone the repo with the command below. You must have gol

Oct 24, 2021

Distributed, fault-tolerant key-value storage written in go.

Distributed, fault-tolerant key-value storage written in go.

A simple, distributed, fault-tolerant key-value storage inspired by Redis. It uses Raft protocotol as consensus algorithm. It supports the following data structures: String, Bitmap, Map, List.

Jan 3, 2023

An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.

go-cache go-cache is an in-memory key:value store/cache similar to memcached that is suitable for applications running on a single machine. Its major

Jan 3, 2023

KV - a toy in-memory key value store built primarily in an effort to write more go and check out grpc

KV KV is a toy in-memory key value store built primarily in an effort to write more go and check out grpc. This is still a work in progress. // downlo

Dec 30, 2021

A key-value db api with multiple storage engines and key generation

A key-value db api with multiple storage engines and key generation

Jet is a deadly-simple key-value api. The main goals of this project are : Making a simple KV tool for our other projects. Learn tests writing and git

Apr 5, 2022

Distributed key-value store

Distributed key-value store

Keva Distributed key-value store General Demo Start the server docker-compose up --build Insert data curl -XPOST http://localhost:5555/storage/test1

Nov 15, 2021

Implementation of distributed key-value system based on TiKV

Distributed_key-value_system A naive implementation of distributed key-value system based on TiKV Features Features of this work are listed below: Dis

Mar 7, 2022
Golang-key-value-store - Key Value Store API Service with Go DDD Architecture

This document specifies the tools used in the Key-Value store and reorganizes how to use them. In this created service, In-Memory Key-Value Service was created and how to use the API is specified in the HTML file in the folder named "doc"

Jul 31, 2022
Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service.

Olric Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service. With

Jan 4, 2023
GhostDB is a distributed, in-memory, general purpose key-value data store that delivers microsecond performance at any scale.
GhostDB is a distributed, in-memory, general purpose key-value data store that delivers microsecond performance at any scale.

GhostDB is designed to speed up dynamic database or API driven websites by storing data in RAM in order to reduce the number of times an external data source such as a database or API must be read. GhostDB provides a very large hash table that is distributed across multiple machines and stores large numbers of key-value pairs within the hash table.

Jan 6, 2023
Key-value database stored in memory with option of persistence
Key-value database stored in memory with option of persistence

Easy and intuitive command line tool allows you to spin up a database avaliable from web or locally in a few seconds. Server can be run over a custom TCP protocol or over HTTP.

Aug 1, 2022
FlashDB is an embeddable, in-memory key/value database in Go
FlashDB is an embeddable, in-memory key/value database in Go

FlashDB is an embeddable, in-memory key/value database in Go (with Redis like commands and super easy to read)

Dec 28, 2022
A disk-backed key-value store.

What is diskv? Diskv (disk-vee) is a simple, persistent key-value store written in the Go language. It starts with an incredibly simple API for storin

Jan 1, 2023
Distributed reliable key-value store for the most critical data of a distributed system

etcd Note: The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order

Dec 28, 2022
yakv is a simple, in-memory, concurrency-safe key-value store for hobbyists.
yakv is a simple, in-memory, concurrency-safe key-value store for hobbyists.

yakv (yak-v. (originally intended to be "yet-another-key-value store")) is a simple, in-memory, concurrency-safe key-value store for hobbyists. yakv provides persistence by appending transactions to a transaction log and restoring data from the transaction log on startup.

Feb 24, 2022
Simple in memory key-value store.

Simple in memory key-value store. Development This project is written in Go. Make sure you have Go installed (download). Version 1.17 or higher is req

Nov 6, 2021
A simple in-memory key-value store application
A simple in-memory key-value store application

vtec vtec, is a simple in-memory key-value store application. vtec provides persistence by appending transactions to a json file and restoring data fr

Jun 22, 2022