Releases / TinyStore 0.9.0

TinyStore 0.9.0

TinyStore 0.9.0 came out on 16 November 2026. The store can now index a folder it doesn't own, a film library or a photo archive, and serve its files without copying a byte. A database can stay out of every backup, a backup can be checked without restoring it, and each() really walks tables bigger than memory. Jobs without an id can be cancelled and counted, a scraped NaN no longer breaks a metrics panel, and a search index tells you when its upkeep keeps failing.

Folders you don't own

A film library is two terabytes that something else owns. Copying it into blobs/ is out of the question, so until now TinyStore couldn't serve it at all. A directory lists a folder, writes down what changed since the last look, and reads its files from where they lie (Directories):

const movies = store.directory('movies', { path: 'D:/Movies', every: '15m' })

const scan = await movies.scan() // { added: 3, changed: 1, removed: 0, skipped: 0, count: 1842, size: 2104332118016 }
const page = await movies.changes({ after: cursor }) // { items: [{ path, change, info }], next }
const file = await movies.get('Dune (2021)/Dune.mkv') // StoredFile | undefined
movies = store.directory("movies", path="D:/Movies", every="15m")

scan = await movies.scan()  # Scan(added=3, changed=1, removed=0, skipped=0, count=1842, size=2104332118016)
page = await movies.changes(after=cursor)  # Changes(items, next)
file = await movies.get("Dune (2021)/Dune.mkv")  # StoredFile | None
movies, err := blobs.OpenDirectory(store, "movies", "D:/Movies", blobs.Every(15*time.Minute))

scan, err := movies.Scan(ctx)                               // blobs.Scan{Added, Changed, Removed, Skipped, Count, Size}
page, err := movies.Changes(ctx, blobs.After(cursor))       // blobs.Changes{Items, Next}
file, found, err := movies.Get(ctx, "Dune (2021)/Dune.mkv") // *blobs.StoredFile
let movies = store.directory("movies").path("D:/Movies").every(Duration::from_mins(15)).open()?;

let scan = movies.scan()?; // Scan { added, changed, removed, skipped, count, size }
let page = movies.changes().after(&cursor).page()?; // Changes { items, next }
let file = movies.get("Dune (2021)/Dune.mkv")?; // Option<StoredFile>
  • The store never writes in the folder. No call creates, renames or deletes anything under the path.
  • A file is the StoredFile you already serve: ranges, If-None-Match and Go's ServeContent work as they do for stored files. Its ETag names the file's size and time, not a hash of its bytes.
  • A scan is cheap. Over a million files that changed nothing it takes about 4 seconds and 7 MiB, measured on NTFS and ext4, so every: '15m' costs under half a percent of one core.
  • A file still being written, a download or a camera's recording, plays in a directory opened growing: true. Elsewhere a file that changes under a read fails conflict, so a range never mixes two versions of a film.
  • Over a server, the server's owner names the folders, tinystore serve … --directory movies=/mnt/media, and a client with a token can't ask for any other path.

A disk that drops off

A USB disk unplugged, or a share gone offline, looks like an empty folder. A scan that believed it would tell the program every film was removed, and a catalog built on those changes would forget its library.

const movies = store.directory('movies', { path: '/mnt/films', every: '15m' })
const scan = await movies.scan()
  1. Every 15 minutes the store scans the folder and finds nothing new.
  2. Someone pulls the USB disk out. The folder is now empty.
  3. The scan refuses instead of removing 1,842 films.
  4. The disk comes back, and the next scan finds the same films.

A scan that can't read the folder, or finds it empty while its list is not, fails unavailable and changes nothing (contract BLOB-12). A scan also stays on the folder's own disk: a disk mounted inside it is a directory of its own, so when that disk drops off, nothing of the outer one is told removed.

Uploads that skip the backup

