Skip to content
Snippets Groups Projects
datamodel.rs 700 B
Newer Older
  • Learn to ignore specific revisions
  • Daniel Müller's avatar
    Daniel Müller committed
    mod block_pool;
    mod file_table;
    mod index_table;
    mod metadata;
    
    pub use block_pool::*;
    pub use file_table::*;
    pub use index_table::*;
    pub use metadata::*;
    
    /// Unique Id for identifying snapback files that reference the same data. When restoring or
    /// appending, all files (FileTable, IndexTable, BlockPool) must have the same Uid. This is mainly
    /// used to avoid accidentally mixing backup files that are not compatible.
    pub type Uid = [u8; 16];
    
    pub(crate) trait AllZeroExt {
        /// Return true if all bytes contained in the type have the value zero
        fn is_all_zero(&self) -> bool;
    }
    
    impl AllZeroExt for Uid {
        fn is_all_zero(&self) -> bool {
            self.iter().all(|b| *b == 0)
        }
    }