Artifact 20379d5b64769f160eaf5e1480394f1121a1405ed82bb21e8ef76ebe9eb4067a:
- File
internal/fsltype/fsltype.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: 984) [annotate] [blame] [check-ins using]
// Package fsltype defines shared types used across internal packages. // These are re-exported by the root libfossil package. package fsltype import "time" // FslID is a row-id in the blob table (content-addressed artifacts). type FslID int64 // FslSize represents a blob size; negative values indicate phantom blobs. type FslSize int64 const ( // PhantomSize is the sentinel size for phantom (not-yet-received) blobs. PhantomSize FslSize = -1 // FossilApplicationID is the SQLite application_id for Fossil repositories. FossilApplicationID int32 = 252006673 ) const julianEpoch = 2440587.5 // TimeToJulian converts a time.Time to a Fossil Julian day number. func TimeToJulian(t time.Time) float64 { return julianEpoch + float64(t.UTC().UnixMilli())/(86400.0*1000.0) } // JulianToTime converts a Fossil Julian day number to time.Time. func JulianToTime(j float64) time.Time { millis := int64((j - julianEpoch) * 86400.0 * 1000.0) return time.UnixMilli(millis).UTC() }