Skip to main content

compmd_host/
store.rs

1//! The pack store's storage ([hosting], decisions 4 and 5): the releases a host fetched or keeps, by their place, each
2//! checked against its integrity before it was kept. A host gives the storage: a folder ([`crate::FolderStore`]),
3//! its own store of published versions, or none ([`crate::NoStore`]).
4//!
5//! [hosting]: https://github.com/comp-markdown/compmd/blob/main/docs/hosting.md
6
7use compmd_pack::{PackName, Place};
8
9use crate::stored_release::StoredRelease;
10
11/// Where a host keeps packs beyond the bundle.
12pub trait Store: Send + Sync {
13    /// The releases of `pack` it holds, in any order.
14    fn releases(&self, pack: &PackName) -> Vec<StoredRelease>;
15
16    /// The bytes of the file at `place`, when it holds them.
17    fn file(&self, place: &Place) -> Option<Vec<u8>>;
18}