publish

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package publish keeps a completed output package private until one Linux atomic no-replace rename makes it visible at the requested destination.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

Transaction owns a private temporary sibling and retained directory identities. Dir is an operational path, valid until Cleanup, including for child processes. Callers finish the package and remove all staging material before Publish.

func Begin

func Begin(ctx context.Context, inputInfo os.FileInfo, outputDir string) (_ *Transaction, retErr error)

Begin validates an absent output with an existing, symlink-free parent outside the actual retained input directory. inputInfo must come from the open input root, not a new Stat of its pathname. No directories are created on validation failure. The private outer directory stays 0700 even when its package is ready for publication with mode 0755.

func (*Transaction) Cleanup

func (t *Transaction) Cleanup() error

Cleanup removes unpublished contents and the temporary outer directory. It is idempotent and never removes the published output. A caller must propagate any cleanup failure, preserving publication state when Published is true.

func (*Transaction) Dir

func (t *Transaction) Dir() string

Dir returns the private package directory. It deliberately uses a retained descriptor path so moving/replacing an output ancestor cannot redirect writes.

func (*Transaction) OutputDir

func (t *Transaction) OutputDir() string

OutputDir returns the requested absolute output path for operational diagnostics.

func (*Transaction) Publish

func (t *Transaction) Publish(ctx context.Context) error

Publish atomically installs a complete package without replacing any competing destination. It performs no fallible cleanup after a successful rename; call Cleanup separately. Unsupported kernels/filesystems fail explicitly.

func (*Transaction) Published

func (t *Transaction) Published() bool

Published reports whether the final no-replace rename completed. Cleanup errors after this point must retain the complete successful report and output.

Jump to

Keyboard shortcuts

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