use super::Kind;
pub enum YesNo {
Yes,
No,
}
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub enum MemoryState {
NotInMemory,
InMemoryUnmodified,
InMemoryModified,
InMemoryHashModified,
}
pub const NULLSTAT: &[u8] = b"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
pub fn null_parent_details() -> TreeData {
TreeData {
minikind: Kind::Absent,
fingerprint: Vec::new(),
size: 0,
executable: false,
packed_stat: Vec::new(),
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TreeData {
pub minikind: Kind,
pub fingerprint: Vec<u8>,
pub size: u64,
pub executable: bool,
pub packed_stat: Vec<u8>,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct EntryKey {
pub dirname: Vec<u8>,
pub basename: Vec<u8>,
pub file_id: Vec<u8>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Entry {
pub key: EntryKey,
pub trees: Vec<TreeData>,
}
impl Entry {
#[inline]
pub fn tree_kind(&self, tree_index: usize) -> Option<Kind> {
self.trees.get(tree_index).map(|t| t.minikind)
}
#[inline]
pub fn tree0_kind(&self) -> Option<Kind> {
self.tree_kind(0)
}
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Dirblock {
pub dirname: Vec<u8>,
pub entries: Vec<Entry>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LockState {
Read,
Write,
}