A Fossil repository engine in Go without cgo: it reads, writes and syncs Fossil repositories (the artifact format, the derived tables and the sync protocol). Go module
github.com/danmestas/go-libfossil(packagelibfossil), commandlibfossil. A repository is an ordinary.fossilSQLite file that stock fossil reads.
This file is generated from docs/site/llms-header.md plus the docs site. Every link below is a page on the docs site; llms-full.txt holds all pages in one file.
Key concepts
- Artifact: a text manifest made of cards (check-in, tag, wiki, cluster, ...). Its name is the SHA1 or SHA3-256 hash of its bytes.
- Repository state: the tables (
event,plink,mlink,tagxref,leaf, ...) derived from the artifacts by crosslinking, matching whatfossil rebuildwrites. - Sync: Fossil's card protocol over HTTP (
igot,gimme,file, ...), as a client (Clone,Repo.Sync,Repo.Pull) and a stateless server (libfossil repo serve). - Sparse cone: a set of paths a checkout or a store holds; content outside it is elided, not lost.
- Horizon: a check-in below which a store leaves history on the origin; at the structural depth the clone verifies a seed the origin can sign.
- Sub-manifests: an extension that writes a check-in as a tree of manifests instead of one flat file list, shared with zit.
- Driver: the
database/sqlSQLite driver, chosen by blank import:db/driver/modernc(pure Go) ordb/driver/ncruces(SQLite as WebAssembly, for js/wasm and wasip1).
Quick start
go install github.com/danmestas/go-libfossil/cmd/libfossil@latestlibfossil repo new notes.fossil, thenlibfossil -R notes.fossil repo open .,libfossil repo add README.md,libfossil repo ci -m "first notes".- From Go: blank-import a driver, then
libfossil.Create(path, libfossil.CreateOpts{User: "ana"})orlibfossil.Open(path), andr.Commit(libfossil.CommitOpts{...}),r.Timeline(libfossil.TimelineOpts{...}). - Sync:
libfossil.Clone(ctx, path, libfossil.NewHTTPTransport(url), libfossil.CloneOpts{}), thenr.Sync(ctx, t, libfossil.SyncOpts{Pull: true}).
Go packages
.(packagelibfossil):Repo,Create,Open,Clone, check-ins, checkouts, history, merge, sync.cli: the Kong command structs behindlibfossil, embeddable in another binary.db: the SQLite abstraction and driver registration.db/driver/modernc: pure-Go SQLite driver (separate module).db/driver/ncruces: SQLite-as-WebAssembly driver (separate module).observer/otel: OpenTelemetry observer (separate module).dst: deterministic simulation of sync between nodes.simio: clock, randomness and storage seams for deterministic tests.