vfs

package
v0.0.0-...-b829263 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(cromFile string, mountPoint string, codebookFile string, encryptionKey string, maxMB int) error

Mount mounts a .crom file at the given mountpoint. It blocks until the filesystem is unmounted.

Types

type CromFile

type CromFile struct {
	fs.Inode
	// contains filtered or unexported fields
}

CromFile represents the unpacked file inside the FUSE mount.

func (*CromFile) Flush

func (f *CromFile) Flush(ctx context.Context, fh fs.FileHandle) syscall.Errno

func (*CromFile) Getattr

func (f *CromFile) Getattr(ctx context.Context, fh fs.FileHandle, out *fuse.AttrOut) syscall.Errno

func (*CromFile) Open

func (f *CromFile) Open(ctx context.Context, flags uint32) (fs.FileHandle, uint32, syscall.Errno)

func (*CromFile) Read

func (f *CromFile) Read(ctx context.Context, fh fs.FileHandle, dest []byte, off int64) (fuse.ReadResult, syscall.Errno)

func (*CromFile) Write

func (f *CromFile) Write(ctx context.Context, fh fs.FileHandle, data []byte, off int64) (uint32, syscall.Errno)

type CromRoot

type CromRoot struct {
	fs.Inode
	// contains filtered or unexported fields
}

func (*CromRoot) OnAdd

func (r *CromRoot) OnAdd(ctx context.Context)

type MemoryCache

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

MemoryCache implements a Byte-Aware LRU Cache (SRE Limits).

func NewMemoryCache

func NewMemoryCache(maxMB int) *MemoryCache

NewMemoryCache creates a new unified LRU Cache limited strictly by Megabytes.

func (*MemoryCache) Get

func (c *MemoryCache) Get(key interface{}) ([]byte, bool)

Get fetches the data if it is cached.

func (*MemoryCache) Put

func (c *MemoryCache) Put(key interface{}, data []byte)

Put saves data to the cache, evicting oldest until it fits within maxBytes.

type RandomReader

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

RandomReader provides an io.ReaderAt interface over a .crom file.

func NewRandomReader

func NewRandomReader(f io.ReaderAt, fileSize int64, header *format.Header, blockTable []uint32, entries []format.ChunkEntry, cb *codebook.Reader, encryptionKey string, maxMB int) (*RandomReader, error)

NewRandomReader opens a .crom file for random access. File must be kept open by the caller. We expect exactly the data from format.Reader.Read(), minus the compDeltaPool, but because we want stream reading of the pool, we compute offsets here.

func (*RandomReader) ReadAt

func (rr *RandomReader) ReadAt(dest []byte, off int64) (int, error)

ReadAt satisfies io.ReaderAt, allowing FUSE to read specific byte ranges O(1).

type SovereigntyWatcher

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

SovereigntyWatcher monitors critical system conditions and triggers automatic unmount of the FUSE filesystem when sovereignty is compromised.

Triggers:

  1. Codebook file is deleted or becomes inaccessible (polling every 1s)
  2. OS signals (SIGINT, SIGTERM) for graceful shutdown
  3. Manual stop via the stopCh channel (e.g., key invalidation)

func NewSovereigntyWatcher

func NewSovereigntyWatcher(server *fuse.Server, codebookPath string, mountPoint string) *SovereigntyWatcher

NewSovereigntyWatcher creates a new watcher bound to a FUSE server instance.

func (*SovereigntyWatcher) Start

func (w *SovereigntyWatcher) Start()

Start begins monitoring in the background. It returns immediately. The watcher will unmount and print a reason when triggered.

func (*SovereigntyWatcher) Stop

func (w *SovereigntyWatcher) Stop()

Stop triggers manual unmount (e.g., when encryption key is wiped from memory).

type TreeInode

type TreeInode struct {
	fs.Inode
	// contains filtered or unexported fields
}

TreeInode implementa navegação POSIX de grafos usando o SQLite Inodes do CromDB.

func (*TreeInode) Getattr

func (n *TreeInode) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) syscall.Errno

func (*TreeInode) Lookup

func (n *TreeInode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

func (*TreeInode) Open

func (n *TreeInode) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno)

func (*TreeInode) Read

func (n *TreeInode) Read(ctx context.Context, fh fs.FileHandle, dest []byte, off int64) (fuse.ReadResult, syscall.Errno)

func (*TreeInode) Readdir

func (n *TreeInode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno)

func (*TreeInode) Write

func (n *TreeInode) Write(ctx context.Context, fh fs.FileHandle, data []byte, off int64) (uint32, syscall.Errno)

type WriteAheadLog

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

WriteAheadLog manages memory buffering for FUSE writes, preventing the .crom file from being hammered with appending patches byte-by-byte (which would ruin compression).

func NewWriteAheadLog

func NewWriteAheadLog(cromFilePath string) *WriteAheadLog

NewWriteAheadLog creates a new WAL that flushes automatically after quiet periods.

func (*WriteAheadLog) Append

func (wal *WriteAheadLog) Append(data []byte, offset int64) error

Append stages a write operation to memory.

func (*WriteAheadLog) Close

func (wal *WriteAheadLog) Close()

Close forces a final flush and stops the background worker.

Jump to

Keyboard shortcuts

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