#database #embedded-database #database-table #management #space #times #data-management

app furdb

A minimal Database Management System that prioritizes storage space usage and fast lookup/query times

3 releases

0.1.2-alpha Apr 13, 2024
0.1.1 Mar 10, 2024
0.1.0 Sep 4, 2022

#24 in Database implementations

Download history 9/week @ 2024-09-22

180 downloads per month

Custom license

66KB
1.5K SLoC

FurDB

Docker Image CI Minimum rustc 1.70 oq3_semantics crate

A minimal Database Management System that prioritizes storage space usage and fast lookup/query times. FurDB lets you specify the specific number of bits occupied by your data.

10011100 01010000
┌─┐┌───────┐┌───┐
  ^        ^    ^
  d1       d2   d3

Installing

Cargo

FurDB can be directly installed using cargo.

cargo install furdb

Compiling from Source

You can clone this repository, build and run the program.

git clone https://github.com/madhavan-raja/furdb.git
cd ./furdb
cargo build --release

Starting the Server

Docker

You can pull an image and run it in a container.

docker run --name furdb -d madhavanraja/furdb:latest

You can clone this repository, build and run the container using compose.

git clone https://github.com/madhavan-raja/furdb.git
cd ./furdb
docker-compose up --build

You can use the image as a service in a compose in another application.

version: "3"
services:
  furdb:
    image: madhavanraja/furdb:latest
    environment:
      WORKDIR: /furdb
      PORT: 5678
    restart: on-failure

The server can be accessed at http://furdb:{PORT}.

Command Line

If the executable is present in your PATH, you can directly run the server.

furdb --workdir "/furdb" serve --port 5678

You can run the help command to see all the available options.

furdb help

Usage

FurDB Server provides REST API endpoints for creating, reading, and deleting databases, tables, and entries.

Checking Server Info

Gets server information.

Endpoint

GET /

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": {
    "message": "Server is running",
    "config": {
      "workdir": "/furdb"
    }
  }
}

Create Database

Create a database with ID my_database.

Endpoint

POST /my_database

Response

{
  "result": "success",
  "statusCode": 201,
  "status": "Created",
  "response": {
    "databaseId": "my_database"
  }
}

Get Database Info

Get info of database with ID my_database.

Endpoint

GET /my_database

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": {
    "databaseId": "my_database",
    "databaseTables": []
  }
}

Delete Database

Delete database with ID my_database.

Endpoint

DELETE /my_database

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": null
}

Create Table

Creates a table with ID my_table in the database with ID my_database.

Endpoint

POST /my_database/my_table

Request

{
  "tableColumns": [
    {
      "size": 5
    },
    {
      "size": 3
    }
  ]
}

Response

{
  "result": "success",
  "statusCode": 201,
  "status": "Created",
  "response": {
    "databaseId": "my_database",
    "tableId": "my_table",
    "tableColumns": [
      {
        "size": 5
      },
      {
        "size": 3
      }
    ]
  }
}

Get Table Info

Get info of table with ID my_table in the database with ID my_database.

Endpoint

GET /my_database/my_table

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": {
    "databaseId": "my_database",
    "tableId": "my_table",
    "tableColumns": [
      {
        "size": 5
      },
      {
        "size": 3
      }
    ]
  }
}

Delete Table

Delete table with ID my_table in the database with ID my_database.

Endpoint

DELETE /my_database/my_table

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": null
}

Insert Entries

Insert entries into table with ID my_table in the database with ID my_database.

Endpoint

POST /my_database_/my_table/data

Request

{
  "data": [
    [21, 0],
    [17, 1],
    [23, 2],
    [9, 0],
    [31, 1],
    [0, 2]
  ]
}

Response

{
  "result": "success",
  "statusCode": 201,
  "status": "Created",
  "response": null
}

Get Entries

Get entries from table with ID my_table in the database with ID my_database.

Endpoint

GET /my_database_/my_table/data

Get All Entries

Request

{
  "entries": "all"
}

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": {
    "resultCount": 6,
    "results": [
      {
        "index": 0,
        "data": [21, 0]
      },
      {
        "index": 1,
        "data": [17, 1]
      },
      {
        "index": 2,
        "data": [23, 2]
      },
      {
        "index": 3,
        "data": [9, 0]
      },
      {
        "index": 4,
        "data": [31, 1]
      },
      {
        "index": 5,
        "data": [0, 2]
      }
    ]
  }
}

Get Entries By Indices

Request

{
  "entries": {
    "indices": [1, 3]
  }
}

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": {
    "resultCount": 2,
    "results": [
      {
        "index": 1,
        "data": [17, 1]
      },
      {
        "index": 3,
        "data": [9, 0]
      }
    ]
  }
}

Get Entries By Value

Request

{
  "entries": {
    "value": {
      "columnIndex": 0,
      "value": 23
    }
  }
}

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": {
    "resultCount": 1,
    "results": [
      {
        "index": 2,
        "data": [23, 2]
      }
    ]
  }
}

Delete Entries

Delete entries from table with ID my_table in the database with ID my_database.

Endpoint

DELETE /:database_id/:table_id/data

Delete All Entries

Request

{
  "entries": "all"
}

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": null
}

Delete Entries By Indices

Request

{
  "entries": {
    "indices": [1]
  }
}

Response

{
  "result": "success",
  "statusCode": 200,
  "status": "OK",
  "response": null
}

Dependencies

~20–36MB
~654K SLoC