Skip to content

v0.4.0

Choose a tag to compare

@mbolli mbolli released this 19 Oct 14:48
· 239 commits to main since this release

Views can declare what their Render read, topics form a tree by their : segments, and the hub numbers its commits, for caches of derived values. A read can skip the statement caches, and a stream the hub stops keeps its clean end over HTTP/2. No API was removed. What to check in an app:

  • Topics with : now count for the levels above them: a commit to board:42 touches board too, so a view on a bare kind such as board renders at every board:<id> commit.

  • Per-tab, session and presence state belongs under a root of its own (tab:…, sid:…, here:…), not under a root that shared views listen to. lith's site moved its demos' state out from under each demo's slug; the template needs no change.

  • sse: a write under way when the hub stops its stream gets up to 250 ms to finish, like the end frame, where it had a deadline of now. Over HTTP/2 that deadline reset the stream with INTERNAL_ERROR, and the page lost its clean end and its Reconnect event on a deploy.

  • live: Depends(ctx, topics...) declares, in a Render, topics the view read. They mark it dirty like Topics and replace those of the Render before, so a view keyed by the tab follows the tab's route without Unwatch and Watch.

  • live: Hub.Seq numbers the commits, Hub.Version(topics...) is the last commit to touch one of them, and Seq(ctx) is, in a Render, the last commit its snapshot is sure to hold. A cached count stays valid while its topics' version is not above the number it was computed at. The hub keeps the versions of the Options.Versions topics changed last (32,768 by default, 4.3 MiB at most); a topic pushed out reads as changed then.

  • live: topics form a tree by their : segments. A commit to src:A:7 marks the views of src:A and src too and moves their versions; one to src:A:* marks every view at or below src:A, and * alone is MarkAll. Topic(parts...) builds one from outside ids such as urn:uuid:…, escaping :, * and %; Below(topic) adds the :*. The levels above keep their versions in a store of their own, Options.PrefixVersions (32,768 by default), so a sync of more items than Options.Versions no longer pushes out the version of a space. A topic with an empty segment or a * panics in Serve, Watch and Depends. A commit of two topics at depth 2 costs about 60 ns more (BenchmarkChanged).

  • sqlite: Uncached(ctx) runs a query without the statement caches, on the read pool, in a Render and in a command. SQL built at runtime, such as an IN list sized to the results, no longer pushes the statements that repeat out of a connection's cache.

  • Docs and skill: recipes for a topic hierarchy, a per-tab view that navigates with Depends, and an aggregate cached against a version; views in a shared database, keyed by the person and the route; large updates and deletes, by rowid range or in Exclusive; live without lith's writer, for an app whose own store calls Hub.Changed after each commit; and pinning Readers, CacheKiB and the hub's Workers in a desktop app, since they grow with GOMAXPROCS. New benchmarks measure large writes and the hub (BenchmarkLargeWrite, BenchmarkChanged, BenchmarkTick), and bench/RESULTS.md compares the board with v0.3.1.