A student uploads a report, and it waits fifteen minutes for them to confirm. It should not sit in the nightly backup for months (#63). A database opened with backup: false is left out of every backup, with every file kept in it (A database no backup takes):

const uploads = await store.database('uploads', { backup: false })
const pending = uploads.files('pending', { ttl: '15m' })
const backup = await store.backup('nightly.zip') // { files, bytes, keyLeftOut, excluded: ['uploads'] }
uploads = await store.database("uploads", backup=False)
pending = uploads.files("pending", ttl="15m")
backup = await store.backup("nightly.zip")  # Backup(files, bytes, key_left_out, excluded=['uploads'])
uploads, err := sqldb.Open(ctx, store, "uploads", sqldb.Backup(false))
pending, err := blobs.OpenFiles(uploads, "pending", blobs.TTL(15*time.Minute))
backup, err := store.Backup(ctx, "nightly.zip") // tinystore.Backup{…, Excluded: []string{"uploads"}}
let uploads = store.database("uploads").backup(false).open()?;
let pending = uploads.files("pending").ttl(Duration::from_mins(15)).open()?;
let backup = store.backup().write("nightly.zip")?; // Backup { excluded: ["uploads"], … }

The rule lives in where the file lies, not in a setting someone has to remember:

data/sql/app.dbsql/app.blobs/local/uploads.dblocal/uploads.blobs/nightly.zipin every backupdata/sql/app.dbsql/app.blobs/local/uploads.dblocal/uploads.blobs/nightly.zipin every backup
Tap to enlarge
  • No backup takes it: not this release's, not tinystore backup in another process, and not one released before, since none of them ever looks in local/ (contract BAK-05).
  • It is this machine's own. On a network of nodes, no node copies it, so an upload made on one node is not on another.
  • A restore has no uploads; the program opens it again, empty.

Every row, past 64 MiB

The guide always said each() reads "more than fits in memory", but the server read every row first and failed at 64 MiB like all(). Now rows stream a part at a time, and Rust gets each() too (Every row, one at a time):

for await (const order of orders.orderBy('id').each()) await exportRow(order)
async for order in orders.order_by("id").each():
    await export_row(order)
for order, err := range orders.OrderBy("id", sqldb.Asc).Each(ctx) {
	err = exportRow(order)
}
for order in orders.order_by("id", Direction::Asc).each()? {
    export_row(&order?)?;
}
  • Memory holds a couple of parts, not the rows: a walk of ten million rows costs what a walk of ten thousand does (contract SQL-13).
  • One snapshot lasts 5 seconds at most. A walk ordered by a unique key reads on after that, from the last row it gave; any other walk fails limit there and names list.

Check a backup without restoring it

A backup nobody tried is a hope. tinystore verify makes every check a restore makes, sizes, CRC-32 and SHA-256, and writes nothing (Check a backup without restoring it):

sh
tinystore verify backups/chat-2026-11-16.zip
● backups/chat-2026-11-16.zip  ok · 3 files · 52 KiB · checked in 0.1s
  a restore of it writes 53248 bytes

A file that doesn't match exits 1 and names it, so a nightly job can check its own zip. In Rust it is tinystore::backup::verify(path).

Cancel a job that has no id

Most jobs are added without an id, and until now nothing could take one back. cancel takes the job a list gave (Cancel a job without an id):

for await (const job of emails.all({ state: 'scheduled' })) {
	if (job.value.to === 'typo@example.com') await emails.cancel(job)
}
async for job in emails.all(state="scheduled"):
    if job.value.to == "typo@example.com":
        await emails.cancel(job)
for job, err := range emails.All(ctx, jobs.Scheduled) {
	if err == nil && job.Value.To == "typo@example.com" {
		_, err = emails.CancelJob(ctx, job)
	}
}
for job in emails.all(Filter::default().state(State::Scheduled)) {
    let job = job?;
    if job.value.to == "typo@example.com" {
        emails.cancel(&job)?;
    }
}

It answers false if the job ran, moved to a retry or was cancelled since the list, and never cancels another job in its place (contract JOB-15).

How many jobs are in each state

The first thing a dashboard shows about a queue:

const counts = await emails.counts() // { scheduled: 120, waiting: 8, running: 2, failed: 3 }
counts = await emails.counts()  # JobCounts(scheduled=120, waiting=8, running=2, failed=3)
counts, err := emails.Counts(ctx) // jobs.Counts{Scheduled: 120, Waiting: 8, Running: 2, Failed: 3}
let counts = emails.counts()?; // Counts { scheduled: 120, waiting: 8, running: 2, failed: 3 }

All four come from one snapshot (contract JOB-16), and the count reads no job's value. tinystore jobs ./data counts emails prints the same. How many jobs are in each state has the details.

NaN from an exporter

A Prometheus summary writes NaN for a quantile while a service is idle, and one NaN failed every aggregate over its range, so a scraped panel stayed blank. skipNaN passes those samples over and says how many (NaN from an exporter):

await store.metrics.aggregate({ name: 'rpc_seconds', since: '1h', every: '1m', op: 'avg', by: ['quantile'], skipNaN: true })
// buckets: [{ at, value: 0.21, samples: 3, skipped: 1 }, …]
await store.metrics.aggregate(name="rpc_seconds", since="1h", every="1m", op="avg", by=["quantile"], skip_nan=True)
metrics.Aggregate(ctx, store, metrics.Query{Name: "rpc_seconds", Since: time.Hour, Every: time.Minute,
	Op: metrics.Avg, By: []string{"quantile"}, SkipNaN: true})
stats.query().name("rpc_seconds").since(Duration::from_hours(1)).every(Duration::from_mins(1))
    .by(&["quantile"]).skip_nan().aggregate(Op::Avg)?;

A bucket of NaN alone has no value, never a zero, and an infinity is still refused (contract MET-23). The samples stay stored bit for bit.

Upkeep that keeps failing

A search index merges and cleans itself in the background. When that kept failing, a merge on a full disk say, only the log said so once. status() now carries the error for as long as it lasts (When maintenance fails):

await docs.status() // { state: 'ready', error: 'merge: disk full' }
await docs.status()  # IndexStatus(state='ready', done=0.0, error='merge: disk full')
status, err := docs.Status(ctx) // search.Status{State: search.Ready, Error: "merge: disk full"}
docs.status()? // Status::Ready { error: Some("merge: disk full") }

The index still answers searches, and ready() waits as it did (contract SRCH-16). A full disk also no longer fails a rebuild for good: the rebuild waits, and goes on once there is room.

A cap on remote connections

sh
tinystore serve ./data --listen tls://0.0.0.0:7443 --tls-cert cert.pem --tls-key key.pem --tokens tokens.txt --max-connections 256

The 257th client is told limit, naming the cap, and every SDK fails its connect with that message (contract WIRE-12). Programs on the same machine, through the local socket, are not counted. Without the flag a server serves as many as come, as before (serve).

Changed names

  • Rust: search::Status::Ready and Status::Rebuilding gain error:

    rust
    Status::Ready => serve(),       // 0.8.0
    Status::Ready { .. } => serve(), // 0.9.0
  • Rust: jobs::Job gains a private field that names its row, so a Job can no longer be built by a struct literal. Programs get jobs from a queue, so this touches only tests that built one.

  • Bun, Node and Python: all() of a queue throws CorruptError for a job whose value no longer reads and goes on after it when looped again, where it stopped for good.

Fixes

  • each() in Bun and Node, Python and Go read every row before the first and failed limit at 64 MiB; it streams them now.
  • A full disk while a search index switched to new settings failed its rebuild for good, until the index's next change.
  • The library built with replication and sql but no kv or jobs did not compile.
  • Every package's README said version 0.3.

Install

bun add @tinyshed/tinystore@0.9.0
npm install @tinyshed/tinystore@0.9.0
pip install tinyshed-tinystore==0.9.0
go get tinyshed.org/tinystore@v0.9.0
cargo add tinystore@0.9.0
cargo install tinystore-cli@0.9.0

0.9.0 adds a step to blobs.db's migrations for directories, so 0.8.0 refuses a store that 0.9.0 has opened rather than read it wrong. Open it with 0.9.0 or later. What a program gets over the wire comes once the server is 0.9.0. The server image is ghcr.io/tinyshed/tinystore:0.9.0.

Every commit since 0.8.0 is in the GitHub release.

Edit this page on GitHub Updated 16 November 2026

esc
↑↓ navigate ↵ open ⇥ filter 0 results