Solitude-Software-Solutions / OstrichDB

WIP | A document-based NoSQL, JSON-esque database for local machine use
Apache License 2.0
30 stars 5 forks source link
database document-database linux macos nosql odin

OstrichDB

OstrichDB is a lightweight, document-based NoSQL JSON-esque database written in the Odin programming language. It focuses on simplicity and is designed for local data testing and manipulation, making it an ideal solution for developers looking for a straightforward database without the need for complex setups. With a flexible command structure, OstrichDB makes it easy to manage data using both single and multi-token commands.


Features

Data Structure Overview

OstrichDB organizes data into three levels:


Command Structure (ATOMs)

In ObstrichDB, commands are broken into four types of tokens, called ATOMs, to improve readability and ensure clear instructions.

Note: Not all commands require all four tokens.

  1. (A)ction Token: Specifies the operation to perform (e.g., NEW, ERASE, RENAME).
  2. (T)arget Token: The type of object that the action is being performed on (e.g., CLUSTER, RECORD).
  3. (O)bject Token: The name of the target object (e.g., foo, bar).
  4. (M)odifier Token: Additional parameters that change the behavior of the command (e.g.,TO, OF_TYPE).

Command Example

NEW CLUSTER foo.bar

Explanation:


Supported Commands

Single-Token Commands

These commands perform simple tasks without needing additional arguments.


Multi-Token Commands

These commands allow you to perform more complex operations.

Modifiers in Commands

Modifiers adjust the behavior of commands. The current supported modifiers are:

Examples:

NEW RECORD foo.bar.baz OF_TYPE INT
RENAME CLUSTER foo.bar TO foo.baz
SET CONFIG help TO verbose

Installation

Prerequisites:

Steps:

  1. Clone the Repository:

    git clone https://github.com/Solitude-Software-Solutions/OstrichDB.git
  2. Navigate to the OstrichDB Directory:

    cd path/to/OstrichDB
  3. Make the Build & Restart Scripts Executable:

    chmod +x scripts/build.sh scripts/restart.sh
  4. Run The Build Script:

    ./scripts/build.sh

Usage Examples

   # Create a new collection:
   NEW COLLECTION staff
   # Create a new cluster:
   NEW CLUSTER staff.engineers
   # Create a new record:
   NEW RECORD staff.engineers.lead OF_TYPE STR
   # Set a record value:
   SET RECORD staff.engineers.lead TO "John Doe"
   # Fetch the record value:
   FETCH RECORD staff.engineers.lead
   # Rename a cluster:
   RENAME CLUSTER staff.engineers TO developers
   # Get the size of a cluster:
   SIZE_OF CLUSTER staff.developers
   # Erase a record:
   ERASE RECORD staff.developers.lead
   # Get a count of all collections in the database:
   COUNT COLLECTIONS
   # Get help on a specific ATOM
   HELP RECORD
   # Get general help information
   HELP
   # Create a new user
   NEW USER

Future Plans


Contributing

Please refer to the CONTRIBUTING.md for detailed guidelines on how to contribute.


License

OstrichDB is released under the Apache License 2.0. For the full license text, see Apache License 2.0.