Struct encryption::file_dict_file::FileDictionaryFile [−][src]
FileDictionaryFile is used to store log style file dictionary.
Layout:
Encrypted File Header + FileDictionary Content | Record Header + Record Content | etc
Fields
base: PathBufname: Stringappend_file: Option<File>file_dict: FileDictionaryenable_log: boolfile_rewrite_threshold: u64removed: u64file_size: usizeImplementations
impl FileDictionaryFile[src]
const RECORD_HEADER_SIZE: usize[src]
Header of record.
+----+--+--+-+----+----
| | | | | |
++---++-++-++++---++---
^ ^ ^ ^ ^ ^
| | | | | + FileInfo content (variable bytes)
| | | | + File name content (variable bytes)
| | | + Log type (1 bytes)
| | + FileInfo length (2 bytes)
| + File name length (2 bytes)
+ Crc32 (4 bytes)
pub fn new<P: AsRef<Path>>(
base: P,
name: &str,
enable_log: bool,
file_rewrite_threshold: u64
) -> Result<FileDictionaryFile>[src]
base: P,
name: &str,
enable_log: bool,
file_rewrite_threshold: u64
) -> Result<FileDictionaryFile>
pub fn open<P: AsRef<Path>>(
base: P,
name: &str,
enable_log: bool,
file_rewrite_threshold: u64,
skip_rewrite: bool
) -> Result<(FileDictionaryFile, FileDictionary)>[src]
base: P,
name: &str,
enable_log: bool,
file_rewrite_threshold: u64,
skip_rewrite: bool
) -> Result<(FileDictionaryFile, FileDictionary)>
pub fn file_path(&self) -> PathBuf[src]
Get the file path.
fn rewrite(&mut self) -> Result<()>[src]
Rewrite the log file to reduce file size and reduce the time of next recovery.
pub fn recovery(&mut self) -> Result<FileDictionary>[src]
Recovery from the log file and return FileDictionary.
pub fn insert(&mut self, name: &str, info: &FileInfo) -> Result<()>[src]
Append an insert operation to the log file.
Warning: self.write(file_dict) must be called before.
pub fn remove(&mut self, name: &str) -> Result<()>[src]
Append a remove operation to the log file.
Warning: self.write(file_dict) must be called before.
fn check_compact(&mut self) -> Result<()>[src]
This function needs to be called after each append operation to check if compact is needed.
fn convert_record_to_bytes(
fname: &str,
record_type: LogRecord
) -> Result<Vec<u8>>[src]
fname: &str,
record_type: LogRecord
) -> Result<Vec<u8>>
fn parse_next_record(remained: &[u8]) -> Result<(usize, String, LogRecord)>[src]
fn update_metrics(&self)[src]
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for FileDictionaryFile
impl Send for FileDictionaryFile
impl Sync for FileDictionaryFile
impl Unpin for FileDictionaryFile
impl UnwindSafe for FileDictionaryFile
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Pointable for T[src]
pub const ALIGN: usize[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T[src]
pub unsafe fn drop(ptr: usize)[src]
impl<T> Same<T> for T[src]
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized, [src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>, [src]
V: MultiLane<T>,