diff --git a/src/lib/be/mod.rs b/src/lib/be/mod.rs index 3af27bd94..ffdae642a 100644 --- a/src/lib/be/mod.rs +++ b/src/lib/be/mod.rs @@ -349,39 +349,41 @@ impl BackendWriteTransaction { entries: &Vec>, ) -> Result<(), BackendError> { // Perform a search for the entries --> This is a problem for the caller + audit_segment!(au, || { - if entries.is_empty() { - // TODO: Better error - return Err(BackendError::EmptyRequest); - } + if entries.is_empty() { + // TODO: Better error + return Err(BackendError::EmptyRequest); + } - // Assert the Id's exist on the entry. - let id_list: Vec = entries.iter().filter_map(|entry| entry.id).collect(); + // Assert the Id's exist on the entry. + let id_list: Vec = entries.iter().filter_map(|entry| entry.id).collect(); - // Simple: If the list of id's is not the same as the input list, we are missing id's - // TODO: This check won't be needed once I rebuild the entry state types. - if entries.len() != id_list.len() { - return Err(BackendError::EntryMissingId); - } + // Simple: If the list of id's is not the same as the input list, we are missing id's + // TODO: This check won't be needed once I rebuild the entry state types. + if entries.len() != id_list.len() { + return Err(BackendError::EntryMissingId); + } - // Now, given the list of id's, delete them. - { - // SQL doesn't say if the thing "does or does not exist anymore". As a result, - // two deletes is a safe and valid operation. Given how we allocate ID's we are - // probably okay with this. + // Now, given the list of id's, delete them. + { + // SQL doesn't say if the thing "does or does not exist anymore". As a result, + // two deletes is a safe and valid operation. Given how we allocate ID's we are + // probably okay with this. - // TODO: ACTUALLY HANDLE THIS ERROR WILLIAM YOU LAZY SHIT. - let mut stmt = self - .conn - .prepare("DELETE FROM id2entry WHERE id = :id") - .unwrap(); + // TODO: ACTUALLY HANDLE THIS ERROR WILLIAM YOU LAZY SHIT. + let mut stmt = self + .conn + .prepare("DELETE FROM id2entry WHERE id = :id") + .unwrap(); - id_list.iter().for_each(|id| { - stmt.execute(&[id]).unwrap(); - }); - } + id_list.iter().for_each(|id| { + stmt.execute(&[id]).unwrap(); + }); + } - Ok(()) + Ok(()) + }) } pub fn backup(&self) -> Result<(), BackendError> { @@ -422,7 +424,7 @@ impl BackendWriteTransaction { } } - pub fn setup(&self, audit: &mut AuditScope) -> Result<(), ()> { + pub fn setup(&self, audit: &mut AuditScope) -> Result<(), OperationError> { { // self.conn.execute("BEGIN TRANSACTION", NO_PARAMS).unwrap(); @@ -511,8 +513,10 @@ impl Backend { // Now complete our setup with a txn let r = { let be_txn = be.write(); - be_txn.setup(audit); - be_txn.commit() + be_txn.setup(audit) + .and_then(|_| { + be_txn.commit() + }) }; audit_log!(audit, "be new setup: {:?}", r); diff --git a/src/lib/filter.rs b/src/lib/filter.rs index 7cdec9d0e..fea392ea4 100644 --- a/src/lib/filter.rs +++ b/src/lib/filter.rs @@ -124,7 +124,7 @@ impl Filter { let attr_norm = schema_name.normalise_value(attr); // Now check it exists match schema_attributes.get(&attr_norm) { - Some(schema_a) => { + Some(_attr_name) => { // Return our valid data Ok(Filter::Pres(attr_norm)) } diff --git a/src/lib/server.rs b/src/lib/server.rs index 5584093db..1764f9508 100644 --- a/src/lib/server.rs +++ b/src/lib/server.rs @@ -82,9 +82,11 @@ pub fn start(log: actix::Addr, path: &str, threads: usize) -> Result {} Err(e) => return Err(e), }; @@ -838,7 +840,7 @@ impl<'a> QueryServerWriteTransaction<'a> { audit_log!(audit, "Generated modlist -> {:?}", modlist); self.internal_modify(audit, filt, modlist) } - Err(e) => { + Err(_e) => { unimplemented!() // No action required. }