Documentation
¶
Overview ¶
Package pgnoop manages the external pg-noop blackhole server binary used by the baseline command: resolving it from an embedded copy, the local cache, or the pinned GitHub release, and running it for the duration of a run.
Index ¶
- Constants
- Variables
- func AssetDigest(asset string) (string, error)
- func AssetName(goos, goarch string) (string, error)
- func CachePath() (string, error)
- func EmbeddedBinary() []byte
- func ExtractBinary(tarball []byte) ([]byte, error)
- func HostTarget() string
- func ReleaseURL(asset string) string
- func Resolve(ctx context.Context, opts Options) (string, error)
- type Consent
- type Options
- type Server
Constants ¶
const Version = "v0.2.0"
Version is the pg-noop release stroppy pins. Bump together with release.sha256 and the asset mapping below when upgrading.
Variables ¶
var ErrNoServerBinary = errors.New("pgnoop server binary unavailable")
ErrNoServerBinary reports that no binary source is available and what to do.
var ErrServerNotReady = errors.New("pgnoop: server did not become ready")
ErrServerNotReady reports that the server neither printed its listening line nor accepted connections within the readiness window.
var ErrUnknownDigest = errors.New("pgnoop: no pinned digest for asset")
ErrUnknownDigest is returned when a pinned asset has no compiled-in digest.
var ErrUnsupportedPlatform = errors.New("pgnoop: no release asset for this platform")
ErrUnsupportedPlatform is returned when no pg-noop release asset exists for the host platform.
Functions ¶
func AssetDigest ¶
AssetDigest returns the pinned sha256 hex digest for a release asset.
func CachePath ¶
CachePath returns ~/.stroppy/bin/pg-noop/<version>/<os>-<arch>/pgnoop for the host.
func EmbeddedBinary ¶
func EmbeddedBinary() []byte
EmbeddedBinary returns the server binary compiled into stroppy by CI release builds (build tag pgnoop_embed), or nil for plain builds.
func ExtractBinary ¶
ExtractBinary reads a pg-noop release tarball (tar.xz) and returns the raw server binary. The tarball wraps the binary in a per-target directory.
func HostTarget ¶
func HostTarget() string
HostTarget describes the host platform for reports and diagnostics.
func ReleaseURL ¶
ReleaseURL returns the download URL for a release asset.
Types ¶
type Options ¶
type Options struct {
// Path short-circuits resolution to an explicit binary (flag or env).
Path string
// Consent gates the download fallback.
Consent Consent
// Prompt receives the interactive download question and the user's answer
// source. Defaults to stdin/stderr when nil.
Prompt func(question string) bool
// Log receives progress lines. Optional.
Log func(format string, args ...any)
}
Options steers Resolve.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a pg-noop process bound to a loopback port for one baseline run.
func Start ¶
Start launches the server binary on loopback and waits for its listening announcement. Port zero selects an ephemeral port with bounded bind retries.