Crate persy[][src]

Expand description

Persy - Transactional Persistence Engine

Simple single file durable, isolated, consistent, and atomic persistence engine based on copy on write. It guarantee the persistence of data even in case of crash through a in file write ahead log, and provide simple rust APIs for store simple bytes or value associated (index) data, provide also memory management logic to keep the file size in check.


use persy::{Persy,Config};
let persy = Persy::open("./target/data.persy",Config::new())?;
let mut tx = persy.begin()?;
let data = vec![1;20];
tx.insert("seg", &data)?;
let prepared = tx.prepare()?;
for (_id,content) in persy.scan("seg")? {
    assert_eq!(content[0], 1);

Example Index

use persy::{Persy,Config, ValueMode};
let persy = Persy::open("./target/index_data.persy",Config::new())?;
let mut tx = persy.begin()?;
tx.create_index::<i32,i32>("index", ValueMode::Cluster)?;
tx.put("index", 10, 20)?;
let prepared = tx.prepare()?;
for (key,values) in persy.range::<i32,i32,_>("index", ..)? {
    assert_eq!(key, 10);
    assert_eq!(values.into_iter().collect::<Vec<_>>(), vec![20]);


Wrapper for Vec<u8> for use it in index keys or values

Persy configuration structure.

Unique identifier of an index

Index definition details

Index Iterator implementation for iterating on a range of keys

Options, flags, configs which can be used to configure how a persy database is opened.

Main structure to operate persy storage files

Identifier of a persistent record, can be used for read, update or delete the record

Intermediate recover status to select witch transactions to commit or rollback and list witch transactions are in a intermediate state

Represents a looked-up segment

Iterator implementation used to scan a segment

Read snapshot at a specific point in time.

Iterator implementation to scan a segment at the current snapshot state.

Transaction container, it include all the changes done in a transaction.

Configure the parameters for the transaction on the begin of a new transaction.

prepared transaction state

Index Iterator implementation for iterating on a range of keys considering changes in transaction

Iterator implementation to scan a segment considering in transaction changes.

Iterator of values relative to an index key use by get and range functions


Enum of all the possible Key or Value types for indexes

Wrapper enum for all the possible Persy errors,

Enum of all possible errors from Persy

Possible state of a transaction in the log

Concurrent Modification Strategy for resolution of conflict on commit.

Define the behavior of the index in case a key value pair already exists


Trait implemented by all supported types in the index

Type Definitions

Custom identifier to track the transaction in the recover phase