Struct rustbreak::TransactionLock
[−]
[src]
pub struct TransactionLock<'a: 'b, 'b, T: Serialize + Deserialize + Eq + Hash + 'a> { /* fields omitted */ }
A TransactionLock
that is atomic in writes and defensive
You generate this by calling transaction
on a Lock
The transactionlock does not get automatically applied when it is dropped, you have to run
it.
This allows for defensive programming where the values are only applied once it is run
.
Methods
impl<'a: 'b, 'b, T: Serialize + Deserialize + Eq + Hash + 'a> TransactionLock<'a, 'b, T>
[src]
fn insert<S: Serialize + 'static, K: ?Sized>(&mut self,
key: &K,
obj: S)
-> Result<()> where T: Borrow<K>, K: Hash + PartialEq + ToOwned<Owned=T>
key: &K,
obj: S)
-> Result<()> where T: Borrow<K>, K: Hash + PartialEq + ToOwned<Owned=T>
Insert a given Object into the Database at that key
See Database::insert
for details
fn retrieve<S: Deserialize, K: ?Sized>(&mut self, key: &K) -> Result<S> where T: Borrow<K>, K: Hash + Eq
Retrieves an Object from the Database
See Database::retrieve
for details
fn run(self) -> Result<()>
Consumes the TransactionLock and runs it