Core Concepts¶
Fundamental concepts you need to understand to use nori-wal effectively.
What You'll Learn¶
This section covers the essential concepts behind write-ahead logs:
What is a Write-Ahead Log?¶
The fundamental concept of WALs, why they exist, and how they're used in modern systems.
Append-Only Architecture¶
Why WALs are append-only and what that means for your application.
Durability & Fsync Policies¶
How to balance durability and performance with different fsync strategies.
Recovery Guarantees¶
What happens after a crash and what guarantees you can rely on.
When to Use a WAL¶
Scenarios where WALs shine and where they don't.
Prerequisites¶
Before diving into these concepts, you should:
- Know basic Rust (async/await, Result types)
- Understand what "durability" means in databases
- Have completed the Quickstart
Quick Concept Check¶
Test your understanding with these questions:
Q: What does "write-ahead" mean?
Click to reveal answer
It means you write to the log before updating your main data structures. The log is the source of truth - if you crash before applying changes, you can replay the log to recover.
Q: Why use append-only storage?
Click to reveal answer
Append-only is simple and fast: no complex in-place updates, no corruption from partial writes, easy to reason about. Trade-off: you need compaction/garbage collection eventually.
Q: What's the difference between fsync() and flush()?
Click to reveal answer
flush(): Writes data from application buffer to OS buffer (not durable!)fsync(): Forces OS to write buffers to physical disk (durable!)
Only fsync() guarantees durability.
Learning Path¶
Recommended order:
- Start here: What is a WAL?
- Understand Append-Only Architecture
- Learn about Durability & Fsync
- Grasp Recovery Guarantees
- Apply knowledge: When to Use a WAL
Then move on to How It Works for deeper technical details.