tcmts.store

test/
17 definitions

Types

Causal type
A point in history: a namespace state, the causals it was made from, and (not hashed) what made it, when, and what for, if it was told (`message`).
Comment type
Contribution type
A branch proposed for merging into another.
LogEntry type
NameRow type
NamespaceBody type
A namespace node: `["ns", [[name, [hashes]]...], [[child, nodeHash]...]]`, both lists sorted by name. Where a name shows a definition with other text than it was first stored with (its comments, layout or doc changed), a fourth list says which version: `[[name, hash, textHash]...]`, sorted by name and hash. A node without one is written, and hashed, as before there were text versions.
Release type
A package's version: an immutable name for a history entry, with its release notes (markdown).
Row type
Store typeof Store
TestResult type
TextVersion type
How a definition reads: its code as written (comments, layout, names spelled as then) and its doc. None of it is in its hash, so one definition can have several; each is kept by its textHash.

Server

EMPTY_NAMESPACE string
The empty namespace, and the causal every history starts from: the same in every codebase.
LAYOUT string
The codebase's table layout, as a fingerprint of its schema: a codebase records the one it was made with.
ROOT_CAUSAL string
causalHash (namespace: string, parents: string[]) => string
A causal's hash: its namespace and its parents (in order of hash), nothing else.
hash32 (domain: string, text: string) => string
namespaceHash (body: string) => string
The hash of a namespace node's body.
packed (text: string) => string | Uint8Array<ArrayBufferLike>
A text as the codebase keeps it: a long one zstd-compressed, as bytes, in the column that would hold it (a definition's code and source, metadata, a namespace node); a short one as itself. unpacked reads either.
relayout (db: DatabaseSync) => { from: string; to: string; } | undefined
Lay a codebase's tables out as this tcm does, taking `LAYOUT_STEPS` in turn, in the caller's transaction: the layout it was in and is now, or undefined if it was in this one already.
stateHashOf (rows: { path: string; hash: string; }[]) => string
textHash (v: TextVersion) => string
A text version's hash: its text and its doc (where the doc names definitions follows from those, and the names).
unpacked (value: unknown) => string
A text as packed kept it: bytes decompressed, a string as it is.

Shared

B32 "abcdefghijklmnopqrstuvwxyz234567"
DEF_CACHE 5000
How many definitions a store keeps read in memory (`Store.getDef`), the most recently read.
EMPTY_BODY string
LAYOUT_STEPS Record<string, { to: string; step: (db: DatabaseSync) => void; }>
How a codebase in an older table layout moves to this tcm's (`LAYOUT`): by the layout it's in (its `layout` setting), the step that moves it on, and the layout that leaves it in. `tcm migrate` takes them in turn until it's this one's; a layout with no step from it (a newer tcm's, or one from before there were steps) can't be moved.
PACK_FROM 1024
the shortest text packed compresses: a shorter one gains little, and would cost a decompression each read
PATCH_DEPTH 8
the most sets a branch reads its patches through: a set made over that many is made over a flat copy of them
SCHEMA "\nCREATE TABLE IF NOT EXISTS components (hash TEXT PRIMARY KEY, size INTEGER NOT NULL, ir_version …
cleanMessage (message: string | undefined) => string | undefined
A message as given (`-m`, a tool's `message`): line endings as `\n`, trailing spaces and blank lines at either end taken off. Nothing left is no message.
contributionOf (r: Row) => Contribution
deepFreeze <T>(value: T) => T
Freeze a value and everything in it.
entryText (command: string, message?: string | undefined) => string
How a history entry's `command` column holds what made it: the label of the command (`update lib.f`), then, after a line break, the message it was given (`-m`), if any. One column, so the message goes wherever the entry does (a push, a pull, a migration), with any tcm; it's in no hash, so it can change without changing history.
entryTitle (c: { command: string; message?: string | undefined; }) => string
What a history entry is called: its message's first line, or else the label of the command that made it.
jsxOf (ir: string) => { jsx?: string | undefined; }
The JSX runtime a definition compiles to: part of its IR (and so its hash), read from there.
readEntryText (text: string) => { command: string; message?: string | undefined; }
entryText read back: the command's label, and the message, if there is one.
renamedSignature (signature: string, renames: ReadonlyMap<string, string>) => string
A signature with other names for what it names: `renames` maps the name a definition was made as (how a signature prints it) to the name to show. Only types and values are renamed, not property or parameter names (`{ Foo: Foo }` keeps its key), a qualified name's members, or what's in a string literal type.
sharePatches (db: DatabaseSync) => void
Layout step: patches kept whole for each branch (layout 8f648138…) go into sets branches share (85655ca2…). Main's are one set, and every branch reads a set of its own over it, holding where it differs (a patch main doesn't have, or one hiding a patch of main's it doesn't have); or a set of its own alone, where that's less.

Files

package file