preserve watches

This commit is contained in:
Christien Rioux 2024-02-22 11:21:51 -05:00
parent 14dc402356
commit 019cb5fd79
2 changed files with 12 additions and 7 deletions

View File

@ -354,7 +354,12 @@ impl StorageManagerInner {
// Write open record
self.opened_records
.insert(key, OpenedRecord::new(writer, safety_selection));
.entry(key)
.and_modify(|e| {
e.set_writer(writer);
e.set_safety_selection(safety_selection);
})
.or_insert_with(|| OpenedRecord::new(writer, safety_selection));
// Make DHT Record Descriptor to return
let descriptor = DHTRecordDescriptor::new(key, owner, owner_secret, schema);

View File

@ -42,16 +42,16 @@ impl OpenedRecord {
pub fn writer(&self) -> Option<&KeyPair> {
self.writer.as_ref()
}
// pub fn set_writer(&mut self, writer: Option<KeyPair>) {
// self.writer = writer;
// }
pub fn set_writer(&mut self, writer: Option<KeyPair>) {
self.writer = writer;
}
pub fn safety_selection(&self) -> SafetySelection {
self.safety_selection
}
// pub fn set_safety_selection(&mut self, safety_selection: SafetySelection) {
// self.safety_selection = safety_selection;
// }
pub fn set_safety_selection(&mut self, safety_selection: SafetySelection) {
self.safety_selection = safety_selection;
}
pub fn set_active_watch(&mut self, active_watch: ActiveWatch) {
self.active_watch = Some(active_watch);