[][src]Struct asuran::repository::backend::multifile::index::Index

pub struct Index {
    input: Sender<IndexCommand>,
    path: String,
}

Fields

input: Sender<IndexCommand>path: String

Methods

impl Index[src]

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

pub fn open(repository_path: impl AsRef<Path>) -> Result<Index>[src]

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

  1. The index folder does not exist and creating it failed
  2. There are no unlocked index files and creating one fails
  3. There is a file called "index" in the repository folder
  4. Some other IO error (such as lack of permissions) occurs
  5. The path contains non-utf8 characters

TODOs:

  1. Return an error if deserializing a transaction fails before the end of the file is reached
  2. 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.

pub async fn close<'_>(&'_ mut self)[src]

Trait Implementations

impl Clone for Index[src]

impl Debug for Index[src]

impl Index for Index[src]

Auto Trait Implementations

impl !RefUnwindSafe for Index

impl Send for Index

impl Sync for Index

impl Unpin for Index

impl !UnwindSafe for Index

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]