pub struct RagFs {
source: PathBuf,
inodes: Arc<RwLock<InodeTable>>,
store: Option<Arc<dyn VectorStore>>,
query_executor: Option<Arc<QueryExecutor>>,
runtime: Handle,
content_cache: Arc<RwLock<HashMap<u64, Vec<u8>>>>,
reindex_sender: Option<Sender<PathBuf>>,
ops_manager: Arc<OpsManager>,
safety_manager: Arc<SafetyManager>,
semantic_manager: Arc<SemanticManager>,
}Expand description
RAGFS FUSE filesystem.
Fields§
§source: PathBufSource directory being indexed
inodes: Arc<RwLock<InodeTable>>Inode table
store: Option<Arc<dyn VectorStore>>Vector store for queries and stats
query_executor: Option<Arc<QueryExecutor>>Query executor
runtime: HandleTokio runtime handle for async operations
content_cache: Arc<RwLock<HashMap<u64, Vec<u8>>>>Cache for virtual file contents (query results, index status)
reindex_sender: Option<Sender<PathBuf>>Channel sender for reindex requests
ops_manager: Arc<OpsManager>Operations manager for agent file management
safety_manager: Arc<SafetyManager>Safety manager for trash/history/undo
semantic_manager: Arc<SemanticManager>Semantic manager for intelligent operations
Implementations§
Source§impl RagFs
impl RagFs
pub(crate) fn lookup_ops_dir(&self, name_str: &str, reply: ReplyEntry)
pub(crate) fn getattr_ops(&self, ino: u64, reply: ReplyAttr)
pub(crate) fn read_ops( &self, ino: u64, offset: u64, size: u32, reply: ReplyData, )
pub(crate) fn readdir_ops(&self, offset: u64, reply: ReplyDirectory)
pub(crate) fn write_ops(&self, ino: u64, data: &[u8], reply: ReplyWrite)
Source§impl RagFs
impl RagFs
pub(crate) fn lookup_root(&self, name_str: &str, reply: ReplyEntry)
pub(crate) fn lookup_passthrough( &self, parent: u64, name_str: &str, reply: ReplyEntry, )
pub(crate) fn getattr_cached_or_passthrough(&self, ino: u64, reply: ReplyAttr)
pub(crate) fn read_passthrough( &self, ino: u64, offset: u64, size: u32, reply: ReplyData, )
pub(crate) fn readdir_root(&self, offset: u64, reply: ReplyDirectory)
pub(crate) fn readdir_passthrough( &self, ino: u64, offset: u64, reply: ReplyDirectory, )
pub(crate) fn write_passthrough(&self, ino: u64, data: &[u8], reply: ReplyWrite)
pub(crate) fn create_passthrough( &self, parent: u64, name: &OsStr, mode: u32, _umask: u32, flags: i32, reply: ReplyCreate, )
pub(crate) fn unlink_passthrough( &self, parent: u64, name: &OsStr, reply: ReplyEmpty, )
pub(crate) fn mkdir_passthrough( &self, parent: u64, name: &OsStr, mode: u32, _umask: u32, reply: ReplyEntry, )
pub(crate) fn rmdir_passthrough( &self, parent: u64, name: &OsStr, reply: ReplyEmpty, )
pub(crate) fn rename_passthrough( &self, parent: u64, name: &OsStr, newparent: u64, newname: &OsStr, _flags: RenameFlags, reply: ReplyEmpty, )
pub(crate) fn setattr_passthrough( &self, ino: u64, _mode: Option<u32>, _uid: Option<u32>, _gid: Option<u32>, size: Option<u64>, _atime: Option<TimeOrNow>, _mtime: Option<TimeOrNow>, _ctime: Option<SystemTime>, _fh: Option<FileHandle>, _crtime: Option<SystemTime>, _chgtime: Option<SystemTime>, _bkuptime: Option<SystemTime>, _flags: Option<BsdFileFlags>, reply: ReplyAttr, )
Source§impl RagFs
impl RagFs
pub(crate) fn lookup_ragfs_dir(&self, name_str: &str, reply: ReplyEntry)
pub(crate) fn lookup_query_dir(&self, name_str: &str, reply: ReplyEntry)
pub(crate) fn getattr_query(&self, ino: u64, reply: ReplyAttr)
pub(crate) fn read_query( &self, ino: u64, offset: u64, size: u32, reply: ReplyData, )
pub(crate) fn readdir_ragfs(&self, offset: u64, reply: ReplyDirectory)
pub(crate) fn readdir_query(&self, ino: u64, offset: u64, reply: ReplyDirectory)
pub(crate) fn write_reindex(&self, data: &[u8], reply: ReplyWrite)
Source§impl RagFs
impl RagFs
pub(crate) fn lookup_safety_dir(&self, name_str: &str, reply: ReplyEntry)
pub(crate) fn getattr_safety(&self, ino: u64, reply: ReplyAttr)
pub(crate) fn read_safety( &self, ino: u64, offset: u64, size: u32, reply: ReplyData, )
pub(crate) fn readdir_safety( &self, ino: u64, offset: u64, reply: ReplyDirectory, )
pub(crate) fn write_safety(&self, _ino: u64, data: &[u8], reply: ReplyWrite)
Source§impl RagFs
impl RagFs
pub(crate) fn lookup_semantic_dir(&self, name_str: &str, reply: ReplyEntry)
pub(crate) fn lookup_pending_dir(&self, name_str: &str, reply: ReplyEntry)
pub(crate) fn getattr_semantic(&self, ino: u64, reply: ReplyAttr)
pub(crate) fn read_semantic( &self, ino: u64, offset: u64, size: u32, reply: ReplyData, )
pub(crate) fn readdir_semantic( &self, ino: u64, offset: u64, reply: ReplyDirectory, )
pub(crate) fn write_semantic(&self, ino: u64, data: &[u8], reply: ReplyWrite)
Source§impl RagFs
impl RagFs
Sourcepub fn new(source: PathBuf) -> Self
pub fn new(source: PathBuf) -> Self
Create a new RAGFS filesystem (basic, for passthrough only).
Sourcepub fn with_rag(
source: PathBuf,
store: Arc<dyn VectorStore>,
embedder: Arc<dyn Embedder>,
runtime: Handle,
reindex_sender: Option<Sender<PathBuf>>,
) -> Self
pub fn with_rag( source: PathBuf, store: Arc<dyn VectorStore>, embedder: Arc<dyn Embedder>, runtime: Handle, reindex_sender: Option<Sender<PathBuf>>, ) -> Self
Create a new RAGFS filesystem with full RAG capabilities.
Hybrid search defaults to on (same as [query].hybrid in config.toml).
Sourcepub fn with_rag_query(
source: PathBuf,
store: Arc<dyn VectorStore>,
embedder: Arc<dyn Embedder>,
runtime: Handle,
reindex_sender: Option<Sender<PathBuf>>,
default_limit: usize,
hybrid: bool,
max_limit: usize,
) -> Self
pub fn with_rag_query( source: PathBuf, store: Arc<dyn VectorStore>, embedder: Arc<dyn Embedder>, runtime: Handle, reindex_sender: Option<Sender<PathBuf>>, default_limit: usize, hybrid: bool, max_limit: usize, ) -> Self
Create a RAG-enabled filesystem with query settings from config / CLI.
Sourcefn jail_reindex_path(&self, path: &Path) -> Result<PathBuf, String>
fn jail_reindex_path(&self, path: &Path) -> Result<PathBuf, String>
Resolve a .reindex path and reject anything that escapes the source root.
Sourcefn real_path_to_attr(&self, path: &PathBuf, ino: u64) -> Option<FileAttr>
fn real_path_to_attr(&self, path: &PathBuf, ino: u64) -> Option<FileAttr>
Convert a real path to a FUSE inode.
fn make_attr(&self, ino: u64, kind: FileType, size: u64) -> FileAttr
Sourcefn get_index_status(&self) -> Vec<u8> ⓘ
fn get_index_status(&self) -> Vec<u8> ⓘ
Get index status as JSON.
Sourcepub(crate) fn execute_query(&self, query: &str) -> Vec<u8> ⓘ
pub(crate) fn execute_query(&self, query: &str) -> Vec<u8> ⓘ
Execute a query and return results as JSON.
Sourcefn get_config(&self) -> Vec<u8> ⓘ
fn get_config(&self) -> Vec<u8> ⓘ
Get configuration as JSON.
This is mount wiring, not ~/.config/ragfs/config.toml.
Sourcefn resolve_parent_path(&self, parent: u64) -> Option<PathBuf>
fn resolve_parent_path(&self, parent: u64) -> Option<PathBuf>
Resolve a parent inode to a real path. Returns None if the parent doesn’t exist or is not a directory.
Sourcefn get_help_content(&self) -> Vec<u8> ⓘ
fn get_help_content(&self) -> Vec<u8> ⓘ
Get help content for the virtual control directory.
Trait Implementations§
Source§impl Filesystem for RagFs
impl Filesystem for RagFs
Source§fn init(&mut self, _req: &Request, _config: &mut KernelConfig) -> Result<()>
fn init(&mut self, _req: &Request, _config: &mut KernelConfig) -> Result<()>
KernelConfig objectSource§fn lookup(
&self,
_req: &Request,
parent: INodeNo,
name: &OsStr,
reply: ReplyEntry,
)
fn lookup( &self, _req: &Request, parent: INodeNo, name: &OsStr, reply: ReplyEntry, )
Source§fn getattr(
&self,
_req: &Request,
ino: INodeNo,
_fh: Option<FileHandle>,
reply: ReplyAttr,
)
fn getattr( &self, _req: &Request, ino: INodeNo, _fh: Option<FileHandle>, reply: ReplyAttr, )
Source§fn read(
&self,
_req: &Request,
ino: INodeNo,
_fh: FileHandle,
offset: u64,
size: u32,
_flags: OpenFlags,
_lock_owner: Option<LockOwner>,
reply: ReplyData,
)
fn read( &self, _req: &Request, ino: INodeNo, _fh: FileHandle, offset: u64, size: u32, _flags: OpenFlags, _lock_owner: Option<LockOwner>, reply: ReplyData, )
direct_io mode, in which case the
return value of the read system call will reflect the return value of this
operation. fh will contain the value set by the open method, or will be undefined
if the open method didn’t set any value. Read moreSource§fn readdir(
&self,
_req: &Request,
ino: INodeNo,
_fh: FileHandle,
offset: u64,
reply: ReplyDirectory,
)
fn readdir( &self, _req: &Request, ino: INodeNo, _fh: FileHandle, offset: u64, reply: ReplyDirectory, )
buffer.fill(), with size not exceeding the
requested size. Send an empty buffer on end of stream. fh will contain the
value set by the opendir method, or will be undefined if the opendir method
didn’t set any value.Source§fn open(&self, _req: &Request, ino: INodeNo, flags: OpenFlags, reply: ReplyOpen)
fn open(&self, _req: &Request, ino: INodeNo, flags: OpenFlags, reply: ReplyOpen)
O_CREAT, O_EXCL, O_NOCTTY and O_TRUNC) are
available in flags. Filesystem may store an arbitrary file handle (pointer, index,
etc) in fh, and use this in other all other file operations (read, write, flush,
release, fsync). Filesystem may also implement stateless file I/O and not store
anything in fh. There are also some flags (direct_io, keep_cache) which the
filesystem may set, to change the way the file is opened. See fuse_file_info
structure in <fuse_common.h> for more details.Source§fn opendir(
&self,
_req: &Request,
ino: INodeNo,
flags: OpenFlags,
reply: ReplyOpen,
)
fn opendir( &self, _req: &Request, ino: INodeNo, flags: OpenFlags, reply: ReplyOpen, )
Source§fn write(
&self,
_req: &Request,
ino: INodeNo,
_fh: FileHandle,
_offset: u64,
data: &[u8],
_write_flags: WriteFlags,
_flags: OpenFlags,
_lock_owner: Option<LockOwner>,
reply: ReplyWrite,
)
fn write( &self, _req: &Request, ino: INodeNo, _fh: FileHandle, _offset: u64, data: &[u8], _write_flags: WriteFlags, _flags: OpenFlags, _lock_owner: Option<LockOwner>, reply: ReplyWrite, )
direct_io mode, in
which case the return value of the write system call will reflect the return
value of this operation. fh will contain the value set by the open method, or
will be undefined if the open method didn’t set any value. Read moreSource§fn forget(&self, _req: &Request, ino: INodeNo, nlookup: u64)
fn forget(&self, _req: &Request, ino: INodeNo, nlookup: u64)
Source§fn create(
&self,
_req: &Request,
parent: INodeNo,
name: &OsStr,
mode: u32,
umask: u32,
flags: i32,
reply: ReplyCreate,
)
fn create( &self, _req: &Request, parent: INodeNo, name: &OsStr, mode: u32, umask: u32, flags: i32, reply: ReplyCreate, )
O_NOCTTY.
The filesystem can store any type of file handle (such as a pointer or index)
in fh, which can then be used across all subsequent file operations including
read, write, flush, release, and fsync. Additionally, the filesystem may set
certain flags like direct_io and keep_cache to change the way the file is
opened. See fuse_file_info structure in <fuse_common.h> for more details. If
this method is not implemented or under Linux kernel versions earlier than
2.6.15, the mknod() and open() methods will be called instead.Source§fn unlink(
&self,
_req: &Request,
parent: INodeNo,
name: &OsStr,
reply: ReplyEmpty,
)
fn unlink( &self, _req: &Request, parent: INodeNo, name: &OsStr, reply: ReplyEmpty, )
Source§fn mkdir(
&self,
_req: &Request,
parent: INodeNo,
name: &OsStr,
mode: u32,
umask: u32,
reply: ReplyEntry,
)
fn mkdir( &self, _req: &Request, parent: INodeNo, name: &OsStr, mode: u32, umask: u32, reply: ReplyEntry, )
Source§fn rmdir(
&self,
_req: &Request,
parent: INodeNo,
name: &OsStr,
reply: ReplyEmpty,
)
fn rmdir( &self, _req: &Request, parent: INodeNo, name: &OsStr, reply: ReplyEmpty, )
Source§fn rename(
&self,
_req: &Request,
parent: INodeNo,
name: &OsStr,
newparent: INodeNo,
newname: &OsStr,
flags: RenameFlags,
reply: ReplyEmpty,
)
fn rename( &self, _req: &Request, parent: INodeNo, name: &OsStr, newparent: INodeNo, newname: &OsStr, flags: RenameFlags, reply: ReplyEmpty, )
Source§fn setattr(
&self,
_req: &Request,
ino: INodeNo,
mode: Option<u32>,
uid: Option<u32>,
gid: Option<u32>,
size: Option<u64>,
atime: Option<TimeOrNow>,
mtime: Option<TimeOrNow>,
ctime: Option<SystemTime>,
fh: Option<FileHandle>,
crtime: Option<SystemTime>,
chgtime: Option<SystemTime>,
bkuptime: Option<SystemTime>,
flags: Option<BsdFileFlags>,
reply: ReplyAttr,
)
fn setattr( &self, _req: &Request, ino: INodeNo, mode: Option<u32>, uid: Option<u32>, gid: Option<u32>, size: Option<u64>, atime: Option<TimeOrNow>, mtime: Option<TimeOrNow>, ctime: Option<SystemTime>, fh: Option<FileHandle>, crtime: Option<SystemTime>, chgtime: Option<SystemTime>, bkuptime: Option<SystemTime>, flags: Option<BsdFileFlags>, reply: ReplyAttr, )
§fn batch_forget(&self, req: &Request, nodes: &[ForgetOne])
fn batch_forget(&self, req: &Request, nodes: &[ForgetOne])
forget, but take multiple forget requests at once for performance. The default
implementation will fallback to forget.§fn mknod(
&self,
_req: &Request,
parent: INodeNo,
name: &OsStr,
mode: u32,
umask: u32,
rdev: u32,
reply: ReplyEntry,
)
fn mknod( &self, _req: &Request, parent: INodeNo, name: &OsStr, mode: u32, umask: u32, rdev: u32, reply: ReplyEntry, )
§fn symlink(
&self,
_req: &Request,
parent: INodeNo,
link_name: &OsStr,
target: &Path,
reply: ReplyEntry,
)
fn symlink( &self, _req: &Request, parent: INodeNo, link_name: &OsStr, target: &Path, reply: ReplyEntry, )
§fn link(
&self,
_req: &Request,
ino: INodeNo,
newparent: INodeNo,
newname: &OsStr,
reply: ReplyEntry,
)
fn link( &self, _req: &Request, ino: INodeNo, newparent: INodeNo, newname: &OsStr, reply: ReplyEntry, )
§fn flush(
&self,
_req: &Request,
ino: INodeNo,
fh: FileHandle,
lock_owner: LockOwner,
reply: ReplyEmpty,
)
fn flush( &self, _req: &Request, ino: INodeNo, fh: FileHandle, lock_owner: LockOwner, reply: ReplyEmpty, )
close() of the opened file. Since file descriptors can
be duplicated (dup, dup2, fork), for one open call there may be many flush
calls. Filesystems shouldn’t assume that flush will always be called after some
writes, or that if will be called at all. fh will contain the value set by the
open method, or will be undefined if the open method didn’t set any value.
NOTE: the name of the method is misleading, since (unlike fsync) the filesystem
is not forced to flush pending writes. One reason to flush data, is if the
filesystem wants to return write errors. If the filesystem supports file locking
operations (setlk, getlk) it should remove all locks belonging to lock_owner.§fn release(
&self,
_req: &Request,
_ino: INodeNo,
_fh: FileHandle,
_flags: OpenFlags,
_lock_owner: Option<LockOwner>,
_flush: bool,
reply: ReplyEmpty,
)
fn release( &self, _req: &Request, _ino: INodeNo, _fh: FileHandle, _flags: OpenFlags, _lock_owner: Option<LockOwner>, _flush: bool, reply: ReplyEmpty, )
close() or munmap() which triggered
the release. fh will contain the value set by the open method, or will be undefined
if the open method didn’t set any value. flags will contain the same flags as for
open.§fn fsync(
&self,
_req: &Request,
ino: INodeNo,
fh: FileHandle,
datasync: bool,
reply: ReplyEmpty,
)
fn fsync( &self, _req: &Request, ino: INodeNo, fh: FileHandle, datasync: bool, reply: ReplyEmpty, )
§fn readdirplus(
&self,
_req: &Request,
ino: INodeNo,
fh: FileHandle,
offset: u64,
reply: ReplyDirectoryPlus,
)
fn readdirplus( &self, _req: &Request, ino: INodeNo, fh: FileHandle, offset: u64, reply: ReplyDirectoryPlus, )
buffer.fill(), with size not exceeding the
requested size. Send an empty buffer on end of stream. fh will contain the
value set by the opendir method, or will be undefined if the opendir method
didn’t set any value.§fn releasedir(
&self,
_req: &Request,
_ino: INodeNo,
_fh: FileHandle,
_flags: OpenFlags,
reply: ReplyEmpty,
)
fn releasedir( &self, _req: &Request, _ino: INodeNo, _fh: FileHandle, _flags: OpenFlags, reply: ReplyEmpty, )
§fn fsyncdir(
&self,
_req: &Request,
ino: INodeNo,
fh: FileHandle,
datasync: bool,
reply: ReplyEmpty,
)
fn fsyncdir( &self, _req: &Request, ino: INodeNo, fh: FileHandle, datasync: bool, reply: ReplyEmpty, )
§fn setxattr(
&self,
_req: &Request,
ino: INodeNo,
name: &OsStr,
_value: &[u8],
flags: i32,
position: u32,
reply: ReplyEmpty,
)
fn setxattr( &self, _req: &Request, ino: INodeNo, name: &OsStr, _value: &[u8], flags: i32, position: u32, reply: ReplyEmpty, )
§fn getxattr(
&self,
_req: &Request,
ino: INodeNo,
name: &OsStr,
size: u32,
reply: ReplyXattr,
)
fn getxattr( &self, _req: &Request, ino: INodeNo, name: &OsStr, size: u32, reply: ReplyXattr, )
size is 0, the size of the value should be sent with reply.size().
If size is not 0, and the value fits, send it with reply.data(), or
reply.error(ERANGE) if it doesn’t.§fn listxattr(&self, _req: &Request, ino: INodeNo, size: u32, reply: ReplyXattr)
fn listxattr(&self, _req: &Request, ino: INodeNo, size: u32, reply: ReplyXattr)
size is 0, the size of the value should be sent with reply.size().
If size is not 0, and the value fits, send it with reply.data(), or
reply.error(ERANGE) if it doesn’t.§fn removexattr(
&self,
_req: &Request,
ino: INodeNo,
name: &OsStr,
reply: ReplyEmpty,
)
fn removexattr( &self, _req: &Request, ino: INodeNo, name: &OsStr, reply: ReplyEmpty, )
§fn access(
&self,
_req: &Request,
ino: INodeNo,
mask: AccessFlags,
reply: ReplyEmpty,
)
fn access( &self, _req: &Request, ino: INodeNo, mask: AccessFlags, reply: ReplyEmpty, )
access() system call. If the default_permissions
mount option is given, this method is not called. This method is not called
under Linux kernel versions 2.4.x§fn getlk(
&self,
_req: &Request,
ino: INodeNo,
fh: FileHandle,
lock_owner: LockOwner,
start: u64,
end: u64,
typ: i32,
pid: u32,
reply: ReplyLock,
)
fn getlk( &self, _req: &Request, ino: INodeNo, fh: FileHandle, lock_owner: LockOwner, start: u64, end: u64, typ: i32, pid: u32, reply: ReplyLock, )
§fn setlk(
&self,
_req: &Request,
ino: INodeNo,
fh: FileHandle,
lock_owner: LockOwner,
start: u64,
end: u64,
typ: i32,
pid: u32,
sleep: bool,
reply: ReplyEmpty,
)
fn setlk( &self, _req: &Request, ino: INodeNo, fh: FileHandle, lock_owner: LockOwner, start: u64, end: u64, typ: i32, pid: u32, sleep: bool, reply: ReplyEmpty, )
l_pid field in ‘struct flock’ should only be
used to fill in this field in getlk(). Note: if the locking methods are not
implemented, the kernel will still allow file locking to work locally.
Hence these are only interesting for network filesystems and similar.