[−][src]Struct moiradb::moiradb::MoiraDb
There is 1 MoiraDb per transaction.
Fields
seq: u64
kv_store: HashMap<K, WriteType<V>>
A local cache of key/values, read/write
write_set: HashSet<K>
The keys we expect the transaction to write to
outcome: TransactionResult
The outcome of executing the command
transaction: Arc<Transaction<K, C>>
A reference to the transaction to execute
Implementations
impl<K, V, C> MoiraDb<K, V, C> where
K: 'static + Send + Serialize + Eq + Hash + Clone + Debug,
V: 'static + Send + Sync + Serialize + DeserializeOwned + Debug,
C: Command<K, V> + Debug,
[src]
K: 'static + Send + Serialize + Eq + Hash + Clone + Debug,
V: 'static + Send + Sync + Serialize + DeserializeOwned + Debug,
C: Command<K, V> + Debug,
pub fn new(
transaction: Arc<Transaction<K, C>>,
read_commands: UnboundedSender<MoiraCommand<K, V, C>>
) -> MoiraDb<K, V, C>
[src]
transaction: Arc<Transaction<K, C>>,
read_commands: UnboundedSender<MoiraCommand<K, V, C>>
) -> MoiraDb<K, V, C>
Construct a new instance of MoiraDb.
pub async fn read(&mut self, key: K) -> DBValue<V>
[src]
Read data from the local cache or, in a case where the data is not cached locally, from the MultiVersionedStore.
pub async fn write(&mut self, key: K, value: DBValue<V>)
[src]
Inserts the key and the value into the local key-value cache
pub async fn delete(&mut self, key: K)
[src]
Inserts a None value for a given key, effectively deleting any stored data.
pub async fn set_outcome(self, state: TransactionResult)
[src]
Sends back results to MoiraDb to commit, or abort or reschedule db writes to the backing store. Consumes this instance of MoiraDb.
When a command executes, it returns Abort, Commit, or Reschedule.
Abort stops execution.
Commit, and this transaction has only written to the originally expected values in the write set, we can commit.
But if it has written to more keys than what was originally expected, we need to reschedule it for a later commit version. Later, we will re-run the deferred future(s) and include the proper set of keys, so that the future result will be consistent.
pub async fn run_command(self) -> u64
[src]
Run the command, then consume this MoiraDb in set_outcome()
impl<K, V, C> MoiraDb<K, V, C> where
K: 'static + Send + Serialize + Eq + Hash + Clone + Debug,
V: 'static + Send + Sync + Serialize + DeserializeOwned + Debug,
C: Debug + MergeCommand<K, V>,
[src]
K: 'static + Send + Serialize + Eq + Hash + Clone + Debug,
V: 'static + Send + Sync + Serialize + DeserializeOwned + Debug,
C: Debug + MergeCommand<K, V>,
pub async fn merge(&mut self, key: K, value: DBValue<V>)
[src]
pub async fn collect(&mut self, key: K) -> DBValue<V>
[src]
Trait Implementations
impl<K: Debug, V: Debug, C: Debug + ?Sized> Debug for MoiraDb<K, V, C> where
C: Debug,
K: Debug,
V: Debug,
[src]
C: Debug,
K: Debug,
V: Debug,
Auto Trait Implementations
impl<K, V, C> !RefUnwindSafe for MoiraDb<K, V, C>
[src]
impl<K, V, C: ?Sized> Send for MoiraDb<K, V, C> where
C: Send + Sync,
K: Send + Sync,
V: Send + Sync,
[src]
C: Send + Sync,
K: Send + Sync,
V: Send + Sync,
impl<K, V, C: ?Sized> Sync for MoiraDb<K, V, C> where
C: Send + Sync,
K: Send + Sync,
V: Send + Sync,
[src]
C: Send + Sync,
K: Send + Sync,
V: Send + Sync,
impl<K, V, C: ?Sized> Unpin for MoiraDb<K, V, C> where
K: Unpin,
[src]
K: Unpin,
impl<K, V, C> !UnwindSafe for MoiraDb<K, V, C>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,