Artifact fabb29eb54d5bf72280d9e5739845af39501f3f94da505ddd05c4961e52434ef:
- File
internal/xfer/card_tablesync.go
— part of check-in
[f5744359d3]
at
2026-04-19 16:30:54
on branch trunk
— Initial open source release
libfossil is a pure-Go implementation of the Fossil SCM, reading and writing the same .fossil SQLite repository format as upstream Fossil.
This is the first public release of code that previously lived in a private repository. The module path is github.com/danmestas/libfossil and the binary is named libfossil to avoid $PATH collisions with upstream fossil.
Included: - Repo lifecycle (create, clone), checkout/checkin, timeline, merge, diff, annotate, shun, tag, branch, bisect, stash, undo/redo - Sync-over-HTTP protocol (client and handler) - Two SQLite drivers: modernc (pure Go, default) and ncruces (wasm-capable) - Observer interfaces (SyncObserver, CheckoutObserver) with an optional OpenTelemetry implementation in observer/otel (separate submodule) - Deterministic simulation testing harness with BUGGIFY fault injection - Kong-based embeddable CLI under cli/ and a standalone binary under cmd/libfossil/ (user: [email protected], size: 1347) [annotate] [blame] [check-ins using]
package xfer // SchemaCard declares a synced extension table. // Wire: schema TABLE VERSION HASH MTIME SIZE\nJSON type SchemaCard struct { Table string // table name (without x_ prefix) Version int Hash string // SHA1 of canonical schema definition MTime int64 Content []byte // raw JSON schema definition } func (c *SchemaCard) Type() CardType { return CardSchema } // XIGotCard announces possession of a table sync row. // Wire: xigot TABLE PK_HASH MTIME type XIGotCard struct { Table string PKHash string MTime int64 } func (c *XIGotCard) Type() CardType { return CardXIGot } // XGimmeCard requests a table sync row. // Wire: xgimme TABLE PK_HASH type XGimmeCard struct { Table string PKHash string } func (c *XGimmeCard) Type() CardType { return CardXGimme } // XRowCard carries a table sync row payload. // Wire: xrow TABLE PK_HASH MTIME SIZE\nJSON type XRowCard struct { Table string PKHash string MTime int64 Content []byte // raw JSON row data } func (c *XRowCard) Type() CardType { return CardXRow } // XDeleteCard marks a table sync row as deleted (tombstone). // Wire: xdelete TABLE PK_HASH MTIME SIZE\nJSON_PK_DATA type XDeleteCard struct { Table string PKHash string MTime int64 PKData []byte // JSON-encoded PK column values } func (c *XDeleteCard) Type() CardType { return CardXDelete }