Skip to content

Commit c31f8da

Browse files
committed
[Blog] Edit
1 parent e9ae109 commit c31f8da

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

Blog/blog/2026-02-28-sea-orm-sync.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
slug: 2026-02-28-sea-orm-sync
3-
title: "Tutorial: let's make a program resumable with SQLite"
3+
title: "Tutorial: let's make a resumable Pi Spigot with SQLite"
44
author: SeaQL Team
55
author_title: Chris Tsang
66
author_url: https://github.com/SeaQL
@@ -11,17 +11,13 @@ tags: [news]
1111

1212
<img alt="SeaORM 2.0 Banner" src="/blog/img/SeaORM%202.0%20Banner.png"/>
1313

14-
## The Problem
14+
## The Problem: Durability
1515

16-
You have a program that runs for a long time. A batch job, a simulation, a data pipeline. It runs for hours, and then it crashes. You have to start it again and it begins from zero.
17-
18-
The fix is checkpointing: periodically saving the program's state so it can resume from where it left off. A SQLite database is a natural choice for this. It's a single file, requires no server, and supports transactions (so your checkpoint is atomic).
19-
20-
In this tutorial we'll wire up checkpointing with SeaORM's sync API and rusqlite. The state is defined as a SeaORM entity, persisted transactionally, and reconstructed on restart. No async runtime, no handwritten SQL.
16+
Long-running programs crash. When they do, you start over from zero. The fix is checkpointing: periodically save state to a database so the program can resume where it left off. In this tutorial we wire up checkpointing with SeaORM Sync and rusqlite. No async runtime, no handwritten SQL.
2117

2218
## The Workload: Pi Spigot
2319

24-
We need a computation that takes a long time and produces results incrementally. Here we use the Rabinowitz–Wagon pi spigot algorithm as demonstration.
20+
We need a computation that takes a long time and produces results incrementally. Here we use the Rabinowitz–Wagon pi spigot algorithm[^1] as demonstration.
2521

2622
The algorithm computes decimal digits of pi one at a time, using only integer arithmetic. Each iteration mutates the internal state, and may or may not produce a digit. So "I completed iteration N, therefore I have N digits" is not true.
2723

@@ -188,3 +184,5 @@ Sticker Pack Contents:
188184
[Support SeaQL and get a Sticker Pack!](https://www.sea-ql.org/sticker-pack/)
189185

190186
<a href="https://www.sea-ql.org/sticker-pack/"><img style={{borderRadius: "25px"}} alt="Rustacean Sticker Pack by SeaQL" src="https://www.sea-ql.org/static/sticker-pack-1s.jpg" /></a>
187+
188+
[^1]: The spigot algorithm is not the fastest way to compute pi. It can take hours to produce 1 million digits.

0 commit comments

Comments
 (0)