(
&mut self,
tile_id: TileId,
kind: TileKind,
payload: &[u8],
mbr: crate::tile::mbr::TileMBR,
)
| 47 | } |
| 48 | |
| 49 | fn append_framed( |
| 50 | &mut self, |
| 51 | tile_id: TileId, |
| 52 | kind: TileKind, |
| 53 | payload: &[u8], |
| 54 | mbr: crate::tile::mbr::TileMBR, |
| 55 | ) -> ArrayResult<()> { |
| 56 | if let Some(last) = self.entries.last() |
| 57 | && tile_id <= last.tile_id |
| 58 | { |
| 59 | return Err(ArrayError::SegmentCorruption { |
| 60 | detail: format!( |
| 61 | "tile IDs not strictly monotonic ascending: \ |
| 62 | prev=({},{}) new=({},{})", |
| 63 | last.tile_id.hilbert_prefix, |
| 64 | last.tile_id.system_from_ms, |
| 65 | tile_id.hilbert_prefix, |
| 66 | tile_id.system_from_ms, |
| 67 | ), |
| 68 | }); |
| 69 | } |
| 70 | let offset = self.buf.len() as u64; |
| 71 | let framed_len = BlockFraming::encode(payload, &mut self.buf); |
| 72 | self.entries.push(TileEntry::new( |
| 73 | tile_id, |
| 74 | kind, |
| 75 | offset, |
| 76 | framed_len as u32, |
| 77 | mbr, |
| 78 | )); |
| 79 | Ok(()) |
| 80 | } |
| 81 | |
| 82 | pub fn tile_count(&self) -> usize { |
| 83 | self.entries.len() |
no test coverage detected