Artifact 904122f7502fab57b3909de837488b29eddc4427de1d83d44eb65201747d630f:
- File
internal/content/private.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: 1125) [annotate] [blame] [check-ins using]
package content import ( "github.com/danmestas/libfossil/db" ) // IsPrivate returns true if the blob with the given rid is in the private table. func IsPrivate(q db.Querier, rid int64) bool { if q == nil { panic("content.IsPrivate: q must not be nil") } if rid <= 0 { panic("content.IsPrivate: rid must be positive") } var n int err := q.QueryRow("SELECT 1 FROM private WHERE rid=?", rid).Scan(&n) return err == nil } // MakePrivate inserts the rid into the private table (no-op if already present). func MakePrivate(q db.Querier, rid int64) error { if q == nil { panic("content.MakePrivate: q must not be nil") } if rid <= 0 { panic("content.MakePrivate: rid must be positive") } _, err := q.Exec("INSERT OR IGNORE INTO private(rid) VALUES(?)", rid) return err } // MakePublic removes the rid from the private table (no-op if not present). func MakePublic(q db.Querier, rid int64) error { if q == nil { panic("content.MakePublic: q must not be nil") } if rid <= 0 { panic("content.MakePublic: rid must be positive") } _, err := q.Exec("DELETE FROM private WHERE rid=?", rid) return err }