Struct diskvec::DiskVec
[−]
[src]
pub struct DiskVec<T: Volatile> { /* fields omitted */ }
A concurrent on-disk vector for storing and manipulating Volatile
types
Limitations
- A value read from the diskarray might have been corrupted by faulty
writes. For this reason, it is recommended that
T
carries its own checksum capability. - Write locks are done with a finite amount of mutexes, that may be less than the amount of elements in the vector, so deadlocks are possible even if you try to obtain mutable references to two different index positions.
- Since reads are lock-free, there is no guarantee that the value you're holding a reference to will not change behind your back.
Guarantees
- Writes are done using locks, so no writes will trample each other.
Methods
impl<T: Volatile> DiskVec<T>
[src]
fn new<P: Into<PathBuf>>(path: P) -> Result<Self>
[src]
Construct a new DiskVec
given a path.
fn get(&self, idx: usize) -> Option<&T>
[src]
Get a reference to the value at index
fn get_mut(&self, idx: usize) -> Option<MutableReference<T>>
[src]
Get a mutable reference to the value at index
fn len(&self) -> usize
[src]
returns the length of the DiskVec
fn push(&self, t: T) -> Result<usize>
[src]
Pushes an element to the DiskVec
, returning the new index.