Documentation
¶
Overview ¶
Package content reconstructs full artifact content from Fossil's delta-chain storage.
Fossil stores blobs either as full content or as deltas against a source blob. Expand walks the delta chain from a given RID back to the root, decompresses each link, and applies deltas in sequence to produce the original content. Cycle detection prevents infinite loops.
Verify expands a blob and compares its hash (SHA1 or SHA3-256) against the stored UUID. IsPhantom checks whether a blob is a placeholder awaiting delivery during sync.
Index ¶
- Constants
- func Expand(q db.Querier, rid libfossil.FslID) (result []byte, err error)
- func GenerateClusters(q db.Querier) (int, error)
- func IsPhantom(q db.Querier, rid libfossil.FslID) (bool, error)
- func IsPrivate(q db.Querier, rid int64) bool
- func MakePrivate(q db.Querier, rid int64) error
- func MakePublic(q db.Querier, rid int64) error
- func Verify(q db.Querier, rid libfossil.FslID) error
- type Cache
- type CacheStats
Constants ¶
const ( // ClusterThreshold is the minimum number of unclustered, non-phantom blobs // before cluster generation triggers. ClusterThreshold = 100 // ClusterMaxSize is the maximum number of M-cards per cluster artifact. ClusterMaxSize = 800 )
Variables ¶
This section is empty.
Functions ¶
func GenerateClusters ¶
GenerateClusters creates cluster artifacts for unclustered blobs that are not phantoms, shunned, or private. Returns the number of clusters created.
func MakePrivate ¶
MakePrivate inserts the rid into the private table (no-op if already present).
func MakePublic ¶
MakePublic removes the rid from the private table (no-op if not present).
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a concurrency-safe LRU cache for expanded blob content. It reduces redundant delta-chain walks by caching the fully-expanded result of Expand, keyed by rid.
A nil *Cache is valid and acts as a passthrough to Expand.
func (*Cache) Expand ¶
Expand returns the expanded content for rid, serving from cache when possible. On a cache miss, it delegates to the package-level Expand and caches the result. A nil receiver falls through to Expand directly.
func (*Cache) Invalidate ¶
Invalidate removes a single rid from the cache.
func (*Cache) Stats ¶
func (c *Cache) Stats() CacheStats
Stats returns a snapshot of cache statistics.