Fast and robust atproto CAR file processing in rust
14
fork

Configure Feed

Select the types of activity you want to include in your feed.

or error value might be enough

phil e758674a 8ef1666c

+9 -9
+4 -4
src/mst.rs
··· 56 56 } 57 57 58 58 #[derive(Debug, Clone)] 59 - pub(crate) struct NodeThing { 60 - pub(crate) cid: Cid, 61 - pub(crate) kind: ThingKind, 59 + pub struct NodeThing { 60 + pub cid: Cid, 61 + pub kind: ThingKind, 62 62 } 63 63 64 64 #[derive(Debug, Clone)] 65 - pub(crate) enum ThingKind { 65 + pub enum ThingKind { 66 66 Tree, 67 67 Value { rkey: Rkey }, 68 68 }
+5 -5
src/walk.rs
··· 16 16 MstError(#[from] MstError), 17 17 #[error("storage error: {0}")] 18 18 StorageError(#[from] fjall::Error), 19 - #[error("block not found: {0}")] 20 - MissingBlock(Cid), 19 + #[error("block not found: {0:?}")] 20 + MissingBlock(NodeThing), 21 21 } 22 22 23 23 /// Errors from invalid Rkeys ··· 143 143 ) -> Result<Step, WalkError> { 144 144 while let Some(NodeThing { cid, kind }) = self.next_todo() { 145 145 let Some(mpb) = blocks.get(&cid) else { 146 - return Err(WalkError::MissingBlock(cid)); 146 + return Err(WalkError::MissingBlock(NodeThing { cid, kind })); 147 147 }; 148 148 if let Some(out) = self.mpb_step(kind, cid, mpb, &process)? { 149 149 return Ok(Step::Value(out)); ··· 189 189 ant.mpb_step(kind, cid, mpb, noop)?; 190 190 } 191 191 (ThingKind::Tree, None) => { 192 - return Err(WalkError::MissingBlock(cid)); 192 + return Err(WalkError::MissingBlock(NodeThing { cid, kind })); 193 193 } 194 194 } 195 195 } ··· 203 203 ) -> Result<Step, WalkError> { 204 204 while let Some(NodeThing { cid, kind }) = self.next_todo() { 205 205 let Some(block_slice) = blocks.get(&cid.to_bytes())? else { 206 - return Err(WalkError::MissingBlock(cid)); 206 + return Err(WalkError::MissingBlock(NodeThing { cid, kind })); 207 207 }; 208 208 let mpb = MaybeProcessedBlock::from_bytes(block_slice.to_vec()); 209 209 if let Some(out) = self.mpb_step(kind, cid, &mpb, &process)? {