Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ thread contention and maximize mechanical sympathy.
4. **Snapshotter (Core 3):** The archival layer. Periodically takes snapshots of the ledger state to optimize recovery
and manage WAL growth.

For a deep dive into the architecture, see [Design.md](Design.md) and our [Architectural Decision Records](docs/adr/).
For a deep dive into the architecture, see [Design.md](docs/Design.md) and our [Architectural Decision Records](docs/adr/).

## Core Components

Expand All @@ -45,7 +45,7 @@ use roda_ledger::ledger::{Ledger, LedgerConfig};
let config = LedgerConfig {
location: Some("ledger_data".to_string()),
in_memory: false,
..Default::default ()
..Default::default()
};

// Data: Your transaction data type
Expand Down Expand Up @@ -101,7 +101,7 @@ execute any deterministic logic you require.

```rust
use roda_ledger::transaction::{TransactionDataType, TransactionExecutionContext};
use roda_ledger::entities::{FailReason, TxEntry};
use roda_ledger::entities::FailReason;
use bytemuck::{Pod, Zeroable};

#[repr(C)]
Expand All @@ -112,14 +112,15 @@ pub struct MyTransaction {
}

impl TransactionDataType for MyTransaction {
fn process(
&self,
ctx: &mut impl TransactionExecutionContext,
) -> (FailReason, Vec<TxEntry>) {
let mut balance = ctx.get_balance(self.account_id);
balance += self.amount;
ctx.update_balance(self.account_id, balance);
(FailReason::NONE, Vec::new())
fn process(&self, ctx: &mut TransactionExecutionContext<'_>) {
if self.amount == 0 {
return;
}

// Simple deposit logic:
// Debit (increase) user's account and Credit (decrease) a system/mint account
ctx.debit(self.account_id, self.amount);
ctx.credit(0, self.amount); // Account 0 is the system account
}
}
```
Expand Down
2 changes: 2 additions & 0 deletions Design.md → docs/Design.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Roda-Ledger Architecture: Pipelined Execution

![Process Diagram](process_diagram.svg)

Roda-Ledger is built on a "Core-Per-Stage" model, utilizing asynchronous pipelining and lock-free ArrayQueues to eliminate thread contention and maximize mechanical sympathy.

## 1. Pipeline Stages
Expand Down
File renamed without changes
Loading