cleanup
This commit is contained in:
parent
21df9a9340
commit
dbb1105741
@ -57,37 +57,6 @@ impl<'a, T, EG: EntityGateway> ItemTransaction<'a, T, EG> {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn act<U>(mut self, action: fn(&mut ItemTransactionActions<EG>, &T) -> Result<U, E>) -> ItemTransaction<'a, U, E, EG> {
|
||||
if self.error.is_none() {
|
||||
let k = action(&mut self.actions, &self.prev.unwrap());
|
||||
match k {
|
||||
Ok(k) => {
|
||||
ItemTransaction {
|
||||
error: None,
|
||||
prev: Some(k),
|
||||
actions: self.actions,
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
ItemTransaction {
|
||||
error: Some(err),
|
||||
prev: None,
|
||||
actions: self.actions,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ItemTransaction {
|
||||
error: self.error,
|
||||
prev: None,
|
||||
actions: self.actions,
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
pub fn act<E: std::fmt::Debug, U>(mut self, action: fn(&mut ItemTransactionActions<EG>, &T) -> Result<U, E>) -> FinalizedItemTransaction<U, E, EG> {
|
||||
match action(&mut self.actions, &self.data) {
|
||||
Ok(k) => {
|
||||
@ -104,16 +73,6 @@ impl<'a, T, EG: EntityGateway> ItemTransaction<'a, T, EG> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn finalize(self) -> FinalizedItemTransaction<T, E, EG> {
|
||||
FinalizedItemTransaction {
|
||||
error: self.error,
|
||||
prev: self.prev,
|
||||
action_queue: self.actions.action_queue,
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -137,8 +96,6 @@ impl<T, E: std::fmt::Debug, EG: EntityGateway> FinalizedItemTransaction<T, E, EG
|
||||
Ok(value) => {
|
||||
for action in self.action_queue.into_iter() {
|
||||
// TODO: better handle rolling back if this ever errors out
|
||||
//let result = action.item_action(item_manager).await.map_err(|err| TransactionError::Commit(err.into()))?;
|
||||
//action.gateway_action(entity_gateway, result).await.map_err(|err| TransactionError::Commit(err.into()))?;
|
||||
action.commit(item_manager, entity_gateway).await.map_err(|err| TransactionError::Commit(err))?;
|
||||
}
|
||||
Ok(value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user