mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix bug in dict delete.
also soften a journal fault message to help with debugging. that it no longer panics does not mean it is right...
This commit is contained in:
parent
18b7cf78df
commit
ae0b1f1288
3 changed files with 21 additions and 2 deletions
|
|
@ -822,7 +822,8 @@ impl PddbOs {
|
|||
self.fspace_cache.replace(pp);
|
||||
} else if pp.journal() == prev_pp.journal() {
|
||||
log::error!("got two identical journal revisions -- this shouldn't happen, prev: {:?}, candidate: {:?}", prev_pp, pp);
|
||||
panic!("Inconsistent FSCB state");
|
||||
log::error!("replacing the previous version with the candidate, but this might not be the right decision!");
|
||||
self.fspace_cache.replace(pp);
|
||||
}
|
||||
} else {
|
||||
log::warn!("Strange...we have a journal entry for a free space page that isn't already in our cache. Guru meditation: {:?}", pp);
|
||||
|
|
|
|||
|
|
@ -437,7 +437,7 @@ impl Pddb {
|
|||
};
|
||||
let mut buf = Buffer::into_buf(request)
|
||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
||||
buf.lend_mut(self.conn, Opcode::DeleteKey.to_u32().unwrap())
|
||||
buf.lend_mut(self.conn, Opcode::DeleteDict.to_u32().unwrap())
|
||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
||||
|
||||
let response = buf.to_original::<PddbKeyRequest, _>().unwrap();
|
||||
|
|
@ -448,6 +448,23 @@ impl Pddb {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn sync(&mut self) -> Result<()> {
|
||||
let response = send_message(
|
||||
self.conn,
|
||||
Message::new_blocking_scalar(Opcode::WriteKeyFlush.to_usize().unwrap(), 0, 0, 0, 0)
|
||||
).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
||||
if let xous::Result::Scalar1(rcode) = response {
|
||||
match FromPrimitive::from_u8(rcode as u8) {
|
||||
Some(PddbRetcode::Ok) => Ok(()),
|
||||
Some(PddbRetcode::BasisLost) => Err(Error::new(ErrorKind::BrokenPipe, "Basis lost")),
|
||||
Some(PddbRetcode::DiskFull) => Err(Error::new(ErrorKind::OutOfMemory, "Out of disk space, some data lost on sync")),
|
||||
_ => Err(Error::new(ErrorKind::Interrupted, "Flush failed for unspecified reasons")),
|
||||
}
|
||||
} else {
|
||||
Err(Error::new(ErrorKind::Other, "Xous internal error"))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn list_keys(&mut self, dict_name: &str, basis_name: Option<&str>) -> Result<Vec::<String>> {
|
||||
if dict_name.len() > (DICT_NAME_LEN - 1) {
|
||||
return Err(Error::new(ErrorKind::InvalidInput, "dictionary name too long"));
|
||||
|
|
|
|||
|
|
@ -830,6 +830,7 @@ fn xmain() -> ! {
|
|||
None
|
||||
};
|
||||
let dict = req.dict.as_str().expect("dict utf-8 decode error");
|
||||
log::debug!("attempting to remove dict {} basis {:?}", dict, bname);
|
||||
match basis_cache.dict_remove(&mut pddb_os, dict, bname, false) {
|
||||
Ok(_) => {
|
||||
let mut evict_list = Vec::<ApiToken>::new();
|
||||
|
|
|
|||
Loading…
Reference in a new issue