IF Commons GitHub

AnyFS SQL: the store

0005Active

0005-sql-store · owner if · domain commons

Requirements

FR-001checkpassing

read, stat and list MUST give an object's bytes and revision, its size and revision, and the objects below a prefix in the order of the bytes of their paths in pages with a cursor, by a range and never by a pattern, so that a name with a percent sign, an underscore or a quote is an ordinary name.

Enforced (check): .github: cd commons/anyfs-sql && bun run verify — suite/store.test.ts

Proved by: anyfs-sql/suite/store.test.ts

Written in: anyfs-sql/src/physical/store.ts

Tests: passed: suite/store.test.ts a list is the order of the bytes of the paths, in pages with a cursor, below a prefix by a; passed: suite/store.test.ts a path made to break a statement is only a value: it is stored, read back, listed and dele; passed: suite/store.test.ts the place names the dialect and the target and never a credential, the traits say case sen

FR-002checkpassing

A write MUST be decided by its expectation: no object is made only where none is there (one statement that returns a row only where it inserted), a revision replaces only the object at that revision (one statement that returns a row only where it updated), and any state replaces; two writers who expect the same state MUST NOT both win, and the same bytes written again MUST change nothing.

Enforced (check): .github: cd commons/anyfs-sql && bun run verify — suite/store.test.ts

Proved by: anyfs-sql/suite/store.test.ts

Written in: anyfs-sql/src/physical/store.ts

Tests: passed: suite/store.test.ts a write is decided by its expectation: no file, a revision or any state; the same bytes ag; passed: suite/store.test.ts the modified instant of a file is the time of its id, which comes from the clock the store

FR-003checkpassing

A revision MUST be sha256: and the digest of the bytes, made in the library so that it is the same as in every store; a delete MUST succeed where the object is gone and leave a path that has no history, and history MUST give the revisions of the puts of a path newest first.

Enforced (check): .github: cd commons/anyfs-sql && bun run verify — suite/store.test.ts

Proved by: anyfs-sql/suite/store.test.ts

Written in: anyfs-sql/src/physical/store.ts

Tests: passed: suite/store.test.ts a revision is sha256 and the digest of the bytes as every store makes it, a delete succeed

FR-004checkpassing

A batch MUST be one transaction: every change applies or none, and a change that fails (an expectation that does not hold, an object too large) MUST leave the database as it was.

Enforced (check): .github: cd commons/anyfs-sql && bun run verify — suite/store.test.ts

Proved by: anyfs-sql/suite/store.test.ts

Written in: anyfs-sql/src/physical/store.ts

Tests: passed: suite/store.test.ts a batch is one transaction: every change applies or none, an expectation that fails and an

FR-005checkpassing

A rename MUST move an object, its history and its search to a path where there is none as one transaction, MUST refuse a move onto an object, and MUST refuse a move to the same path.

Enforced (check): .github: cd commons/anyfs-sql && bun run verify — suite/store.test.ts

Proved by: anyfs-sql/suite/store.test.ts

Written in: anyfs-sql/src/physical/store.ts

Tests: passed: suite/store.test.ts a rename is a put at the new path and a tombstone at the old in one transaction, refuses a

FR-006checkpassing

search MUST be a capability only where the engine has the index, MUST find the objects whose bytes are text that holds the words, below a prefix, and MUST treat the words as words: no operator of the engine's query syntax can be written by the caller.

Enforced (check): .github: cd commons/anyfs-sql && bun run verify — suite/store.test.ts

Proved by: anyfs-sql/suite/store.test.ts

Written in: anyfs-sql/src/physical/store.ts

Tests: passed: suite/store.test.ts search finds text files by their words below a prefix, follows a change, a rename and a de

FR-007checkpassing

An object larger than the store's limit MUST be refused as too large and never cut, bytes that are not the ones their revision names MUST be reported as tampered, and a busy or locked database MUST be reported as unavailable and retryable.

Enforced (check): .github: cd commons/anyfs-sql && bun run verify — suite/store.test.ts

Proved by: anyfs-sql/suite/store.test.ts

Written in: anyfs-sql/src/physical/store.ts

Tests: passed: suite/store.test.ts an object over the limit is refused as too large and never cut, bytes that are not the one

FR-008checkpassing

Every statement that names a table or a column MUST be in one module, the layout (layout.ts), called by name by the store, so that the store holds the rules of an operation and no name of a table, a column or a key, and a different layout of the rows is a replacement of that module and of the migrations and nothing else.

Enforced (check): .github: cd commons/anyfs-sql && bun run verify — suite/store.test.ts

Proved by: anyfs-sql/suite/store.test.ts

Written in: anyfs-sql/src/physical/layout.ts

Tests: passed: suite/store.test.ts the store names no table, no column and builds no statement: every statement is in the lay

Cited by: AnyFS SQL: the schema

Acceptance scenarios

  1. Given two writers who both expect no object at a path, When both write, Then exactly one wins and the other has the conflict, per FR-002.
  2. Given a batch whose last change fails, When it ends, Then the first change is not there, per FR-004.
  3. Given the names a%, a_b and a/%, When they are listed below a, Then only a/% is, since a prefix is a range and not a pattern, per FR-001.
  4. Given the source of the store, When it is read, Then it builds no statement and names no table, per FR-008.

Out of scope

  • Ranges, append and streams: whole objects only.

Edge cases

  • A prefix that is the root lists every object (FR-001).

Assumptions

Open questions

  • None.

Key entities

  • Port, Dialect, Layout, Revision.

Success criteria

SC-001success criterion

Every behaviour is tested on the real engines in memory or in temporary folders, with no network and no real time.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No company fact is asserted here
  • [x] Every open item is marked, not silently decided

Cited by

AnyFS SQL: the schema

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