Skip to main content

SqliteFileSystem

Struct SqliteFileSystem 

Source
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

Source

pub async fn open( path: impl AsRef<Path>, options: ConnectOptions, ) -> FsResult<Self>

Opens (creating if absent) a file-backed SQLite database.

Source

pub async fn open_in_memory(options: ConnectOptions) -> FsResult<Self>

Opens a private, in-memory SQLite database.

Source

pub async fn create_workspace( &self, options: WorkspaceOptions, ) -> FsResult<Workspace>

Creates a new isolated workspace with its root directory.

Source

pub async fn delete_workspace(&self, workspace_id: WorkspaceId) -> FsResult<()>

Permanently deletes a workspace and everything it contains.

Source

pub async fn workspace_usage( &self, ctx: &RequestContext, ) -> FsResult<WorkspaceUsage>

Returns logical and quota usage for the context’s workspace.

Source

pub async fn stat( &self, ctx: &RequestContext, path: &VirtualPath, options: StatOptions, ) -> FsResult<Node>

Returns metadata for a path.

Source

pub async fn exists( &self, ctx: &RequestContext, path: &VirtualPath, options: StatOptions, ) -> FsResult<bool>

Returns whether a path resolves to a visible node.

Source

pub async fn read_dir( &self, ctx: &RequestContext, path: &VirtualPath, page: PageRequest, ) -> FsResult<Page<Node>>

Returns one cursor-paginated page of direct directory children.

Source

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.

Source

pub async fn mkdir( &self, ctx: &RequestContext, path: &VirtualPath, options: CreateOptions, ) -> FsResult<Node>

Creates a directory.

Source

pub async fn read( &self, ctx: &RequestContext, path: &VirtualPath, options: ReadOptions, ) -> FsResult<FileRead>

Opens a bounded-memory byte stream for a regular file.

Source

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.

Source

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.

Source

pub async fn append( &self, ctx: &RequestContext, path: &VirtualPath, source: WriteSource, options: WriteOptions, ) -> FsResult<Node>

Atomically appends streamed bytes to a regular file.

Source

pub async fn truncate( &self, ctx: &RequestContext, path: &VirtualPath, length: u64, options: MutationOptions, ) -> FsResult<Node>

Changes a regular file’s logical length.

Source

pub async fn touch( &self, ctx: &RequestContext, path: &VirtualPath, options: TouchOptions, ) -> FsResult<Node>

Updates timestamps or creates an empty regular file.

Source

pub async fn copy( &self, ctx: &RequestContext, from: &VirtualPath, to: &VirtualPath, options: CopyOptions, ) -> FsResult<Node>

Copies a node within the context’s workspace.

Source

pub async fn move_path( &self, ctx: &RequestContext, from: &VirtualPath, to: &VirtualPath, options: MoveOptions, ) -> FsResult<Node>

Moves a node within the context’s workspace.

Source

pub async fn remove( &self, ctx: &RequestContext, path: &VirtualPath, options: RemoveOptions, ) -> FsResult<()>

Permanently removes a node.

Creates a symbolic link containing a relative or absolute virtual target.

Returns the stored target of a symbolic link without resolving it.

Source

pub async fn trash( &self, ctx: &RequestContext, path: &VirtualPath, options: MutationOptions, ) -> FsResult<TrashEntry>

Moves a node into recoverable trash.

Source

pub async fn list_trash( &self, ctx: &RequestContext, page: PageRequest, ) -> FsResult<Page<TrashEntry>>

Returns one cursor-paginated page of recoverable trash records.

Source

pub async fn restore( &self, ctx: &RequestContext, trash_id: TrashId, destination: Option<&VirtualPath>, options: MutationOptions, ) -> FsResult<Node>

Restores a recoverable trash record.

Source

pub async fn purge( &self, ctx: &RequestContext, trash_id: TrashId, ) -> FsResult<()>

Permanently purges a recoverable trash record.

Source

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.

Source

pub async fn remove_attribute( &self, ctx: &RequestContext, path: &VirtualPath, key: &str, options: MutationOptions, ) -> FsResult<Node>

Removes a custom attribute from a node.

Source

pub async fn batch( &self, ctx: &RequestContext, operations: Vec<BatchOperation>, ) -> FsResult<Vec<BatchResult>>

Executes non-streaming operations atomically in request order.

Source

pub async fn glob( &self, ctx: &RequestContext, pattern: &str, page: PageRequest, ) -> FsResult<Page<Node>>

Returns nodes whose absolute paths match a virtual-path glob.

Source

pub async fn find( &self, ctx: &RequestContext, query: FindQuery, page: PageRequest, ) -> FsResult<Page<Node>>

Returns nodes matching bounded metadata predicates.

