SnapshotRebuildStore
The snapshot rebuild control plane of a SnapshotStore, its own port: a store offers it through SnapshotStore.rebuilds. The snapshot subscriptions never use it; the node's snapshot maintenance does.
Rebuilds work per aggregate type, its table: the store records the state revision the table is claimed at (claim, table), and the snapshots of another revision or marked stale (markStale) are pending until a rebuild rewrites them from the log, in place, whatever their revision. The TCK's SnapshotStoreSpec checks it for a store that has it.
Functions
Claims type's table at state revision and returns its record after the claim. The first claim records the table, not yet backfilled, and rebuilding unless revision is 1 (a snapshot written before revisions is of revision 1). A later claim raises a lower revision; it lowers a higher one only when lower says so (a rollback, once no node of the higher revision is left); either change starts a rebuild. Claims are atomic: concurrent claims leave one revision.
Sets rebuilding and backfilled, each when given, on type's table while it is claimed at revision; returns the record after, or null when the table is claimed at another revision or not at all.
Stores snapshot, rebuilt from the log, in place of the stored one: when the store holds none for its ref, or holds the same or a lower version, whatever its state revision; returns whether it was written. A stored version above snapshot's, written meanwhile, stays. Writing clears a stale mark of a version up to snapshot's.