Documentation
¶
Overview ¶
Package pkgs is silo's per-repo dependency-index facade. It opens <repo>.git/pkgs.sqlite3 lazily via the git-pkgs/index package, caches open handles in an LRU, and provides a handler for the pkgs-reindex job kind drained by internal/jobs.
Index ¶
Constants ¶
const DBFile = "pkgs.sqlite3"
DBFile is the per-bare-repo sqlite filename.
const DefaultCacheSize = 32
DefaultCacheSize bounds open index.Index handles in the Store LRU.
const JobKind = "pkgs-reindex"
JobKind is the registered jobs.Worker handler key.
const MaxManifestBytes = 10 * 1024 * 1024
MaxManifestBytes caps the input passed to manifests.Parse for one-sided or two-sided render calls. Mirrors the cap silo plans to land upstream in manifests; until that lands, this is silo's local bound.
Variables ¶
This section is empty.
Functions ¶
func IsManifest ¶
IsManifest reports whether silo should render path with the rich manifest view rather than the raw blob view.
Types ¶
type DeltaCache ¶
type DeltaCache struct {
// contains filtered or unexported fields
}
DeltaCache memoises Textconv results by (oldOID, newOID, path). This is the placeholder until `git-pkgs/oidcache` lands; it intentionally uses a drop-the-whole-map eviction policy because per-pair Textconv calls are cheap to recompute.
func NewDeltaCache ¶
func NewDeltaCache() *DeltaCache
NewDeltaCache returns a DeltaCache capped at 4096 entries.
func (*DeltaCache) GetOrCompute ¶
func (c *DeltaCache) GetOrCompute(oldOID, newOID, path string, fn func() (*FileDelta, error)) (*FileDelta, error)
GetOrCompute returns the cached *FileDelta for the given OID pair and path, computing it via `fn` on miss. `fn` is invoked at most once per key under normal contention.
func (*DeltaCache) SetCap ¶
func (c *DeltaCache) SetCap(n int64)
SetCap overrides the entry cap (test hook).
type DepGroup ¶
type DepGroup struct {
Scope manifests.Scope
Deps []manifests.Dependency
}
DepGroup is one runtime/dev/test scope inside a FileView.
type FileDelta ¶
type FileDelta struct {
Path string
Ecosystem string
Kind manifests.Kind
Added []manifests.Dependency
Removed []manifests.Dependency
Updated []DepUpdate
}
FileDelta is the rich "+kamal 1.0.0 / puma 5→6" view of one changed manifest. Computed statelessly from the two blob payloads.
type FileView ¶
type FileView struct {
Path string
Ecosystem string
Kind manifests.Kind
Groups []DepGroup
Total int
Direct int
}
FileView is the one-sided dependency table rendered on the blob page.
type ReindexPayload ¶
type ReindexPayload struct {
Owner string `json:"owner"`
Repo string `json:"repo"`
Branch string `json:"branch"`
Old string `json:"old"`
New string `json:"new"`
}
ReindexPayload is the JSON encoded in the jobs.payload column for a pkgs-reindex job.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an LRU of repoPath -> *index.Index. Concurrent Index calls for the same repo serialise; for different repos they overlap.
func (*Store) Index ¶
Index returns (and caches) the *index.Index for the bare repo at repoPath. repoPath must end in `.git`. The db is created on first Open with the store's configured Options.
func (*Store) Reindex ¶
func (s *Store) Reindex(ctx context.Context, gst *gitstore.Store, owner, repo, branch string, old, new plumbing.Hash) error
Reindex resolves the bare repo for owner/repo via gitstore, opens the index db, and walks old..new on the branch. Evicts any cached handle for this repo first so go-git re-reads the on-disk object store: a long-lived open *git.Repository can miss loose objects that were written by another process between the previous reindex and this one.