SystemicDB-Core

module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: MIT

README

SystemicDB Logo

made-with-Go Go Report Card Twitter Handle

SystemicDB - Core

Introduction

This is the core SystemicDB package that is used in the full SystemicDB Server application. I can be imported and used in any Go application for standalone usage or one could wrap their own server around package for custom usage.

Install
go get github.com/SamuelBanksTech/SystemicDB-Core
Usage

First of all you will need to instantiate the core SystemicDB struct.

sdb := NewSystemicDB()

Insert: Takes a string key, a byte slice as its data, and a expiry time
This function will initiate a database optimisation function (AVL Tree Balancing)

sdb.Insert("my-key", []byte("This is my byte data"), 15 * time.Minute)

Exists: Simply returns a bool value to denote whether that key exists or not

sdb.Exists("my-key")

Get: Take a key as a string and retrieves a struct containing the nodes data

sdb.Get("my-key")

//Returns...
type NodeData struct {
    Key    string
    Value  []byte
    Expiry int64 //This is a unix timestamp of the exact time it will expire and bew removed from the database
}

Remove: Takes a key as a string, removes the node and all the associated data
This function will initiate a database optimisation function (AVL Tree Balancing)

sdb.Remove("my-key")
TODO
  • ❇️ Implement a tag map to allow grouping of keys
    • Implement batch operations by tag (Remove By Tag for example)
  • ❇️ Produce benchmarks comparison tables (although I already know it's faster than most)
  • ❇️ Implement some overrides in struct init that will allow custom timings for Garbage Collection etc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL