Skip to main content

Store

Trait Store 

Source
pub trait Store: Send + Sync {
    // Required methods
    fn list(&self, page: &str) -> Result<Vec<Listed>>;
    fn create(
        &self,
        page: &str,
        anchor: Anchor,
        first: Message,
    ) -> Result<String>;
    fn reply(&self, id: &str, message: Message) -> Result<Option<String>>;
    fn resolve(&self, id: &str) -> Result<Option<String>>;
    fn attached(&self) -> Result<Vec<(String, Listed)>>;
    fn heard(&self, paths: &[PathBuf]) -> Vec<String>;
}
Expand description

The comment store port: where one served folder’s — or one published document’s — threads are kept, by thread id. A page here is always a page key, /a.md, made by Comments; an id is always one that is_id accepts. Writes are silent — announcing them is Comments’s job.

Required Methods§

Source

fn list(&self, page: &str) -> Result<Vec<Listed>>

A page’s threads, oldest first.

Source

fn create(&self, page: &str, anchor: Anchor, first: Message) -> Result<String>

Starts a thread on page with its first message; answers its id.

Source

fn reply(&self, id: &str, message: Message) -> Result<Option<String>>

Appends message to thread id: the page it is on, or None when there is no such thread.

Source

fn resolve(&self, id: &str) -> Result<Option<String>>

Resolves thread id — it is gone: the page it was on, or None when there was no such thread.

Source

fn attached(&self) -> Result<Vec<(String, Listed)>>

Every thread still attached, each with its page: what a publish carries onto the new version.

Source

fn heard(&self, paths: &[PathBuf]) -> Vec<String>

The pages whose threads changed among paths by a hand other than this store’s — a thread file edited in an editor. Asking marks them heard: whoever asks announces them. A store with no files hears nothing.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§