Struct asuran::repository::backend::multifile::index::Index [−][src]
pub struct Index { /* fields omitted */ }
Implementations
MultiFile
index with lock free multithreading
Warning
You must call commit_index
for your changes to be committed to disk, the Index
will not do this for you
Opens and reads the index, creating it if it does not exist.
Note that the repository path is the root path of the repository, not the path of the index folder.
This method will create the index folder if it does not exist.
Files who’s names are not strictly base 10 integers are ignored, and will not be added to the state or written to.
This method only creates the event loop on its own, the actual index is created by
InternalIndex::open
Errors
Will return Err if
- The index folder does not exist and creating it failed
- There are no unlocked index files and creating one fails
- There is a file called “index” in the repository folder
- Some other IO error (such as lack of permissions) occurs
- The path contains non-utf8 characters
TODOs:
- Return an error if deserializing a transaction fails before the end of the file is reached
- This function can currently panic if we have to create a new index file, but someone else that while we were parsing the transaction. Resolution for this conflict needs to be implemented.
Trait Implementations
fn lookup_chunk<'life0, 'async_trait>(
&'life0 mut self,
id: ChunkID
) -> Pin<Box<dyn Future<Output = Option<SegmentDescriptor>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn lookup_chunk<'life0, 'async_trait>(
&'life0 mut self,
id: ChunkID
) -> Pin<Box<dyn Future<Output = Option<SegmentDescriptor>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Provides the location of a chunk in the repository
Sets the location of a chunk in the repository
Returns the set of all ChunkID
s known to exist in the Asuran repository.
Commits the index
Auto Trait Implementations
impl !RefUnwindSafe for Index
impl !UnwindSafe for Index
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more