filesystem

package
v0.39.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package filesystem owns root-confined production filesystem access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup added in v0.36.0

func Backup(source string, readWithMode func(string) ([]byte, fs.FileMode, error), publish func(string, []byte, fs.FileMode) error) (string, error)

Types

type Handle

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

Handle provides root-confined filesystem operations.

func Open

func Open(root string) (*Handle, error)

Open opens root as a root-confined filesystem handle.

func (*Handle) Backup added in v0.36.0

func (h *Handle) Backup(source string) (string, error)

Backup reads source once, preserving its permission mode, then exclusively publishes a complete sibling backup at source.awf-bak or its first available numbered suffix. The supplied confined callbacks keep source access and publication policy with the caller while this package owns the shared naming and collision protocol. Backup copies a source beneath this handle to its first free sibling backup.

func (*Handle) Chmod added in v0.35.1

func (h *Handle) Chmod(path string, mode fs.FileMode) error

Chmod changes path's permission mode beneath the selected root.

func (*Handle) Close

func (h *Handle) Close() error

Close closes the root-confined filesystem handle.

func (*Handle) Info

func (h *Handle) Info(path string) (fs.FileInfo, error)

Info returns metadata for path, following a final symbolic link.

func (*Handle) LinkInfo

func (h *Handle) LinkInfo(path string) (fs.FileInfo, error)

LinkInfo returns metadata for path without following a final symbolic link.

func (*Handle) MkdirAll added in v0.34.0

func (h *Handle) MkdirAll(path string, mode fs.FileMode) error

MkdirAll creates path and missing parents beneath the selected root.

func (*Handle) Publish added in v0.34.0

func (h *Handle) Publish(path string, contents []byte, mode fs.FileMode) error

Publish atomically publishes one complete file without replacement beneath the selected root.

func (*Handle) Read

func (h *Handle) Read(path string) ([]byte, error)

Read reads path beneath the selected root.

func (*Handle) ReadWithMode added in v0.35.1

func (h *Handle) ReadWithMode(path string) ([]byte, fs.FileMode, error)

ReadWithMode reads path and returns its permission mode from one confined open.

func (*Handle) Remove added in v0.34.0

func (h *Handle) Remove(path string) error

Remove removes path beneath the selected root.

func (*Handle) Replace added in v0.34.0

func (h *Handle) Replace(destination string, contents []byte, mode fs.FileMode) (returnErr error)

Replace atomically replaces path with one complete file beneath the selected root, preserving the requested final mode.

func (*Handle) Walk

func (h *Handle) Walk(subtree string, visit func(path string, info fs.FileInfo) (bool, error)) error

Walk visits subtree entries with metadata describing each entry itself.

Jump to

Keyboard shortcuts

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