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.

fix panic on multi-root car, clean public exports

phil 5f249f1f c3c8a55a

+5 -4
+1 -1
src/lib.rs
··· 82 82 pub use disk::{DiskBuilder, DiskDriver, DiskError, DiskStore, DriveError}; 83 83 pub use mem::{DriverBuilder, LoadError, MemCar, PartialCar}; 84 84 pub use mst::Commit; 85 - pub use walk::{Output, WalkError, WalkItem, noop}; 85 + pub use walk::{MstError, Output, WalkError, WalkItem, noop}; 86 86 87 87 pub type Bytes = Vec<u8>; 88 88
+4 -3
src/mem.rs
··· 109 109 let mut car = CarReader::new(reader).await?; 110 110 111 111 let roots = car.header().roots(); 112 - assert_eq!(roots.len(), 1); 113 - 114 112 let root = *roots.first().ok_or(LoadError::MissingRoot)?; 113 + if roots.len() > 1 { 114 + log::debug!("CAR has {} roots; ignoring all but the first", roots.len()); 115 + } 115 116 log::debug!("root: {root:?}"); 116 117 117 118 let mut commit = None; ··· 172 173 /// `None` if this slice (or full CAR) starts from the leftmost record in the tree. 173 174 /// Not set automatically — callers may derive it from leading `MissingRecord` items. 174 175 pub prev_key: Option<RepoPath>, 175 - pub blocks: HashMap<ObjectLink, MaybeProcessedBlock>, 176 + pub(crate) blocks: HashMap<ObjectLink, MaybeProcessedBlock>, 176 177 walker: Walker, 177 178 process: fn(Bytes) -> Bytes, 178 179 }