You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

use super::*;
bitflags!{
/// What to remove when using `Store::clean()`.
pub struct StoreCleanFlags: u32
{
/// Dead entry hash (key) mappings.
const MAP = 1 << 0;
/// Dead `tag -> entry hash` mappings.
const TAG_MAP = 1 << 1;
/// Dead tags (i.e. tags with no entries).
const TAGS = 1 << 2;
/// Dead entries (i.e. Inaccessable, corrupt, or missing file entries).
const ENTRY = 1 << 3;
/// Clean all
const ALL = (1 << 4)-1;
}
}
impl Default for StoreCleanFlags
{
#[inline]
fn default() -> Self
{
Self::MAP | Self::TAG_MAP | Self::TAGS
}
}
// Refresh and cleaning
impl Store
{
/// Remove any and all dead mappings / entries specified by the flags here.
///
/// Pass `Default::default()` to only clean *mappings*, and not dead entries. Otherwise, `StoreCleanFlags::ALL` will perform a full audit.
/// See [`StoreCleanFlags`] for other options.
pub fn clean(&mut self, what: StoreCleanFlags)
{
todo!("What order do we do `what`'s things in?")
}
/// Force a full rebuild of all mappings.
///
/// The clears the entire store except entries (and entry specific caches), and then rebuilds all the internal mappings from scratch. Any cached mappings (e.g empty tag reserves) are removed.
/// This does not remove invalid entries themselves, for that use `clean(StoreCleanFlags::ENTRY)`.
pub fn rebuild(&mut self)
{
todo!()
}
}