{"modulePath":"github.com/kernel/hypeman","version":"v0.4.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package imagepush\n\nPackage imagepush manages outbound image pushes: exporting images from hypeman's OCI cache to remote container registries.\n\nA push job resolves a hypeman image to its cached manifest digest, then streams the cached blobs to the target reference through lib/registrypush. Jobs run on a bounded queue, persist their status to disk, and expose in-flight digests so the OCI cache GC keeps the required blobs alive.\n\n## Constants\n\n```go\nconst (\n\tStatusQueued  = \"queued\"\n\tStatusPushing = \"pushing\"\n\tStatusPushed  = \"pushed\"\n\tStatusFailed  = \"failed\"\n\n\t// DefaultPushTimeout bounds a single registry export so a wedged registry\n\t// cannot pin a queue slot forever.\n\tDefaultPushTimeout = 30 * time.Minute\n)\n```\n\n## Variables\n\n```go\nvar (\n\tErrNotFound      = errors.New(\"push not found\")\n\tErrImageNotReady = errors.New(\"image not ready for push\")\n\tErrInvalidTarget = errors.New(\"invalid push target\")\n\t// ErrCredentialConflict is returned when a push request matches an\n\t// in-flight job but its credential intent differs from that job's. The\n\t// manager never stores credential values, so it can only detect a\n\t// presence mismatch; two requests that both borrow different credentials\n\t// for the same target are indistinguishable and merge.\n\tErrCredentialConflict = errors.New(\"push already in flight with different credentials\")\n)\n```\n\n## Types\n\n```go\ntype ImageResolver interface {\n\tGetImage(ctx context.Context, name string) (*images.Image, error)\n}\n```\nImageResolver resolves a hypeman image name to its stored state.\n\n```go\ntype Manager interface {\n\t// CreatePush validates the request, persists a queued job, and enqueues it.\n\t// A request that matches an in-flight job (same digest and target) returns\n\t// the existing job instead of creating a duplicate; the in-flight job's\n\t// credentials remain in effect. A request whose credential presence\n\t// differs from the in-flight job's (one borrowed, one not) returns\n\t// ErrCredentialConflict instead of silently merging under the wrong auth.\n\tCreatePush(ctx context.Context, req PushRequest) (*Push, error)\n\tGetPush(ctx context.Context, id string) (*Push, error)\n\t// ListPushes returns all pushes, newest first.\n\tListPushes(ctx context.Context) ([]Push, error)\n\t// WaitForPush blocks until the push reaches a terminal state (pushed or\n\t// failed) or the context is cancelled. The HTTP API currently polls the\n\t// persisted job instead; this remains available to in-process callers.\n\tWaitForPush(ctx context.Context, id string) error\n\t// LiveCacheManifestDigests implements ocicachegc.RootsProvider: the\n\t// manifest digests of queued and pushing jobs, so the OCI cache GC keeps\n\t// their blobs alive mid-push.\n\tLiveCacheManifestDigests() []string\n}\n```\nManager orchestrates push jobs.\n\n```go\nfunc NewManager(p *paths.Paths, resolver ImageResolver, provider registrypush.Provider, maxConcurrent int) (Manager, error)\n```\nNewManager creates a push manager using DefaultPushTimeout. provider may be nil, in which case credentials resolve from the default Docker keychain. Interrupted pushes from a previous run are re-enqueued FIFO.\n\n```go\nfunc NewManagerWithTimeout(p *paths.Paths, resolver ImageResolver, provider registrypush.Provider, maxConcurrent int, timeout time.Duration) (Manager, error)\n```\nNewManagerWithTimeout creates a push manager with a per-push timeout.\n\n```go\ntype Push struct {\n\tID            string\n\tImage         string\n\tDigest        string\n\tTarget        string\n\tStatus        string\n\tQueuePosition *int\n\tError         *string\n\tLayers        int\n\tBytes         int64\n\tCreatedAt     time.Time\n\tCompletedAt   *time.Time\n}\n```\nPush is the state of one push job.\n\n```go\ntype PushRequest struct {\n\t// Image is the hypeman image name (tag or digest form).\n\tImage string\n\t// Target is the full remote reference, e.g. \"registry.example.com/app:v1\".\n\tTarget string\n\t// Insecure allows pushing to plain-HTTP registries.\n\tInsecure bool\n\t// Credentials are borrowed for this push only, docker-style: the caller's\n\t// registry login (e.g. resolved from the client's ~/.docker/config.json)\n\t// rides along with the request instead of living on the server. They are\n\t// never persisted or logged; a push interrupted across a restart cannot be\n\t// recovered and fails instead. When nil, the manager's default provider\n\t// resolves credentials.\n\tCredentials *authn.AuthConfig\n}\n```\nPushRequest describes a request to push a hypeman image to a remote registry.\n\n```go\ntype StatusEvent struct {\n\tStatus string\n\tErr    error\n}\n```\nStatusEvent represents a terminal status change for push notifications.\n\n","path":"github.com/kernel/hypeman/lib/imagepush","name":"imagepush","synopsis":"Package imagepush manages outbound image pushes: exporting images from hypeman's OCI cache to remote container registries.","isRedistributable":true}
