[][src]Trait rdms::Writer

pub trait Writer<K, V> where
    K: Clone + Ord + Footprint,
    V: Clone + Diff + Footprint
{ fn set(&mut self, k: K, v: V) -> Result<Option<Entry<K, V>>>;
fn set_cas(&mut self, k: K, v: V, cas: u64) -> Result<Option<Entry<K, V>>>;
fn delete<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<Entry<K, V>>>
    where
        K: Borrow<Q>,
        Q: ToOwned<Owned = K> + Ord
; }

Index write operations.

Required methods

fn set(&mut self, k: K, v: V) -> Result<Option<Entry<K, V>>>

Set {key, value} in index. Return older entry if present. Return the older entry if present. If operation was invalid or NOOP, returned seqno shall be ZERO.

LSM mode: Add a new version for the key, perserving the old value.

fn set_cas(&mut self, k: K, v: V, cas: u64) -> Result<Option<Entry<K, V>>>

Set {key, value} in index if an older entry exists with the same cas value. To create a fresh entry, pass cas as ZERO. Return the older entry if present. If operation was invalid or NOOP, returned seqno shall be ZERO.

LSM mode: Add a new version for the key, perserving the old value.

fn delete<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<Entry<K, V>>> where
    K: Borrow<Q>,
    Q: ToOwned<Owned = K> + Ord

Delete key from index. Return the mutation and entry if present. If operation was invalid or NOOP, returned seqno shall be ZERO.

LSM mode: Mark the entry as deleted along with seqno at which it deleted

NOTE: K should be borrowable as &Q and Q must be convertable to owned K. This is require in lsm mode, where owned K must be inserted into the tree.

Loading content...

Implementors

impl<K, V> Writer<K, V> for Llrb<K, V> where
    K: Clone + Ord + Footprint,
    V: Clone + Diff + Footprint
[src]

Create/Update/Delete operations on Llrb index.

fn set(&mut self, key: K, value: V) -> Result<Option<Entry<K, V>>>[src]

Set {key, value} pair into index. If key is already present, update the value and return the previous entry, else create a new entry.

LSM mode: Add a new version for the key, perserving the old value.

fn set_cas(&mut self, key: K, value: V, cas: u64) -> Result<Option<Entry<K, V>>>[src]

Similar to set, but succeeds only when CAS matches with entry's last seqno. In other words, since seqno is unique to each mutation, we use seqno of the mutation as the CAS value. Use CAS == 0 to enforce a create operation.

LSM mode: Add a new version for the key, perserving the old value.

fn delete<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<Entry<K, V>>> where
    K: Borrow<Q>,
    Q: ToOwned<Owned = K> + Ord
[src]

Delete the given key. Note that back-to-back delete for the same key shall collapse into a single delete, first delete is ingested while the rest are ignored.

LSM mode: Mark the entry as deleted along with seqno at which it deleted

NOTE: K should be borrowable as &Q and Q must be convertable to owned K. This is require in lsm mode, where owned K must be inserted into the tree.

impl<K, V> Writer<K, V> for LlrbWriter<K, V> where
    K: Clone + Ord + Footprint,
    V: Clone + Diff + Footprint
[src]

fn set(&mut self, key: K, value: V) -> Result<Option<Entry<K, V>>>[src]

Set {key, value} pair into index. If key is already present, update the value and return the previous entry, else create a new entry.

LSM mode: Add a new version for the key, perserving the old value.

fn set_cas(&mut self, key: K, value: V, cas: u64) -> Result<Option<Entry<K, V>>>[src]

Similar to set, but succeeds only when CAS matches with entry's last seqno. In other words, since seqno is unique to each mutation, we use seqno of the mutation as the CAS value. Use CAS == 0 to enforce a create operation.

LSM mode: Add a new version for the key, perserving the old value.

fn delete<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<Entry<K, V>>> where
    K: Borrow<Q>,
    Q: ToOwned<Owned = K> + Ord
[src]

Delete the given key. Note that back-to-back delete for the same key shall collapse into a single delete, first delete is ingested while the rest are ignored.

LSM mode: Mark the entry as deleted along with seqno at which it deleted

NOTE: K should be borrowable as &Q and Q must be convertable to owned K. This is require in lsm mode, where owned K must be inserted into the tree.

impl<K, V> Writer<K, V> for Mvcc<K, V> where
    K: Clone + Ord + Footprint,
    V: Clone + Diff + Footprint
[src]

Create/Update/Delete operations on Mvcc instance.

fn set(&mut self, key: K, value: V) -> Result<Option<Entry<K, V>>>[src]

Set {key, value} pair into index. If key is already present, update the value and return the previous entry, else create a new entry.

LSM mode: Add a new version for the key, perserving the old value.

fn set_cas(&mut self, key: K, value: V, cas: u64) -> Result<Option<Entry<K, V>>>[src]

Similar to set, but succeeds only when CAS matches with entry's last seqno. In other words, since seqno is unique to each mutation, we use seqno of the mutation as the CAS value. Use CAS == 0 to enforce a create operation.

LSM mode: Add a new version for the key, perserving the old value.

fn delete<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<Entry<K, V>>> where
    K: Borrow<Q>,
    Q: ToOwned<Owned = K> + Ord
[src]

Delete the given key. Note that back-to-back delete for the same key shall collapse into a single delete, first delete is ingested while the rest are ignored.

LSM mode: Mark the entry as deleted along with seqno at which it deleted

NOTE: K should be borrowable as &Q and Q must be convertable to owned K. This is require in lsm mode, where owned K must be inserted into the tree.

impl<K, V> Writer<K, V> for MvccWriter<K, V> where
    K: Clone + Ord + Footprint,
    V: Clone + Diff + Footprint
[src]

fn set(&mut self, key: K, value: V) -> Result<Option<Entry<K, V>>>[src]

Set {key, value} pair into index. If key is already present, update the value and return the previous entry, else create a new entry.

LSM mode: Add a new version for the key, perserving the old value.

fn set_cas(&mut self, key: K, value: V, cas: u64) -> Result<Option<Entry<K, V>>>[src]

Similar to set, but succeeds only when CAS matches with entry's last seqno. In other words, since seqno is unique to each mutation, we use seqno of the mutation as the CAS value. Use CAS == 0 to enforce a create operation.

LSM mode: Add a new version for the key, perserving the old value.

fn delete<Q: ?Sized>(&mut self, key: &Q) -> Result<Option<Entry<K, V>>> where
    K: Borrow<Q>,
    Q: ToOwned<Owned = K> + Ord
[src]

Delete the given key. Note that back-to-back delete for the same key shall collapse into a single delete, first delete is ingested while the rest are ignored.

LSM mode: Mark the entry as deleted along with seqno at which it deleted

NOTE: K should be borrowable as &Q and Q must be convertable to owned K. This is require in lsm mode, where owned K must be inserted into the tree.

impl<K, V> Writer<K, V> for NoDisk<K, V> where
    K: Clone + Ord + Footprint,
    V: Clone + Diff + Footprint
[src]

impl<K, V> Writer<K, V> for Snapshot<K, V> where
    K: Clone + Ord + Serialize + Footprint,
    V: Clone + Diff + Serialize + Footprint
[src]

Loading content...