feat(8.0)!: delete fork/branch/commit/history/versions — superseded by the Db API
The COW version-control surface (fork, branches, checkout, commit,
getHistory/streamHistory, asOfCommit, brain.versions) is gone, along with
its subsystems: src/versioning/, the COW object store (CommitLog,
CommitObject, RefManager, TreeObject), HistoricalStorageAdapter, and the
TypeAwareHNSWIndex path it kept alive. The Db API (now/transact/asOf/
with/persist/restore) is the one versioning model in 8.0.
Survivors and replacements:
- BlobStorage survives (the VFS stores file content through it), relocated
to src/storage/blobStorage.ts with binaryDataCodec.ts; its adapter
interface is now BlobStoreAdapter, slimmed to the consumed surface
(write/read/has/delete/getMetadata + MIME-aware compression policy).
- brain.migrate() backup branches are replaced by persist-before-migrate:
MigrateOptions.backupTo persists a hard-link snapshot of the current
generation before any transform runs; MigrationResult.backupPath reports
it, and brain.restore(path) brings it back wholesale.
- CLI: cow.ts (fork/branch/checkout/history/migrate) is replaced by
snapshot.ts — snapshot <path>, restore <path>, history (tx-log),
generation.
- New public read API: brain.transactionLog({limit}) exposes the reified
tx-log (generation/timestamp/meta, newest first) that backs the CLI
history command; TxLogEntry is exported.
Tests: superseded suites deleted; fork/commit blocks excised from shared
suites; BlobStorage tests relocated + reworked against the slimmed store;
migration tests now prove the backupTo snapshot/restore round trip; new
transactionLog coverage in db-mvcc.
This commit is contained in:
parent
431cd64406
commit
8f93add705
64 changed files with 1444 additions and 16313 deletions
|
|
@ -621,8 +621,27 @@ export class GenerationStore {
|
|||
async resolveTimestamp(
|
||||
timestampMs: number
|
||||
): Promise<{ generation: number; entry: TxLogEntry | null }> {
|
||||
const lines = await this.storage.readTxLogLines()
|
||||
let best: TxLogEntry | null = null
|
||||
for (const entry of await this.txLog()) {
|
||||
if (entry.timestamp <= timestampMs) {
|
||||
if (best === null || entry.generation > best.generation) best = entry
|
||||
}
|
||||
}
|
||||
return { generation: best?.generation ?? 0, entry: best }
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Read all committed tx-log entries, oldest first. Torn
|
||||
* trailing lines from a crashed append are tolerated and skipped, and
|
||||
* entries beyond the committed watermark are excluded — the tx-log is
|
||||
* advisory metadata; the manifest rename is the source of commit truth.
|
||||
* Compaction never rewrites the log, so entries may reference generations
|
||||
* whose record-sets were already reclaimed.
|
||||
* @returns Every committed {@link TxLogEntry}, in commit order.
|
||||
*/
|
||||
async txLog(): Promise<TxLogEntry[]> {
|
||||
const lines = await this.storage.readTxLogLines()
|
||||
const entries: TxLogEntry[] = []
|
||||
for (const line of lines) {
|
||||
let entry: TxLogEntry
|
||||
try {
|
||||
|
|
@ -630,11 +649,9 @@ export class GenerationStore {
|
|||
} catch {
|
||||
continue // tolerate a torn trailing line from a crashed append
|
||||
}
|
||||
if (entry.timestamp <= timestampMs && entry.generation <= this.committed) {
|
||||
if (best === null || entry.generation > best.generation) best = entry
|
||||
}
|
||||
if (entry.generation <= this.committed) entries.push(entry)
|
||||
}
|
||||
return { generation: best?.generation ?? 0, entry: best }
|
||||
return entries
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue