Documentation
¶
Index ¶
- Constants
- Variables
- func Contain(root, candidate string) (string, error)
- func ContentHash(data []byte) string
- func ControlPlaneDenied() []string
- func IsControlPlanePath(candidate string) (string, bool)
- func OpenFileParent(root *os.Root, name string, create bool) (*os.Root, string, error)
- func ReplaceFile(src, dst string) error
- func ResolveRoot(root string) (string, error)
- func ResolveSessionCwd(f *Factory, cwd, fallback string) (string, error)
- func SetControlPlaneDenied(paths ...string) error
- func Within(root, abs string) bool
- func WithinControlPlane(deniedDirs []string, candidate string) (string, bool)
- func WriteFileAtomic(absPath string, data []byte) error
- type Factory
- func (f *Factory) Allows(root string) (string, bool)
- func (f *Factory) Default() string
- func (f *Factory) DescribeRoots() string
- func (f *Factory) Open(root string) (*View, error)
- func (f *Factory) Resolve(root string) (string, error)
- func (f *Factory) Roots() []string
- func (f *Factory) SetRoots(roots []string) error
- type Files
- type View
- func (v *View) Contains(abs string) bool
- func (v *View) MkdirAll(_ context.Context, name string) error
- func (v *View) ReadDir(_ context.Context, name string) ([]os.DirEntry, error)
- func (v *View) ReadFile(_ context.Context, name string) ([]byte, error)
- func (v *View) Remove(_ context.Context, name string) error
- func (v *View) Rename(_ context.Context, from, to string) error
- func (v *View) Resolve(candidate string) (string, error)
- func (v *View) Root() string
- func (v *View) Stat(_ context.Context, name string) (os.FileInfo, error)
- func (v *View) Sub(dir string) (Files, error)
- func (v *View) WalkDir(_ context.Context, name string, fn fs.WalkDirFunc) error
- func (v *View) WriteFile(_ context.Context, name string, data []byte) error
Constants ¶
View Source
const AtomicTempPrefix = ".contenox-tmp-"
Variables ¶
View Source
var ErrControlPlane = errors.New("path is inside the runtime control plane")
View Source
var ErrCwdNotPermitted = errors.New("session cwd is not permitted")
View Source
var ErrEscape = errors.New("path escapes workspace root")
View Source
var ErrNotAllowed = errors.New("workspace root is not allowed")
Functions ¶
func ContentHash ¶
func ControlPlaneDenied ¶
func ControlPlaneDenied() []string
func IsControlPlanePath ¶
func OpenFileParent ¶
OpenFileParent pins the directories of a workspace-relative file without following symlinks. The caller owns the returned parent and uses the leaf for subsequent rooted file operations.
func ReplaceFile ¶
func ResolveRoot ¶
func SetControlPlaneDenied ¶
func WithinControlPlane ¶
func WriteFileAtomic ¶
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func (*Factory) DescribeRoots ¶
type Files ¶
type Files interface {
ReadFile(ctx context.Context, name string) ([]byte, error)
WriteFile(ctx context.Context, name string, data []byte) error
MkdirAll(ctx context.Context, name string) error
Remove(ctx context.Context, name string) error
Rename(ctx context.Context, from, to string) error
Stat(ctx context.Context, name string) (os.FileInfo, error)
ReadDir(ctx context.Context, name string) ([]os.DirEntry, error)
WalkDir(ctx context.Context, name string, fn fs.WalkDirFunc) error
Sub(dir string) (Files, error)
}
Click to show internal directories.
Click to hide internal directories.