migrating to fsstore works

This commit is contained in:
Sebastian Moser
2024-06-16 17:44:20 +02:00
parent 5213dd156e
commit 7340aaa37a
8 changed files with 64 additions and 18 deletions

View File

@@ -57,7 +57,7 @@ impl Instance {
instance.init();
debug!("instance inited with conifg: {}", instance.get("0/config")?.as_data_full()?);
debug!("instance inited with config: {}", instance.get("0/config")?.as_data_full()?);
return Ok(instance);
}
@@ -85,15 +85,18 @@ impl Instance {
debug!("overwriting instance config again with the one passed to Instance::with_config()");
instance.set("0", config);
//debug!("instance inited with conifg: {}", instance.get("0/config")?);
debug!("instance inited with conifg: no");
debug!("instance inited with conifg: {}", instance.get("0/config")?);
Ok(instance)
}
pub fn migrate_to_store(&mut self, new_store: Box<dyn Store>) -> MizeResult<()> {
println!("MIGRATING");
let old_store = &self.store;
let inst_data = self.store.get_value_data_full(self.id_from_string("0".to_owned()))?;
new_store.set(self.id_from_string("0".to_owned()), inst_data.to_owned())?;
for id in old_store.id_iter()? {
let data = self.store.get_value_data_full(self.id_from_string(id?))?;