#state #applications #command #container #operations #log #persistence

madeleine

Transparent object persistence with predefined operations and state containers

4 releases

0.2.3 Nov 13, 2024
0.2.2 Nov 11, 2024
0.2.1 Jun 16, 2023
0.2.0 Jun 16, 2023

#628 in Data structures

Download history 2/week @ 2024-08-02 9/week @ 2024-09-20 2/week @ 2024-09-27 209/week @ 2024-11-08 35/week @ 2024-11-15

244 downloads per month

Apache-2.0

24KB
408 lines

Hi, I'm Madeleine

WARNING: I am very early alpha and not even feature-complete yet! Do not use me, but feel free to chip in to lend a hand.

I'm a Rust library for building stateful applications with persistent state containers. My inspiration comes from Ruby's madeleine gem and, transitively, the earlier Java Prevalayer library.

Overview

Using Madeleine, you model applications purely as predefined operations on a protected data structure. These operations are called commands and which may mutate the state of a protected data structure called a system. Using this model, every command which gets executed is transparently serialized and added to an append-only log in which their order is retained. Since the commands are the only things capable of altering the system, this constitutes a complete history of how the application's current state came to be. As every command log is persisted to disk, an application can exit or crash with the understanding that it may replay the command log on resumption without apparent effect. In other words, it could conceivably pick back up right where it left off.

Usage

To see it in action, check out the examples directory for sample code.

Installation

This installation method requires a recent version of Cargo which supports cargo-add:

cargo add madeleine

For older installations of Rust, you can either use cargo-edit or simply add the dependency to you Cargo.toml manually:

madeleine = "0.2.0" # Or latest version

Feature Roadmap

  • Main, top-level Madeleine interface
  • Example code
  • Snapshot logic
  • Command logging
  • Persistence
    • Commands
    • Snapshots
  • Resumption/rehydration from
    • Command log
    • Snapshots
    • Mixed scenarios involving commands following a snapshot
  • Garbage collection
  • Benchmarks
  • Integration tests

Wish list

  • Concurrency/parallelism support
  • Async interfaces
  • Background processing
  • Storage compression
  • Additional and pluggable storage formats, possibly through features:
    • JSON
    • TOML
    • CBOR

Getting help

If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.

Getting involved

Please see the CONTRIBUTING.md file for info on how to get involved.

License

Madeleine is Open Source Software released under the Apache 2.0 license.

Dependencies

~1.3–2.7MB
~51K SLoC