session

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 16 Imported by: 0

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

View Source
const DefaultDBPath = "phpbotscout.db"

DefaultDBPath is where the index lives when configuration says nothing.

Variables

This section is empty.

Functions

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 DBPath

func DBPath(p *props.Props) string

DBPath reports where the index lives.

func Discoverer

func Discoverer(ctx context.Context, p *props.Props) (*corpus.Discoverer, error)

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 RenderReport

func RenderReport(w io.Writer, r indexer.Report)

RenderReport prints the outcome of an indexing run.

func RenderStatus

func RenderStatus(w io.Writer, statuses []indexer.SourceStatus)

RenderStatus prints per-source staleness.

func Token

func Token(ctx context.Context, p *props.Props) string

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.

Types

type Session

type Session struct {
	Indexer *indexer.Indexer
	DB      *store.DB
}

Session is an opened index with everything needed to work on it.

func Open

func Open(ctx context.Context, p *props.Props) (*Session, error)

Open wires an indexer from configuration.

func (*Session) Close

func (s *Session) Close() error

Close releases the database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL