Ensure writable transactions work correctly
This commit is contained in:
parent
f6f54cf4f4
commit
ca57df132e
3 changed files with 36 additions and 36 deletions
|
@ -44,7 +44,7 @@ impl<'a> Transaction<'a> {
|
|||
// Cancel a transaction
|
||||
pub fn cancel(&mut self) -> Result<(), Error> {
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Mark this transaction as done
|
||||
|
@ -57,11 +57,11 @@ impl<'a> Transaction<'a> {
|
|||
// Commit a transaction
|
||||
pub fn commit(&mut self) -> Result<(), Error> {
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Mark this transaction as done
|
||||
|
@ -77,11 +77,11 @@ impl<'a> Transaction<'a> {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Remove the key
|
||||
|
@ -95,7 +95,7 @@ impl<'a> Transaction<'a> {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check the key
|
||||
|
@ -109,7 +109,7 @@ impl<'a> Transaction<'a> {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Get the key
|
||||
|
@ -124,11 +124,11 @@ impl<'a> Transaction<'a> {
|
|||
V: Into<Val>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Set the key
|
||||
|
@ -143,11 +143,11 @@ impl<'a> Transaction<'a> {
|
|||
V: Into<Val>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Set the key
|
||||
|
@ -161,7 +161,7 @@ impl<'a> Transaction<'a> {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Convert the range to bytes
|
||||
|
|
|
@ -44,7 +44,7 @@ impl<'a> Transaction<'a> {
|
|||
// Cancel a transaction
|
||||
pub fn cancel(&mut self) -> Result<(), Error> {
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Mark this transaction as done
|
||||
|
@ -57,11 +57,11 @@ impl<'a> Transaction<'a> {
|
|||
// Commit a transaction
|
||||
pub fn commit(&mut self) -> Result<(), Error> {
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Mark this transaction as done
|
||||
|
@ -77,11 +77,11 @@ impl<'a> Transaction<'a> {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Remove the key
|
||||
|
@ -95,7 +95,7 @@ impl<'a> Transaction<'a> {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check the key
|
||||
|
@ -109,7 +109,7 @@ impl<'a> Transaction<'a> {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Get the key
|
||||
|
@ -124,11 +124,11 @@ impl<'a> Transaction<'a> {
|
|||
V: Into<Val>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Set the key
|
||||
|
@ -143,11 +143,11 @@ impl<'a> Transaction<'a> {
|
|||
V: Into<Val>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Set the key
|
||||
|
@ -161,7 +161,7 @@ impl<'a> Transaction<'a> {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Convert the range to bytes
|
||||
|
|
|
@ -56,7 +56,7 @@ impl Transaction {
|
|||
// Cancel a transaction
|
||||
pub async fn cancel(&mut self) -> Result<(), Error> {
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Mark this transaction as done
|
||||
|
@ -69,11 +69,11 @@ impl Transaction {
|
|||
// Commit a transaction
|
||||
pub async fn commit(&mut self) -> Result<(), Error> {
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Mark this transaction as done
|
||||
|
@ -89,11 +89,11 @@ impl Transaction {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Delete the key
|
||||
|
@ -107,7 +107,7 @@ impl Transaction {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check the key
|
||||
|
@ -121,7 +121,7 @@ impl Transaction {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Get the key
|
||||
|
@ -136,11 +136,11 @@ impl Transaction {
|
|||
V: Into<Val>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Set the key
|
||||
|
@ -155,11 +155,11 @@ impl Transaction {
|
|||
V: Into<Val>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Check to see if transaction is writable
|
||||
if self.rw {
|
||||
if self.rw == false {
|
||||
return Err(Error::TxReadonlyError);
|
||||
}
|
||||
// Set the key
|
||||
|
@ -173,7 +173,7 @@ impl Transaction {
|
|||
K: Into<Key>,
|
||||
{
|
||||
// Check to see if transaction is closed
|
||||
if self.ok {
|
||||
if self.ok == true {
|
||||
return Err(Error::TxFinishedError);
|
||||
}
|
||||
// Convert the range to bytes
|
||||
|
|
Loading…
Reference in a new issue