IF Commons GitHub

AnyFS SQL

A SQLite database kept as an AnyFS store that merges by nature. Every change is a version row with a time-ordered id (UUIDv7), its replica, its parent and the digest of its fields, and the bytes are blobs keyed by their digest; the two tables have no row id and a key that ignores a second row, so that the data of any number of files, dumped as plain inserts by the real sqlite3 and replayed into one database, is their union: a cheap file-system sync. A database takes rows only from replicas it trusts, keeps the heads that did not win as siblings, and tells a copy of its file from the original. The current files, the names and the vector of what has been seen are views. A write that expects a revision is decided in one transaction, a batch is one transaction, and the history of a file and an index of its words are kept with it. The same layout is written for SQLite, PostgreSQL (primary keys that ignore nothing, so writes and dumps say ON CONFLICT DO NOTHING; trigger functions; a search index) and DuckDB (no trigger, so the import of the library holds what a trigger holds elsewhere), replicas of the three exchange rows and dumps, and a dump of the real pg_dump or sqlite3 is a valid input in its own engine and, written again (redump), in another. Under signed trust deltas, epochs and dumps are taken only with the signature of a key of the replica that made them, as a roster says; the real sqlite3 replaying a dump into such a database refuses a replica the roster does not name, and the signature of a raw import is the one thing only the library can check. The layout of the tables is documented so that a catalog can read it.

FactValue
Version0.1.0
Conformance levelL1
Distributedgithub
LicensePolyForm-Noncommercial-1.0.0, source-available: free for noncommercial use, commercial use needs a license from the owner (see Licensing in Start here)
Import it as@intellectual-frontiers/anyfs-sql

Areas

Layers

LayerFolderMay import of this library
governancesrc/governance/nothing
physicalsrc/physical/governance, logical

Imports

AnyFS, Core, Crypto, Lang Sql, System

Specifications

Folders

FolderWhat it isMay import
spec-kit/The library's own specifications, numbered from 0001.nothing: Markdown and TSV
src/governance/Layer 1: the dialects and the largest object of each, the names of the tables, the port of a database, the documented layout and the media types of names. Pure: no file, process or network.core and the governance of anyfs, by package name
src/physical/Layer 3: the statements built by the language of SQL, the migrations of the layout, the merge of replicas and the dump of the mergeable tables, the layout (every statement that names a table or a column, in one module the store calls by name), the store of a table and, in adapters/, the port of each driver.governance, by relative path; the language of SQL, the stores of anyfs and the digest of crypto, by package name
suite/The tests: every requirement, on the real engines (SQLite, PostgreSQL in PGlite, DuckDB) and on clearly named fakes over a real engine for the drivers that need a server, and the laws of AnyFS and of the bridge run against the stores.src/; the test module and the stores of anyfs, by package name
tools/The trace check and the packer bun run verify runs, and the throwaway PostgreSQL server of the tests.the trace of mizan, system and the packer of commons, by package name

Quality

Quality: 74 tests: 74 passed, 0 failed, 0 skipped, 61 of 62 requirements proved, 0 open issues, 0 open tickets. The tests and issues of the library

Titles, headings, exports, tables, columns and requirements. Esc closes.