pub struct SqliteFileSystem { /* private fields */ }Expand description
A persistent, multi-workspace filesystem backed by a single SQLite database.
One database may contain many isolated workspaces; every stored query is scoped to a workspace so no operation observes another workspace’s nodes.
Implementations§
Source§impl SqliteFileSystem
impl SqliteFileSystem
Sourcepub async fn open(
path: impl AsRef<Path>,
options: ConnectOptions,
) -> FsResult<Self>
pub async fn open( path: impl AsRef<Path>, options: ConnectOptions, ) -> FsResult<Self>
Opens (creating if absent) a file-backed SQLite database.
Sourcepub async fn open_in_memory(options: ConnectOptions) -> FsResult<Self>
pub async fn open_in_memory(options: ConnectOptions) -> FsResult<Self>
Opens a private, in-memory SQLite database.
Sourcepub async fn create_workspace(
&self,
options: WorkspaceOptions,
) -> FsResult<Workspace>
pub async fn create_workspace( &self, options: WorkspaceOptions, ) -> FsResult<Workspace>
Creates a new isolated workspace with its root directory.
Sourcepub async fn delete_workspace(&self, workspace_id: WorkspaceId) -> FsResult<()>
pub async fn delete_workspace(&self, workspace_id: WorkspaceId) -> FsResult<()>
Permanently deletes a workspace and everything it contains.
Sourcepub async fn workspace_usage(
&self,
ctx: &RequestContext,
) -> FsResult<WorkspaceUsage>
pub async fn workspace_usage( &self, ctx: &RequestContext, ) -> FsResult<WorkspaceUsage>
Returns logical and quota usage for the context’s workspace.
Sourcepub async fn stat(
&self,
ctx: &RequestContext,
path: &VirtualPath,
options: StatOptions,
) -> FsResult<Node>
pub async fn stat( &self, ctx: &RequestContext, path: &VirtualPath, options: StatOptions, ) -> FsResult<Node>
Returns metadata for a path.
Sourcepub async fn exists(
&self,
ctx: &RequestContext,
path: &VirtualPath,
options: StatOptions,
) -> FsResult<bool>
pub async fn exists( &self, ctx: &RequestContext, path: &VirtualPath, options: StatOptions, ) -> FsResult<bool>
Returns whether a path resolves to a visible node.
Sourcepub async fn read_dir(
&self,
ctx: &RequestContext,
path: &VirtualPath,
page: PageRequest,
) -> FsResult<Page<Node>>
pub async fn read_dir( &self, ctx: &RequestContext, path: &VirtualPath, page: PageRequest, ) -> FsResult<Page<Node>>
Returns one cursor-paginated page of direct directory children.
Sourcepub async fn tree(
&self,
ctx: &RequestContext,
path: &VirtualPath,
options: TreeOptions,
page: PageRequest,
) -> FsResult<Page<TreeEntry>>
pub async fn tree( &self, ctx: &RequestContext, path: &VirtualPath, options: TreeOptions, page: PageRequest, ) -> FsResult<Page<TreeEntry>>
Returns one cursor-paginated page of a recursive tree traversal.
Sourcepub async fn mkdir(
&self,
ctx: &RequestContext,
path: &VirtualPath,
options: CreateOptions,
) -> FsResult<Node>
pub async fn mkdir( &self, ctx: &RequestContext, path: &VirtualPath, options: CreateOptions, ) -> FsResult<Node>
Creates a directory.
Sourcepub async fn read(
&self,
ctx: &RequestContext,
path: &VirtualPath,
options: ReadOptions,
) -> FsResult<FileRead>
pub async fn read( &self, ctx: &RequestContext, path: &VirtualPath, options: ReadOptions, ) -> FsResult<FileRead>
Opens a bounded-memory byte stream for a regular file.
Sourcepub async fn write(
&self,
ctx: &RequestContext,
path: &VirtualPath,
source: WriteSource,
options: WriteOptions,
) -> FsResult<Node>
pub async fn write( &self, ctx: &RequestContext, path: &VirtualPath, source: WriteSource, options: WriteOptions, ) -> FsResult<Node>
Atomically creates or replaces a regular file from a byte stream.
Sourcepub async fn write_at(
&self,
ctx: &RequestContext,
path: &VirtualPath,
offset: u64,
source: WriteSource,
options: WriteOptions,
) -> FsResult<Node>
pub async fn write_at( &self, ctx: &RequestContext, path: &VirtualPath, offset: u64, source: WriteSource, options: WriteOptions, ) -> FsResult<Node>
Atomically writes streamed bytes beginning at a logical offset.
Sourcepub async fn append(
&self,
ctx: &RequestContext,
path: &VirtualPath,
source: WriteSource,
options: WriteOptions,
) -> FsResult<Node>
pub async fn append( &self, ctx: &RequestContext, path: &VirtualPath, source: WriteSource, options: WriteOptions, ) -> FsResult<Node>
Atomically appends streamed bytes to a regular file.
Sourcepub async fn truncate(
&self,
ctx: &RequestContext,
path: &VirtualPath,
length: u64,
options: MutationOptions,
) -> FsResult<Node>
pub async fn truncate( &self, ctx: &RequestContext, path: &VirtualPath, length: u64, options: MutationOptions, ) -> FsResult<Node>
Changes a regular file’s logical length.
Sourcepub async fn touch(
&self,
ctx: &RequestContext,
path: &VirtualPath,
options: TouchOptions,
) -> FsResult<Node>
pub async fn touch( &self, ctx: &RequestContext, path: &VirtualPath, options: TouchOptions, ) -> FsResult<Node>
Updates timestamps or creates an empty regular file.
Sourcepub async fn copy(
&self,
ctx: &RequestContext,
from: &VirtualPath,
to: &VirtualPath,
options: CopyOptions,
) -> FsResult<Node>
pub async fn copy( &self, ctx: &RequestContext, from: &VirtualPath, to: &VirtualPath, options: CopyOptions, ) -> FsResult<Node>
Copies a node within the context’s workspace.
Sourcepub async fn move_path(
&self,
ctx: &RequestContext,
from: &VirtualPath,
to: &VirtualPath,
options: MoveOptions,
) -> FsResult<Node>
pub async fn move_path( &self, ctx: &RequestContext, from: &VirtualPath, to: &VirtualPath, options: MoveOptions, ) -> FsResult<Node>
Moves a node within the context’s workspace.
Sourcepub async fn remove(
&self,
ctx: &RequestContext,
path: &VirtualPath,
options: RemoveOptions,
) -> FsResult<()>
pub async fn remove( &self, ctx: &RequestContext, path: &VirtualPath, options: RemoveOptions, ) -> FsResult<()>
Permanently removes a node.
Sourcepub async fn symlink(
&self,
ctx: &RequestContext,
target: &LinkTarget,
link: &VirtualPath,
options: CreateOptions,
) -> FsResult<Node>
pub async fn symlink( &self, ctx: &RequestContext, target: &LinkTarget, link: &VirtualPath, options: CreateOptions, ) -> FsResult<Node>
Creates a symbolic link containing a relative or absolute virtual target.
Sourcepub async fn read_link(
&self,
ctx: &RequestContext,
path: &VirtualPath,
) -> FsResult<LinkTarget>
pub async fn read_link( &self, ctx: &RequestContext, path: &VirtualPath, ) -> FsResult<LinkTarget>
Returns the stored target of a symbolic link without resolving it.
Sourcepub async fn trash(
&self,
ctx: &RequestContext,
path: &VirtualPath,
options: MutationOptions,
) -> FsResult<TrashEntry>
pub async fn trash( &self, ctx: &RequestContext, path: &VirtualPath, options: MutationOptions, ) -> FsResult<TrashEntry>
Moves a node into recoverable trash.
Sourcepub async fn list_trash(
&self,
ctx: &RequestContext,
page: PageRequest,
) -> FsResult<Page<TrashEntry>>
pub async fn list_trash( &self, ctx: &RequestContext, page: PageRequest, ) -> FsResult<Page<TrashEntry>>
Returns one cursor-paginated page of recoverable trash records.
Sourcepub async fn restore(
&self,
ctx: &RequestContext,
trash_id: TrashId,
destination: Option<&VirtualPath>,
options: MutationOptions,
) -> FsResult<Node>
pub async fn restore( &self, ctx: &RequestContext, trash_id: TrashId, destination: Option<&VirtualPath>, options: MutationOptions, ) -> FsResult<Node>
Restores a recoverable trash record.
Sourcepub async fn purge(
&self,
ctx: &RequestContext,
trash_id: TrashId,
) -> FsResult<()>
pub async fn purge( &self, ctx: &RequestContext, trash_id: TrashId, ) -> FsResult<()>
Permanently purges a recoverable trash record.
Sourcepub async fn set_attribute(
&self,
ctx: &RequestContext,
path: &VirtualPath,
key: &str,
value: &[u8],
options: MutationOptions,
) -> FsResult<Node>
pub async fn set_attribute( &self, ctx: &RequestContext, path: &VirtualPath, key: &str, value: &[u8], options: MutationOptions, ) -> FsResult<Node>
Sets an opaque custom attribute on a node.
Sourcepub async fn remove_attribute(
&self,
ctx: &RequestContext,
path: &VirtualPath,
key: &str,
options: MutationOptions,
) -> FsResult<Node>
pub async fn remove_attribute( &self, ctx: &RequestContext, path: &VirtualPath, key: &str, options: MutationOptions, ) -> FsResult<Node>
Removes a custom attribute from a node.
Sourcepub async fn batch(
&self,
ctx: &RequestContext,
operations: Vec<BatchOperation>,
) -> FsResult<Vec<BatchResult>>
pub async fn batch( &self, ctx: &RequestContext, operations: Vec<BatchOperation>, ) -> FsResult<Vec<BatchResult>>
Executes non-streaming operations atomically in request order.
Sourcepub async fn glob(
&self,
ctx: &RequestContext,
pattern: &str,
page: PageRequest,
) -> FsResult<Page<Node>>
pub async fn glob( &self, ctx: &RequestContext, pattern: &str, page: PageRequest, ) -> FsResult<Page<Node>>
Returns nodes whose absolute paths match a virtual-path glob.
Sourcepub async fn find(
&self,
ctx: &RequestContext,
query: FindQuery,
page: PageRequest,
) -> FsResult<Page<Node>>
pub async fn find( &self, ctx: &RequestContext, query: FindQuery, page: PageRequest, ) -> FsResult<Page<Node>>
Returns nodes matching bounded metadata predicates.
Sourcepub async fn search_content(
&self,
ctx: &RequestContext,
query: ContentQuery,
page: PageRequest,
) -> FsResult<Page<SearchMatch>>
pub async fn search_content( &self, ctx: &RequestContext, query: ContentQuery, page: PageRequest, ) -> FsResult<Page<SearchMatch>>
Returns bounded literal byte matches from regular files.
Sourcepub async fn changes(
&self,
ctx: &RequestContext,
after: Option<ChangeCursor>,
page: PageRequest,
) -> FsResult<Page<Change>>
pub async fn changes( &self, ctx: &RequestContext, after: Option<ChangeCursor>, page: PageRequest, ) -> FsResult<Page<Change>>
Returns committed changes after an optional opaque cursor.