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

  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.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Provides the location of a chunk in the repository

Sets the location of a chunk in the repository

Returns the set of all ChunkIDs known to exist in the Asuran repository.

Commits the index

Returns the total number of chunks in the index

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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