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.