newtype for outsourced file ids

master
Avril 3 years ago
parent 531d6557c4
commit 033d70589f
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -29,6 +29,8 @@ use tokio::io::{
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct AbsoluteIndex(Vec<Index>);
id_type!(pub CachedFileId: "The file path is this ID inside the data dir. It may be subject to caching");
/// Possible value types of the data map
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum Data
@ -53,12 +55,12 @@ pub enum Data
///
/// The file path is this ID inside the data dir. It may be subject to caching later down the line, and will require deleting when an Atom of this type is removed.
/// The files corresponding to these entries should be lazy-loaded (as open `tokio::fs::File`s) into a `DelayQueue` for caching.
TextFile(uuid::Uuid),
TextFile(CachedFileId),
/// A binary blob outsourced to a file.
///
/// The file path is this ID inside the data dir. It may be subject to caching later down the line, and will require deleting when an Atom of this type is removed.
/// The files corresponding to these entries should be lazy-loaded (as open `tokio::fs::File`s) into a `DelayQueue` for caching.
BinaryFile(uuid::Uuid),
BinaryFile(CachedFileId),
/// A reference index to an item within the same `Datamap` as this one.
RelativeRef(Index),

Loading…
Cancel
Save