1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::store::BlobTable;

/// A unique entry in the data store, in a specific [`BlobTable`].
#[derive(Clone, Debug)]
pub struct BlobEntry {
    /// The [`BlobTable`] where the entry is stored.
    pub table: BlobTable,
    /// The key for the entry, inside the table.
    pub key: String,
}

impl BlobEntry {
    pub fn new(table: BlobTable, key: String) -> BlobEntry {
        BlobEntry { table, key }
    }
}

impl std::fmt::Display for BlobEntry {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}/{}", self.table, self.key)
    }
}