Documentation
¶
Index ¶
- Variables
- func NewRoot(mountName string, m *config.MountConfig, primaryRootPath string, ...) (fs.InodeEmbedder, error)
- func NewRootWithReload(mountName string, m *config.MountConfig, primaryRootPath string, ...) (fs.InodeEmbedder, error)
- type DirHandle
- type DiskAccessConfig
- type FileHandle
- func (h *FileHandle) Fsync(ctx context.Context, flags uint32) syscall.Errno
- func (h *FileHandle) Read(ctx context.Context, dest []byte, off int64) (gofuse.ReadResult, syscall.Errno)
- func (h *FileHandle) Release(ctx context.Context) syscall.Errno
- func (h *FileHandle) Write(ctx context.Context, data []byte, off int64) (uint32, syscall.Errno)
- type Node
- func (n *Node) Create(ctx context.Context, name string, flags uint32, mode uint32, ...) (*fs.Inode, fs.FileHandle, uint32, syscall.Errno)
- func (n *Node) Flush(ctx context.Context, f fs.FileHandle) syscall.Errno
- func (n *Node) Fsync(ctx context.Context, f fs.FileHandle, flags uint32) syscall.Errno
- func (n *Node) Getattr(ctx context.Context, f fs.FileHandle, out *gofuse.AttrOut) syscall.Errno
- func (n *Node) Getxattr(ctx context.Context, attr string, dest []byte) (uint32, syscall.Errno)
- func (n *Node) Link(ctx context.Context, target fs.InodeEmbedder, name string, ...) (*fs.Inode, syscall.Errno)
- func (n *Node) Listxattr(ctx context.Context, dest []byte) (uint32, syscall.Errno)
- func (n *Node) Lookup(ctx context.Context, name string, out *gofuse.EntryOut) (*fs.Inode, syscall.Errno)
- func (n *Node) Mkdir(ctx context.Context, name string, mode uint32, out *gofuse.EntryOut) (*fs.Inode, syscall.Errno)
- func (n *Node) Open(ctx context.Context, flags uint32) (fs.FileHandle, uint32, syscall.Errno)
- func (n *Node) OpenCounts(ctx context.Context, files []daemonctl.OpenFileID) ([]daemonctl.OpenStat, error)
- func (n *Node) OpendirHandle(ctx context.Context, flags uint32) (fs.FileHandle, uint32, syscall.Errno)
- func (n *Node) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno)
- func (n *Node) Release(ctx context.Context, f fs.FileHandle) syscall.Errno
- func (n *Node) Reload(ctx context.Context, configPath string) (bool, []string, error)
- func (n *Node) Removexattr(ctx context.Context, attr string) syscall.Errno
- func (n *Node) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, ...) syscall.Errno
- func (n *Node) Rmdir(ctx context.Context, name string) syscall.Errno
- func (n *Node) Setattr(ctx context.Context, f fs.FileHandle, in *gofuse.SetAttrIn, ...) syscall.Errno
- func (n *Node) Setxattr(ctx context.Context, attr string, data []byte, flags uint32) syscall.Errno
- func (n *Node) Statfs(ctx context.Context, out *gofuse.StatfsOut) syscall.Errno
- func (n *Node) Unlink(ctx context.Context, name string) syscall.Errno
- func (n *Node) WrapChild(ctx context.Context, ops fs.InodeEmbedder) fs.InodeEmbedder
- type OpenTracker
Constants ¶
This section is empty.
Variables ¶
var ( // ErrReloadRequiresRestart indicates the requested config change cannot be applied without restarting the mount. ErrReloadRequiresRestart = errkind.SentinelError("reload requires restart") )
Functions ¶
func NewRoot ¶
func NewRoot(mountName string, m *config.MountConfig, primaryRootPath string, db *indexdb.DB, baseLog zerolog.Logger, diskCfg DiskAccessConfig) (fs.InodeEmbedder, error)
NewRoot creates the PolicyFS root node for mounting.
Currently this is a thin wrapper around go-fuse's loopback root to keep behavior identical while we incrementally add PolicyFS operations.
func NewRootWithReload ¶
func NewRootWithReload(mountName string, m *config.MountConfig, primaryRootPath string, db *indexdb.DB, baseLog zerolog.Logger, diskCfg DiskAccessConfig, fuseAllowOther bool, rootLogCfg config.LogConfig) (fs.InodeEmbedder, error)
NewRootWithReload creates the PolicyFS root node for mounting, including reload state.
Types ¶
type DirHandle ¶
type DirHandle struct {
// contains filtered or unexported fields
}
DirHandle is a directory handle backed by a fixed list of entries.
func (*DirHandle) Readdirent ¶
Readdirent returns directory entries one by one.
func (*DirHandle) Releasedir ¶
Releasedir releases any resources held by the directory handle.
type DiskAccessConfig ¶
type DiskAccessConfig struct {
Enabled bool
// DedupTTL is a best-effort deduplication window for identical events.
// When <= 0, deduplication is disabled.
DedupTTL time.Duration
// SummaryInterval controls periodic summary emission.
// When <= 0, summary emission is disabled.
SummaryInterval time.Duration
}
DiskAccessConfig controls the optional disk access logging mode for `pfs mount`.
The intent is debugging: identify which process wakes up indexed storage by opening files. All durations are interpreted as seconds-based flags in the CLI.
type FileHandle ¶
type FileHandle struct {
// contains filtered or unexported fields
}
FileHandle caches open-time resolution for performance.
The key invariant is: READ/WRITE must not redo any path/routing work; they only use the cached `fd`.
func (*FileHandle) Read ¶
func (h *FileHandle) Read(ctx context.Context, dest []byte, off int64) (gofuse.ReadResult, syscall.Errno)
Read reads bytes from the already-open file descriptor.
type Node ¶
type Node struct {
*fs.LoopbackNode
// contains filtered or unexported fields
}
Node is a PolicyFS inode implementation (including the root inode).
func (*Node) Create ¶
func (n *Node) Create(ctx context.Context, name string, flags uint32, mode uint32, out *gofuse.EntryOut) (*fs.Inode, fs.FileHandle, uint32, syscall.Errno)
Create creates a new file on a selected write target.
func (*Node) Link ¶
func (n *Node) Link(ctx context.Context, target fs.InodeEmbedder, name string, out *gofuse.EntryOut) (*fs.Inode, syscall.Errno)
Link creates a hardlink to an existing inode.
Cross-target hardlinks are not supported and must return EXDEV.
func (*Node) Lookup ¶
func (n *Node) Lookup(ctx context.Context, name string, out *gofuse.EntryOut) (*fs.Inode, syscall.Errno)
Lookup resolves a child entry using the router's read target order.
func (*Node) Mkdir ¶
func (n *Node) Mkdir(ctx context.Context, name string, mode uint32, out *gofuse.EntryOut) (*fs.Inode, syscall.Errno)
Mkdir creates a new directory on a selected write target.
func (*Node) OpenCounts ¶
func (n *Node) OpenCounts(ctx context.Context, files []daemonctl.OpenFileID) ([]daemonctl.OpenStat, error)
OpenCounts implements daemonctl.OpenCountsProvider for the daemon control socket.
func (*Node) OpendirHandle ¶
func (n *Node) OpendirHandle(ctx context.Context, flags uint32) (fs.FileHandle, uint32, syscall.Errno)
OpendirHandle returns a directory handle that merges entries across read targets.
func (*Node) Readdir ¶
Readdir returns a union of directory entries across read targets, deduped by name.
func (*Node) Removexattr ¶
Removexattr rejects all xattrs on the virtual mount.
func (*Node) Rename ¶
func (n *Node) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, flags uint32) syscall.Errno
Rename renames a child within the same underlying target.
Cross-target renames return EXDEV.
func (*Node) Setattr ¶
func (n *Node) Setattr(ctx context.Context, f fs.FileHandle, in *gofuse.SetAttrIn, out *gofuse.AttrOut) syscall.Errno
Setattr applies attribute changes to the underlying storage.
func (*Node) Statfs ¶
Statfs returns filesystem stats for the mount.
The default loopback Statfs reports stats for the primaryRootPath filesystem, which may differ from where writes actually land. This override resolves write targets via the router so that tools like df and sabnzbd see the correct free space for the filesystem that will receive writes at this path.
func (*Node) WrapChild ¶
func (n *Node) WrapChild(ctx context.Context, ops fs.InodeEmbedder) fs.InodeEmbedder
WrapChild wraps descendant nodes.
type OpenTracker ¶
type OpenTracker struct {
// contains filtered or unexported fields
}
OpenTracker tracks open file handles held by FUSE clients.
It is used by maintenance jobs (e.g. mover) to avoid moving files that are currently open. The key is a stable file identity (storage_id + dev + ino).
This is best-effort and intentionally simple: counts are in-memory only.
func NewOpenTracker ¶
func NewOpenTracker() *OpenTracker
NewOpenTracker constructs a ready-to-use OpenTracker.
func (*OpenTracker) Dec ¶
func (t *OpenTracker) Dec(id daemonctl.OpenFileID, write bool)
Dec decrements the open counters for a file ID.
func (*OpenTracker) Inc ¶
func (t *OpenTracker) Inc(id daemonctl.OpenFileID, write bool)
Inc increments the open counters for a file ID.
func (*OpenTracker) OpenCounts ¶
func (t *OpenTracker) OpenCounts(ctx context.Context, files []daemonctl.OpenFileID) ([]daemonctl.OpenStat, error)
OpenCounts returns open-count snapshots for the given file IDs.