Documentation
¶
Overview ¶
Package fusebridge maps FUSE operations onto the metadata engine and file I/O layer. It handles filesystem requests, cache invalidation and errors.
Index ¶
- func Mount(b *Bridge, mountpoint string, opts *fuse.MountOptions, allowOther bool) (*fuse.Server, error)
- type Bridge
- func (b *Bridge) ApplyChange(ino uint64, op uint8, payload []byte)
- func (b *Bridge) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRangeIn) (uint32, fuse.Status)
- func (b *Bridge) Create(cancel <-chan struct{}, in *fuse.CreateIn, name string, out *fuse.CreateOut) (status fuse.Status)
- func (b *Bridge) Flush(cancel <-chan struct{}, in *fuse.FlushIn) fuse.Status
- func (b *Bridge) Fsync(cancel <-chan struct{}, in *fuse.FsyncIn) (status fuse.Status)
- func (b *Bridge) GetAttr(cancel <-chan struct{}, in *fuse.GetAttrIn, out *fuse.AttrOut) (status fuse.Status)
- func (b *Bridge) GetLk(cancel <-chan struct{}, in *fuse.LkIn, out *fuse.LkOut) fuse.Status
- func (b *Bridge) GetXAttr(cancel <-chan struct{}, h *fuse.InHeader, attr string, dest []byte) (uint32, fuse.Status)
- func (b *Bridge) Init(srv *fuse.Server)
- func (b *Bridge) Link(cancel <-chan struct{}, in *fuse.LinkIn, name string, out *fuse.EntryOut) fuse.Status
- func (b *Bridge) ListXAttr(cancel <-chan struct{}, h *fuse.InHeader, dest []byte) (uint32, fuse.Status)
- func (b *Bridge) Lookup(cancel <-chan struct{}, h *fuse.InHeader, name string, out *fuse.EntryOut) (status fuse.Status)
- func (b *Bridge) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out *fuse.EntryOut) (status fuse.Status)
- func (b *Bridge) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out *fuse.EntryOut) fuse.Status
- func (b *Bridge) Open(cancel <-chan struct{}, in *fuse.OpenIn, out *fuse.OpenOut) (status fuse.Status)
- func (b *Bridge) OpenDir(cancel <-chan struct{}, in *fuse.OpenIn, out *fuse.OpenOut) fuse.Status
- func (b *Bridge) Read(cancel <-chan struct{}, in *fuse.ReadIn, buf []byte) (fuse.ReadResult, fuse.Status)
- func (b *Bridge) ReadDir(cancel <-chan struct{}, in *fuse.ReadIn, out *fuse.DirEntryList) fuse.Status
- func (b *Bridge) ReadDirPlus(cancel <-chan struct{}, in *fuse.ReadIn, out *fuse.DirEntryList) fuse.Status
- func (b *Bridge) Readlink(cancel <-chan struct{}, h *fuse.InHeader) ([]byte, fuse.Status)
- func (b *Bridge) Release(cancel <-chan struct{}, in *fuse.ReleaseIn)
- func (b *Bridge) ReleaseDir(in *fuse.ReleaseIn)
- func (b *Bridge) RemoveXAttr(cancel <-chan struct{}, h *fuse.InHeader, attr string) fuse.Status
- func (b *Bridge) Rename(cancel <-chan struct{}, in *fuse.RenameIn, oldName, newName string) fuse.Status
- func (b *Bridge) Rmdir(cancel <-chan struct{}, h *fuse.InHeader, name string) fuse.Status
- func (b *Bridge) SetAttr(cancel <-chan struct{}, in *fuse.SetAttrIn, out *fuse.AttrOut) fuse.Status
- func (b *Bridge) SetDefaultStoreClass(class uint8)
- func (b *Bridge) SetLk(cancel <-chan struct{}, in *fuse.LkIn) fuse.Status
- func (b *Bridge) SetLkw(cancel <-chan struct{}, in *fuse.LkIn) fuse.Status
- func (b *Bridge) SetMetrics(m *metrics.Registry)
- func (b *Bridge) SetXAttr(cancel <-chan struct{}, in *fuse.SetXAttrIn, attr string, data []byte) fuse.Status
- func (b *Bridge) StatFs(cancel <-chan struct{}, h *fuse.InHeader, out *fuse.StatfsOut) fuse.Status
- func (b *Bridge) Symlink(cancel <-chan struct{}, h *fuse.InHeader, target, name string, ...) fuse.Status
- func (b *Bridge) Unlink(cancel <-chan struct{}, h *fuse.InHeader, name string) (status fuse.Status)
- func (b *Bridge) Write(cancel <-chan struct{}, in *fuse.WriteIn, data []byte) (uint32, fuse.Status)
- type Flusher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mount ¶
func Mount(b *Bridge, mountpoint string, opts *fuse.MountOptions, allowOther bool) (*fuse.Server, error)
Mount starts serving the bridge at mountpoint and returns the running server. The caller unmounts via server.Unmount(). opts may be nil.
allowOther appends the FUSE allow_other option so processes other than the mounting user (uid 0, the daemon) can access the mount. It is REQUIRED whenever non-root workloads use the filesystem — e.g. the CSI subdir-bind-mount model, where pods run as arbitrary uids — because without it the FUSE kernel denies every non-mounter uid with EACCES before default_permissions even evaluates.
Types ¶
type Bridge ¶
type Bridge struct {
fuse.RawFileSystem // ENOSYS defaults for ops we don't implement
// contains filtered or unexported fields
}
Bridge implements fuse.RawFileSystem over a metadata engine + data path.
func (*Bridge) ApplyChange ¶
ApplyChange invalidates the kernel caches affected by a peer's change so the next access on this mount re-reads fresh state from the shared metadata DB. It is best-effort: a not-cached target simply returns ENOENT, which we ignore. ino is the changed inode, op is a meta.Change* code, payload is the raw fs_changelog payload.
func (*Bridge) CopyFileRange ¶
func (b *Bridge) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRangeIn) (uint32, fuse.Status)
CopyFileRange serves copy_file_range(2): it copies a byte range from one file to another. The data path shares the underlying chunks copy-on-write for any chunk-aligned portion (zero data movement, like reflink) and falls back to a read+write copy for misaligned head/tail bytes, so the result is always byte-correct. The kernel may issue this in several calls for a large copy.
func (*Bridge) OpenDir ¶
OpenDir snapshots the directory's ordered entry list (with attributes) into a handle table under a fresh Fh, so ReadDirPlus can page by stable offset even while the directory is concurrently mutated.
func (*Bridge) ReadDir ¶
func (b *Bridge) ReadDir(cancel <-chan struct{}, in *fuse.ReadIn, out *fuse.DirEntryList) fuse.Status
ReadDir pages the OpenDir snapshot without filling attributes (the plain, non-plus variant). Shares the same stable offsets as ReadDirPlus.
func (*Bridge) ReadDirPlus ¶
func (*Bridge) Release ¶
Release drops the open handle; the last close of an unlinked file deletes it. If the kernel flagged a flock unlock for this release, drop the flock too.
func (*Bridge) ReleaseDir ¶
ReleaseDir frees the directory snapshot allocated by OpenDir.
func (*Bridge) RemoveXAttr ¶
func (*Bridge) SetDefaultStoreClass ¶
SetDefaultStoreClass sets the compression class applied to a created file whose type is not recognized as a model/tensor. cmd/mlfs wires it from a flag: a model-store mount passes ClassUncompressed (so even unrecognized files stay uncompressed — range-readable + mmap-safe); a mixed-content mount leaves the default ClassDefault so generic data compresses. Call once before serving.
func (*Bridge) SetLkw ¶
SetLkw is the blocking variant. The engine acquires non-blockingly (EAGAIN on conflict), so we implement true blocking in-process: attempt the acquire, and on EAGAIN park on the bridge's notify channel until some lock release wakes us (or the FUSE cancel channel fires → EINTR), then re-attempt. We grab the wait channel BEFORE each attempt so a release that races between the failed acquire and parking still wakes us. This blocks until the lock becomes grantable rather than giving up under sustained contention.
func (*Bridge) SetMetrics ¶
SetMetrics attaches the daemon's instrument registry; the virtual file renders from it. nil disables nothing structurally — the file still resolves and reads empty — but in practice the daemon always sets it.