PumpkinDB

PumpkinDB is an innovative database engine designed to provide immutable, ordered key-value storage with robust ACID transaction support. It features persistent storage and includes an embedded programming language called PumpkinScript. PumpkinDB is suitable for both standalone and embedded use cases, making it a versatile choice for various applications.

Key Features

Immutability

PumpkinDB ensures data immutability, meaning once a key's value is set, it cannot be overwritten. This approach encourages users to think about their data from a temporal perspective, which is highly beneficial for implementing event sourcing and similar architectures. Immutable data storage helps prevent data loss due to bugs, misunderstandings, or changing requirements.

ACID Transactions

PumpkinDB supports ACID transactions, ensuring data integrity and reliability. Transactions are performed atomically, meaning either all changes are committed, or none are. This guarantees that data remains consistent even in case of interruptions.

Persistent Storage

PumpkinDB offers persistent storage capabilities, making it suitable for applications requiring durable data retention. It leverages the underlying storage system for data persistence, ensuring that data is safely stored and can be recovered after system restarts.

PumpkinScript

PumpkinDB includes an embedded programming language called PumpkinScript, inspired by Forth. PumpkinScript is a stack-based language designed to facilitate building specialized application-specific databases. It allows applications to communicate with PumpkinDB by sending small PumpkinScript programs over a network interface or API.

Flexible Data Encoding

PumpkinDB supports binary keys and values, allowing any encoding to be used, such as JSON, XML, Protobuf, Cap'n Proto, etc. This flexibility makes it suitable for a wide range of applications with varying data formats.

Standalone and Embedded Scenarios

PumpkinDB can be used as a standalone server or embedded directly into applications. This versatility makes it a great choice for developers looking to integrate a powerful database engine into their projects.

Why Immutable?

Immutability in PumpkinDB ensures that replaced data is not simply deleted, providing a safer way to manage data. This approach prevents data loss due to bugs or changing requirements and allows for a temporal perspective on data, which is particularly useful for event sourcing architectures.

What is PumpkinDB?

PumpkinDB is a database programming environment inspired by the core ideas behind MUMPS. It features a stack-based language, PumpkinScript, and a flat key namespace. The core motivation for immutability is that with declining storage costs, erasing data becomes strategically unnecessary. PumpkinDB aims to facilitate building specialized databases with a focus on immutability and data processing close to storage.

Applications communicate with PumpkinDB by sending small PumpkinScript programs over a network interface or API, allowing for flexible and efficient data management.

Components

PumpkinDB is composed of several components:

  • pumpkinscript: A parser that converts text PumpkinScript into its binary form.
  • pumpkindb_engine: The core PumpkinDB library, providing the PumpkinScript scheduler and standard library of instructions.
  • pumpkindb_mio_server: An async MIO-based server library for building custom PumpkinProtocol-compatible servers.
  • pumpkindb_client: A client library for PumpkinProtocol.
  • pumpkindb_server: The stock PumpkinDB server, built on top of pumpkindb_mio_server.
  • pumpkindb_term: A console-based client for the PumpkinDB server.
  • doctests: A utility for running instruction doctests.

Client Libraries

PumpkinDB offers client libraries for various programming languages, including:

Trying It Out

You can download PumpkinDB releases from GitHub or try it out using a Docker image:

docker pull pumpkindb/pumpkindb
docker run -p 9981:9981 -ti pumpkindb/pumpkindb

Connect to it using pumpkindb-term:

docker run -ti pumpkindb/pumpkindb pumpkindb-term 172.17.0.1:9981

Alternatively, you can build PumpkinDB from source. You will need Rust Nightly to do this. The easiest way to get it is to use rustup:

rustup install nightly
rustup override set nightly

Then build and run the PumpkinDB server:

cargo build --all
./target/debug/pumpkindb

Similar Projects