[][src]Struct crndm::stm::Log

pub struct Log<A: MemPool>(_, _);

The Log type for pool A

It is pair of LogEnum and Notifier to keep a log in the Journal. A Journal comprises multiple pages with a fixed number of log slots. Each slot can be filled by one Log. The Journal object uses these logs to provide data consistency. Logs reside in the persistent region and their durability is ensured by flushing the cache lines after each log.

The default mechanism of taking logs is copy-on-write which takes a log when the object is mutably dereferenced. This requires two clflushes: one for the log, and one for the update to the original data.

Implementations

impl<A: MemPool> Log<A>[src]

pub fn set(&mut self, off: u64, len: usize)[src]

Sets the off and len of the log

This function is used for low-level atomic allocation. The algorithm is as follows:

  1. Take a neutral drop log (off = u64::MAX) in a log slot in the Journal
  2. Prepare allocation using pre_alloc()
  3. Add a low-level log for updating the off and len of the drop log using set function
  4. Perform the prepared changes to the allocator

Note that the deallocation of owned objects are handled through RAII. To reclaim the allocation of any sort on a failure, low-level DropOnFailure log is provided with the allocation.

If a crash happens before step 4, all changes are discarded and the drop log remains neutral. If a crash happens in the middle of step 4, the recovery procedure continues performing the changes, including the low-level logs for updating the drop log. Once it has the high-level drop log, the high-level recovery procedure reclaims the allocation as the crash happened inside a transaction.

impl<A: MemPool> Log<A>[src]

pub fn new(log: LogEnum, notifier: Notifier<A>) -> Self[src]

Create a new log entry

pub fn take<T: PSafe + ?Sized>(
    x: &T,
    journal: &Journal<A>,
    notifier: Notifier<A>
) -> Ptr<Log<A>, A>
[src]

Takes a log of x into journal and notifies the owner that log is taken if notifier is specified.

pub fn drop_on_commit(
    offset: u64,
    len: usize,
    journal: &Journal<A>
) -> Ptr<Log<A>, A>
[src]

Creates a new DropOnCommit log and writes it on journal

pub fn drop_on_abort(
    offset: u64,
    len: usize,
    journal: &Journal<A>
) -> Ptr<Log<A>, A>
[src]

Creates a new DropOnAbort log and writes it on journal

pub fn drop_on_failure(
    offset: u64,
    len: usize,
    journal: &Journal<A>
) -> Ptr<Log<A>, A>
[src]

Creates a new DropOnFailure log and writes it on journal

pub fn unlock_on_commit(virt_addr: u64, journal: &Journal<A>)[src]

Creates a new UnlockOnCommit for locking data in a thread

pub fn clear(&mut self)[src]

Clears this log and notifies the owner

  • If it is a DataLog, it reclaims the allocation for the log.
  • If it is a UnlockOnCommit, it unlocks the mutex.

pub fn notify(&mut self, v: u8)[src]

Notify the owner that the log is taken/cleared according to v

Trait Implementations

impl<A: MemPool> Clone for Log<A>[src]

impl<A: MemPool> Copy for Log<A>[src]

impl<A: MemPool> Debug for Log<A>[src]

impl<A: MemPool> Default for Log<A>[src]

Auto Trait Implementations

impl<A> LooseTxInUnsafe for Log<A> where
    A: LooseTxInUnsafe
[src]

impl<A> PSafe for Log<A>[src]

impl<A> RefUnwindSafe for Log<A> where
    A: RefUnwindSafe
[src]

impl<A> !Send for Log<A>[src]

impl<A> !Sync for Log<A>[src]

impl<A> TxInSafe for Log<A> where
    A: TxInSafe
[src]

impl<A> !TxOutSafe for Log<A>[src]

impl<A> Unpin for Log<A> where
    A: Unpin
[src]

impl<A> UnwindSafe for Log<A> where
    A: UnwindSafe
[src]

impl<A> VSafe for Log<A> where
    A: VSafe
[src]

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, U> Into<U> for T where
    U: From<T>, 
[src]

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>,