Source

pub async fn search_content( &self, ctx: &RequestContext, query: ContentQuery, page: PageRequest, ) -> FsResult<Page<SearchMatch>>

Returns bounded literal byte matches from regular files.

Source

pub async fn changes( &self, ctx: &RequestContext, after: Option<ChangeCursor>, page: PageRequest, ) -> FsResult<Page<Change>>

Returns committed changes after an optional opaque cursor.

Trait Implementations§

Source§

impl FileSystem for SqliteFileSystem

Source§

fn workspace_usage<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, ) -> Pin<Box<dyn Future<Output = FsResult<WorkspaceUsage>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns logical and quota usage for the context’s workspace.
Source§

fn stat<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, options: StatOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns metadata for a path.
Source§

fn exists<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, options: StatOptions, ) -> Pin<Box<dyn Future<Output = FsResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns whether a path resolves to a visible node.
Source§

fn read_dir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, page: PageRequest, ) -> Pin<Box<dyn Future<Output = FsResult<Page<Node>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns one cursor-paginated page of direct directory children.
Source§

fn tree<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, options: TreeOptions, page: PageRequest, ) -> Pin<Box<dyn Future<Output = FsResult<Page<TreeEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns one cursor-paginated page of a recursive tree traversal.
Source§

fn mkdir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, options: CreateOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Creates a directory.
Source§

fn read<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, options: ReadOptions, ) -> Pin<Box<dyn Future<Output = FsResult<FileRead>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Opens a bounded-memory byte stream for a regular file.
Source§

fn write<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, source: WriteSource, options: WriteOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically creates or replaces a regular file from a byte stream.
Source§

fn write_at<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, offset: u64, source: WriteSource, options: WriteOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically writes streamed bytes beginning at a logical offset.
Source§

fn append<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, source: WriteSource, options: WriteOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically appends streamed bytes to a regular file.
Source§

fn truncate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, length: u64, options: MutationOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Changes a regular file’s logical length.
Source§

fn touch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, options: TouchOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Updates timestamps or creates an empty regular file.
Source§

fn copy<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, from: &'life2 VirtualPath, to: &'life3 VirtualPath, options: CopyOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Copies a node within the context’s workspace.
Source§

fn move_path<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, from: &'life2 VirtualPath, to: &'life3 VirtualPath, options: MoveOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Moves a node within the context’s workspace.
Source§

fn remove<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, options: RemoveOptions, ) -> Pin<Box<dyn Future<Output = FsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Permanently removes a node.
Creates a symbolic link containing a relative or absolute virtual target.
Returns the stored target of a symbolic link without resolving it.
Source§

fn trash<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, options: MutationOptions, ) -> Pin<Box<dyn Future<Output = FsResult<TrashEntry>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Moves a node into recoverable trash.
Source§

fn list_trash<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, page: PageRequest, ) -> Pin<Box<dyn Future<Output = FsResult<Page<TrashEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns one cursor-paginated page of recoverable trash records.
Source§

fn restore<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, trash: TrashId, destination: Option<&'life2 VirtualPath>, options: MutationOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Restores a recoverable trash record.
Source§

fn purge<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, trash: TrashId, ) -> Pin<Box<dyn Future<Output = FsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Permanently purges a recoverable trash record.
Source§

fn set_attribute<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, key: &'life3 str, value: &'life4 [u8], options: MutationOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Sets an opaque custom attribute on a node.
Source§

fn remove_attribute<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, path: &'life2 VirtualPath, key: &'life3 str, options: MutationOptions, ) -> Pin<Box<dyn Future<Output = FsResult<Node>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Removes a custom attribute from a node.
Source§

fn glob<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, pattern: &'life2 str, page: PageRequest, ) -> Pin<Box<dyn Future<Output = FsResult<Page<Node>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns nodes whose absolute paths match a virtual-path glob.
Source§

fn find<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, query: FindQuery, page: PageRequest, ) -> Pin<Box<dyn Future<Output = FsResult<Page<Node>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns nodes matching bounded metadata predicates.
Source§

fn search_content<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, query: ContentQuery, page: PageRequest, ) -> Pin<Box<dyn Future<Output = FsResult<Page<SearchMatch>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns bounded literal byte matches from regular files.
Source§

fn batch<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, operations: Vec<BatchOperation>, ) -> Pin<Box<dyn Future<Output = FsResult<Vec<BatchResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executes non-streaming operations atomically in request order.
Source§

fn changes<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 RequestContext, after: Option<ChangeCursor>, page: PageRequest, ) -> Pin<Box<dyn Future<Output = FsResult<Page<Change>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns committed changes after an optional opaque cursor.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.