Documentation
¶
Overview ¶
Package session wires the index commands to their dependencies.
A sibling of the command packages rather than their parent: the parent registers them, so anything they share has to live beside them.
Package session wires the index commands to their dependencies.
A sibling of the command packages rather than their parent: the parent registers them, so anything they share has to live beside them.
Index ¶
- Constants
- func ClonesPath(p *props.Props) string
- func Credential(p *props.Props) forge.CredentialSource
- func DBPath(p *props.Props) string
- func Discoverer(ctx context.Context, p *props.Props) (*corpus.Discoverer, error)
- func RefreshInterval(p *props.Props) time.Duration
- func RenderReport(w io.Writer, r indexer.Report)
- func RenderStatus(w io.Writer, statuses []indexer.SourceStatus, interval time.Duration)
- func ResolveRefreshInterval(raw string) (time.Duration, error)
- func SSH(p *props.Props) (*indexer.SSH, error)
- func Servers(p *props.Props) []comms.ID
- func Token(ctx context.Context, p *props.Props) string
- type Session
Constants ¶
const DefaultDBPath = "phpbotscout.db"
DefaultDBPath is where the index lives when configuration says nothing.
const MinRefreshInterval = time.Minute
MinRefreshInterval is the shortest accepted refresh interval.
Every refresh fetches each source that may have moved. Seconds would put the bot in a polling loop against the forge, which is a denial of service aimed at the project's own infrastructure.
Variables ¶
This section is empty.
Functions ¶
func ClonesPath ¶ added in v0.14.0
ClonesPath reports where the indexer keeps its clones.
func Credential ¶
func Credential(p *props.Props) forge.CredentialSource
Credential composes the credential used to reach GitLab.
GTB owns this ladder. go/forge v0.8.0 moved credential precedence out of the module and into the consumer's stack, and vcs.ForgeCredential IS that stack — the same four rungs this project documents, in the same order: an environment variable NAME, a keychain reference, a literal, then the well-known variable.
Composing it here instead would be a second statement of the same precedence, which is the thing the move was meant to stop. It would also miss what GTB adds around it: origin reporting that can tell an operator WHICH rung resolved without printing the secret, and the documented reason forge.ConfigCredential is unsuitable (its stale-key probe reports a working auth.env configuration as stale when pointed at auth.value).
func Discoverer ¶
Discoverer builds namespace discovery from the configured forge.
One function, so the provider is constructed identically for every command and for the daemon's refresher.
func RefreshInterval ¶ added in v0.14.0
RefreshInterval reports the configured refresh interval, which staleness is judged against. A value serve would refuse falls back to the default rather than failing a status read.
func RenderReport ¶
RenderReport prints the outcome of an indexing run.
func RenderStatus ¶
RenderStatus prints per-source staleness, judged against the refresh interval.
func ResolveRefreshInterval ¶ added in v0.14.0
ResolveRefreshInterval parses and bounds index.refresh_interval, defaulting when it is empty.
func SSH ¶ added in v0.14.0
SSH reports the key the indexer clones with, or nil to clone over HTTPS (spec 0033 D2, OQ2). A key without a pinned known_hosts file is refused, as is either file missing, so the mistake surfaces before any source is fetched.
func Token ¶
Token resolves the credential used to clone.
An empty token is not an error: the corpus is public by construction, and a public repository clones unauthenticated. It only costs rate limit. A source that is configured but BROKEN is different, and is logged rather than swallowed — a silent empty token surfaces later as a confusing 401.