Insert an object into the map. If `write` is true and there is a batch started, write the object into the batch as well as into the memory map.
(&mut self, oid1: &ObjectID, oid2: &ObjectID, kind: MapType, write: bool)
| 586 | /// If `write` is true and there is a batch started, write the object into the batch as well as |
| 587 | /// into the memory map. |
| 588 | pub fn insert(&mut self, oid1: &ObjectID, oid2: &ObjectID, kind: MapType, write: bool) { |
| 589 | let (compat_oid, storage_oid) = |
| 590 | if HashAlgorithm::from_u32(oid1.algo) == Some(self.mem.compat) { |
| 591 | (oid1, oid2) |
| 592 | } else { |
| 593 | (oid2, oid1) |
| 594 | }; |
| 595 | Self::insert_into(&mut self.mem, storage_oid, compat_oid, kind); |
| 596 | if write { |
| 597 | if let Some(ref mut batch) = self.batch { |
| 598 | Self::insert_into(batch, storage_oid, compat_oid, kind); |
| 599 | } |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | fn insert_into( |
| 604 | map: &mut ObjectMemoryMap, |
no outgoing calls