pub struct FixedAppendLog<ResourceAdaptor: LoadStore> {
persisted_sync: Arc<RwLock<VersionSyncHandle>>,
file_path: PathBuf,
file_pattern: String,
resource_size: u64,
file_size: u64,
write_to_file: Option<File>,
commit_index: u64,
write_index: u64,
adaptor: ResourceAdaptor,
}
Expand description
For now, this is implemented with a direct copy from memory to file, using native order, but the order is recorded in a header, and can be used to support transfer in the future.
Fields§
§persisted_sync: Arc<RwLock<VersionSyncHandle>>
§file_path: PathBuf
§file_pattern: String
§resource_size: u64
§file_size: u64
§write_to_file: Option<File>
§commit_index: u64
§write_index: u64
§adaptor: ResourceAdaptor
Implementations§
Source§impl<ResourceAdaptor: LoadStore + Default> FixedAppendLog<ResourceAdaptor>
impl<ResourceAdaptor: LoadStore + Default> FixedAppendLog<ResourceAdaptor>
pub(crate) fn open_impl( adaptor: ResourceAdaptor, location: Option<StorageLocation>, file_path: &Path, file_pattern: &str, resource_size: u64, file_size: u64, ) -> Result<FixedAppendLog<ResourceAdaptor>>
pub fn load( loader: &mut AtomicStoreLoader, adaptor: ResourceAdaptor, file_pattern: &str, resource_size: u64, file_size: u64, ) -> Result<FixedAppendLog<ResourceAdaptor>>
pub fn create( loader: &mut AtomicStoreLoader, adaptor: ResourceAdaptor, file_pattern: &str, resource_size: u64, file_size: u64, ) -> Result<FixedAppendLog<ResourceAdaptor>>
fn location_to_index(&self, location: &StorageLocation) -> Result<u64>
fn index_to_location(&self, index: u64) -> StorageLocation
fn open_write_file(&mut self) -> Result<()>
pub fn store_resource( &mut self, resource: &ResourceAdaptor::ParamType, ) -> Result<StorageLocation>
pub fn commit_version(&mut self) -> Result<()>
pub fn skip_version(&mut self) -> Result<()>
pub fn revert_version(&mut self) -> Result<()>
pub fn load_latest(&self) -> Result<ResourceAdaptor::ParamType>
pub fn load_specified( &self, location: &StorageLocation, ) -> Result<ResourceAdaptor::ParamType>
pub fn load_at(&self, index: u64) -> Result<ResourceAdaptor::ParamType>
pub fn iter(&self) -> Iter<'_, ResourceAdaptor> ⓘ
Trait Implementations§
Auto Trait Implementations§
impl<ResourceAdaptor> Freeze for FixedAppendLog<ResourceAdaptor>where
ResourceAdaptor: Freeze,
impl<ResourceAdaptor> RefUnwindSafe for FixedAppendLog<ResourceAdaptor>where
ResourceAdaptor: RefUnwindSafe,
impl<ResourceAdaptor> Send for FixedAppendLog<ResourceAdaptor>where
ResourceAdaptor: Send,
impl<ResourceAdaptor> Sync for FixedAppendLog<ResourceAdaptor>where
ResourceAdaptor: Sync,
impl<ResourceAdaptor> Unpin for FixedAppendLog<ResourceAdaptor>where
ResourceAdaptor: Unpin,
impl<ResourceAdaptor> UnwindSafe for FixedAppendLog<ResourceAdaptor>where
ResourceAdaptor: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more