Documentation
¶
Index ¶
- func Catalog(ctx context.Context, st StateReaderInterface, store VersionReaderInterface, ...) ([]byte, error)
- func DecodeCursor(token string) (seq int64, version string, ok bool)
- func EncodeCursor(seq int64, version string) string
- func Key(ctx context.Context, st StateReaderInterface, store VersionReaderInterface, ...) ([]byte, bool, error)
- func Metrics(ctxObj view.ContextObj, publicEnabled bool, internalEnabled bool, ...) ([]byte, error)
- func Version(ctx context.Context, st StateReaderInterface, store DetailReaderInterface, ...) ([]byte, bool, error)
- type DetailReaderInterface
- type OverlayInterface
- type PageCursorObj
- type StateReaderInterface
- type VersionReaderInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Catalog ¶
func Catalog(ctx context.Context, st StateReaderInterface, store VersionReaderInterface, ctxObj view.ContextObj) ([]byte, error)
Catalog builds the catalog page with all keys sorted by name. store provides per-key latest detection for badges, cached with the page by ETag. ctx comes from the HTTP request so client cancellation stops detection queries.
func DecodeCursor ¶
DecodeCursor reverses EncodeCursor. ok=false rejects a malformed token so the caller falls back to the newest page instead of trusting attacker-supplied cursor bytes.
func EncodeCursor ¶
EncodeCursor packs a (upstream_seq, version) keyset position into an opaque URL-safe token.
func Key ¶
func Key(ctx context.Context, st StateReaderInterface, store VersionReaderInterface, lnk link.Obj, ctxObj view.ContextObj, key string, cursor PageCursorObj, pageSize int) ([]byte, bool, error)
Key builds the key page: newest-first version window, keyset pagination, badges and install snippets. found=false means the caller will return 404. The zero cursor selects the newest page.
func Metrics ¶
func Metrics(ctxObj view.ContextObj, publicEnabled bool, internalEnabled bool, yggEnabled bool, refreshInterval time.Duration) ([]byte, error)
Metrics builds the metric group index honoring the current entry's flags. Groups that would return 404 are hidden from navigation: internal behind its own gate, the ygg group additionally requires a running Yggdrasil node. refreshInterval sets the live polling period for JSON groups on the page.
func Version ¶
func Version(ctx context.Context, st StateReaderInterface, store DetailReaderInterface, ov OverlayInterface, lnk link.Obj, ctxObj view.ContextObj, key string, version string, listenerID string, altOv OverlayInterface, altListenerID string) ([]byte, bool, error)
Version builds the version page: integrity, source, downloads, snippets, notes and history navigation. found=false means 404; listenerID keeps host-sensitive artifacts in sync. altOv/altListenerID bind the opposite entry. nil altOv disables alternate snippets to avoid mixing host-sensitive artifacts and current-entry module paths with a different host.
Types ¶
type DetailReaderInterface ¶
type DetailReaderInterface interface {
GetVersion(ctx context.Context, key string, version string) (core.VersionObj, bool, error)
GetDetection(ctx context.Context, key string, version string) (core.DetectionObj, bool, error)
ListArtifacts(ctx context.Context, key string, version string) ([]core.ArtifactObj, error)
GetArtifact(ctx context.Context, keyObj core.ArtifactKeyObj) (core.ArtifactObj, bool, error)
ListVersionsKeyset(ctx context.Context, key string, includeDeleted bool, afterSeq int64, afterVersion string, limit int) ([]core.VersionObj, error)
ListVersionsKeysetBefore(ctx context.Context, key string, includeDeleted bool, beforeSeq int64, beforeVersion string, limit int) ([]core.VersionObj, error)
}
DetailReaderInterface reads one version with metadata, artifacts, detection, and history window. The two keyset directions fetch the immediate older/newer neighbors of a version without scanning.
type OverlayInterface ¶
type OverlayInterface interface {
GoPublishable(key string, version string, detectionObj core.DetectionObj, candidateObj *overlay.CandidateObj) bool
TargetModulePath(key string, version string) string
UniversalTopDir(key string, version string, detectionObj core.DetectionObj, candidateObj *overlay.CandidateObj) string
}
OverlayInterface exposes host-dependent overlay operations already bound to a listener.
type PageCursorObj ¶
type PageCursorObj struct {
Set bool // false → newest page (no cursor in the URL)
Newer bool // true → versions newer than (Seq,Version); false → older
Seq int64 // upstream_seq half of the keyset cursor
Version string // version half of the keyset cursor
}
PageCursorObj addresses one keyset page of the key version list. The zero value (Set=false) selects the newest page.
func AfterCursor ¶
func AfterCursor(seq int64, version string) PageCursorObj
AfterCursor builds the "older" input cursor from a decoded token.
func BeforeCursor ¶
func BeforeCursor(seq int64, version string) PageCursorObj
BeforeCursor builds the "newer" input cursor from a decoded token.
type StateReaderInterface ¶
type StateReaderInterface interface {
KeyState(key string) (state.KeyStateObj, bool)
KeyStates() []state.KeyStateObj
Checksums() state.ChecksumSetObj
}
StateReaderInterface is the narrow state read surface for catalog, key, and version pages.
type VersionReaderInterface ¶
type VersionReaderInterface interface {
CountVersions(ctx context.Context, key string) (uint64, error)
ListVersionsKeyset(ctx context.Context, key string, includeDeleted bool, afterSeq int64, afterVersion string, limit int) ([]core.VersionObj, error)
ListVersionsKeysetBefore(ctx context.Context, key string, includeDeleted bool, beforeSeq int64, beforeVersion string, limit int) ([]core.VersionObj, error)
GetDetection(ctx context.Context, key string, version string) (core.DetectionObj, bool, error)
}
VersionReaderInterface reads key version history for the key page via keyset pagination.