pub fn add_transaction_ops(&mut self, add_ops: TransactionOps) -> Result<(), CoordError> {
        match &mut self.transaction {
            TransactionStatus::Started(Transaction { ops, access, .. })
            | TransactionStatus::InTransaction(Transaction { ops, access, .. })
            | TransactionStatus::InTransactionImplicit(Transaction { ops, access, .. }) => {
                match ops {
                    TransactionOps::None => {
                        if matches!(access, Some(TransactionAccessMode::ReadOnly))
                            && matches!(add_ops, TransactionOps::Writes(_))
                        {
                            return Err(CoordError::ReadOnlyTransaction);
                        }
                        *ops = add_ops;
                    }
                    TransactionOps::Peeks(txn_ts) => match add_ops {
                        TransactionOps::Peeks(add_ts) => {
                            assert_eq!(*txn_ts, add_ts);
                        }
                        _ => return Err(CoordError::ReadOnlyTransaction),
                    },
                    TransactionOps::Tail => return Err(CoordError::TailOnlyTransaction),
                    TransactionOps::Writes(txn_writes) => match add_ops {
                        TransactionOps::Writes(mut add_writes) => {
                            // We should have already checked the access above, but make sure we don't miss
                            // it anyway.
                            assert!(!matches!(access, Some(TransactionAccessMode::ReadOnly)));
                            txn_writes.append(&mut add_writes);
                        }
                        _ => {
                            return Err(CoordError::WriteOnlyTransaction);
                        }
                    },
                }
            }
            TransactionStatus::Default | TransactionStatus::Failed(_) => {
                unreachable!()
            }
        }
        Ok(())
    }
/// Adds operations to the current transaction. An error is produced if they
/// cannot be merged (i.e., a read cannot be merged to an insert).
Adds operations to the current transaction. An error is produced if they
cannot be merged .
Adds operations to the current transaction . An error is produced if they cannot be merged .
pub fn add_transaction_ops(&mut self, add_ops: TransactionOps) -> Result<(), CoordError> {
        match &mut self.transaction {
            TransactionStatus::Started(Transaction { ops, access, .. })
            | TransactionStatus::InTransaction(Transaction { ops, access, .. })
            | TransactionStatus::InTransactionImplicit(Transaction { ops, access, .. }) => {
                match ops {
                    TransactionOps::None => {
                        if matches!(access, Some(TransactionAccessMode::ReadOnly))
                            && matches!(add_ops, TransactionOps::Writes(_))
                        {
                            return Err(CoordError::ReadOnlyTransaction);
                        }
                        *ops = add_ops;
                    }
                    TransactionOps::Peeks(txn_ts) => match add_ops {
                        TransactionOps::Peeks(add_ts) => {
                            assert_eq!(*txn_ts, add_ts);
                        }
                        _ => return Err(CoordError::ReadOnlyTransaction),
                    },
                    TransactionOps::Tail => return Err(CoordError::TailOnlyTransaction),
                    TransactionOps::Writes(txn_writes) => match add_ops {
                        TransactionOps::Writes(mut add_writes) => {
                            // We should have already checked the access above, but make sure we don't miss
                            // it anyway.
                            assert!(!matches!(access, Some(TransactionAccessMode::ReadOnly)));
                            txn_writes.append(&mut add_writes);
                        }
                        _ => {
                            return Err(CoordError::WriteOnlyTransaction);
                        }
                    },
                }
            }
            TransactionStatus::Default | TransactionStatus::Failed(_) => {
                unreachable!()
            }
        }
        Ok(())
    }
pub fn add_transaction_ops ( & mut self , add_ops : TransactionOps ) -> Result < ( ) , CoordError > { match & mut self . transaction { TransactionStatus :: Started ( Transaction { ops , access , .. } ) | TransactionStatus :: InTransaction ( Transaction { ops , access , .. } ) | TransactionStatus :: InTransactionImplicit ( Transaction { ops , access , .. } ) => { match ops { TransactionOps :: None => { if matches ! ( access Some ( TransactionAccessMode ReadOnly ) ) && matches ! ( add_ops TransactionOps Writes ( ) ) { return Err ( CoordError :: ReadOnlyTransaction ) ; } * ops = add_ops ; } TransactionOps :: Peeks ( txn_ts ) => match add_ops { TransactionOps :: Peeks ( add_ts ) => { assert_eq ! ( txn_ts add_ts ) ; } _ => return Err ( CoordError :: ReadOnlyTransaction ) , } , TransactionOps :: Tail => return Err ( CoordError :: TailOnlyTransaction ) , TransactionOps :: Writes ( txn_writes ) => match add_ops { TransactionOps :: Writes ( mut add_writes ) => { // We should have already checked the access above, but make sure we don't miss // it anyway. assert ! ( matches ( access Some ( TransactionAccessMode ReadOnly ) ) ) ; txn_writes . append ( & mut add_writes ) ; } _ => { return Err ( CoordError :: WriteOnlyTransaction ) ; } } , } } TransactionStatus :: Default | TransactionStatus :: Failed ( _ ) => { unreachable ! ( ) } } Ok ( ( ) ) }
Adds operations to the current transaction.
Adds operations to the current transaction .
&mut self
add_ops
TransactionOps
&mut self
add_ops
TransactionOps