Skip to main content

FsTrait

Trait FsTrait 

Source
pub trait FsTrait:
    Send
    + Sync
    + 'static
    + Debug {
Show 16 methods // Required methods fn virtual_url(&self, path: &str) -> Option<Url>; fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn glob_read<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<Vec<File>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn write_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 Url, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn read_dir<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Option<Vec<FsDirEntry>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn is_file<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Url, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn is_dir<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Url, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn glob<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, base: &'life1 Url, pattern: &'life2 str, ) -> Pin<Box<dyn Future<Output = Option<Vec<FsDirEntry>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; // Provided methods fn cache_root(&self) -> Option<Url> { ... } fn is_cache_url(&self, url: &Url) -> bool { ... } fn lov_url(&self, url: &str, prefix: &str) -> Option<Url> { ... } fn cache_url(&self, source: &Url) -> Option<Url> { ... } fn write_cache<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 Url, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn cache_age<'life0, 'life1, 'async_trait>( &'life0 self, _url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Option<Duration>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn walk<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _root: &'life1 Url, _extensions: &'life2 [&'life3 str], _max: usize, ) -> Pin<Box<dyn Future<Output = Vec<Url>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn is_ignored<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _root: &'life1 Url, _file: &'life2 Url, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... }
}
Expand description

Platform file system used by the server.

Besides plain file access it owns the ontology cache: copies of remote ontologies and shapes that the server loads in the background. Cached files live under cache_root, at human-readable locations so goto-definition shows …/lov/foaf.ttl instead of an opaque URL:

  • lov/<prefix>.ttl for an ontology resolved by prefix (lov_url),
  • sources/<host>/<path> for an ontology or shape at a known URL (cache_url).

The cache is shared by all server processes of a user and reused across restarts (see crate::util::cache). Files in it are snapshots managed by the server; editing them has no effect on the server.

Required Methods§

Source

fn virtual_url(&self, path: &str) -> Option<Url>

Location of path, relative to the cache root.

Source

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn glob_read<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<Vec<File>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn write_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 Url, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn read_dir<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Option<Vec<FsDirEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn is_file<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Url, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn is_dir<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Url, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn glob<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, base: &'life1 Url, pattern: &'life2 str, ) -> Pin<Box<dyn Future<Output = Option<Vec<FsDirEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Provided Methods§

Source

fn cache_root(&self) -> Option<Url>

Root of the ontology cache, None when there is no on-disk cache.

Source

fn is_cache_url(&self, url: &Url) -> bool

Whether url is a file inside the ontology cache.

Source

fn lov_url(&self, url: &str, prefix: &str) -> Option<Url>

Cache location of the ontology for namespace url, written as prefix:.

Source

fn cache_url(&self, source: &Url) -> Option<Url>

Cache location of the remote document at source: <cache>/sources/<host>/<path>.

Unlike lov_url, which is keyed by prefix name, this is keyed by the source itself, so distinct documents that describe the same namespace never share a location (and therefore never share an entity).

Source

fn write_cache<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 Url, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write a file into the cache.

Implementations should write atomically (concurrent servers share the cache) and mark the file read-only, so editors warn before it is edited.

Source

fn cache_age<'life0, 'life1, 'async_trait>( &'life0 self, _url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Option<Duration>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Time since the cached file at url was written, None if it is absent.

Source

fn walk<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _root: &'life1 Url, _extensions: &'life2 [&'life3 str], _max: usize, ) -> Pin<Box<dyn Future<Output = Vec<Url>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Files under root whose name ends with one of extensions, at most max. Skips hidden folders, node_modules and target. The default finds nothing (no file system to walk).

Source

fn is_ignored<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _root: &'life1 Url, _file: &'life2 Url, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Whether walk would skip file inside root (ignored by git, hidden, …). The default ignores nothing.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§