Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
0

Configure Feed

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

error logging for encoding stuff (and clippy)

+15 -9
+4 -3
ufos/src/bin/analyze.rs
··· 6 6 use std::path::PathBuf; 7 7 use ufos::db_types::{db_complete, DbBytes}; 8 8 use ufos::store_types::{ 9 - AllTimeRollupKey, AllTimeRollupStaticPrefix, CountsValue, WeekTruncatedCursor, 10 - WeeklyRollupKey, WeeklyRollupStaticPrefix, WithCollection, 9 + AllTimeRollupKey, AllTimeRollupStaticPrefix, CountsValue, WeekTruncatedCursor, WeeklyRollupKey, 10 + WeeklyRollupStaticPrefix, WithCollection, 11 11 }; 12 12 13 13 #[derive(Parser)] ··· 69 69 70 70 /// Scan weekly rollups once, returning week -> (merged sketch, per-group entries) 71 71 /// Only non-excluded groups are included. 72 + #[expect(clippy::type_complexity)] 72 73 fn scan_weekly( 73 74 rollups: &PartitionHandle, 74 75 ) -> anyhow::Result<BTreeMap<u64, (Sketch<14>, Vec<(String, u64)>)>> { ··· 94 95 } 95 96 96 97 scanned += 1; 97 - if scanned % 500_000 == 0 { 98 + if scanned.is_multiple_of(500_000) { 98 99 eprintln!(" ...scanned {scanned} weekly entries"); 99 100 } 100 101 }
+3 -3
ufos/src/error.rs
··· 28 28 InitError(String), 29 29 #[error("DB seems to be in a bad state: {0}")] 30 30 BadStateError(String), 31 - #[error("Fjall error")] 31 + #[error("Fjall error: {0}")] 32 32 FjallError(#[from] fjall::Error), 33 - #[error("LSM-tree error (from fjall)")] 33 + #[error("LSM-tree error (from fjall): {0}")] 34 34 FjallLsmError(#[from] fjall::LsmError), 35 - #[error("Bytes encoding error")] 35 + #[error("Bytes encoding error: {0}")] 36 36 EncodingError(#[from] EncodingError), 37 37 #[error("If you ever see this, there's a bug in the code. The error was stolen")] 38 38 Stolen,
+8 -3
ufos/src/storage_fjall.rs
··· 1205 1205 1206 1206 let mut dirty_nsids = HashSet::new(); 1207 1207 1208 - #[derive(Eq, Hash, PartialEq)] 1208 + #[derive(Debug, Eq, Hash, PartialEq)] 1209 1209 enum Rollup { 1210 1210 Hourly(HourTruncatedCursor), 1211 1211 Weekly(WeekTruncatedCursor), ··· 1235 1235 dirty_nsids.insert(key.collection().clone()); 1236 1236 1237 1237 batch.remove(&self.rollups, key_bytes); 1238 - let val = db_complete::<CountsValue>(&val_bytes)?; 1238 + let val = db_complete::<CountsValue>(&val_bytes).inspect_err(|e| { 1239 + log::error!("bad CountsValue at {key:?} from rolling up timelies: {e}") 1240 + })?; 1239 1241 counts_by_rollup 1240 1242 .entry(( 1241 1243 key.collection().clone(), ··· 1275 1277 .get(&rollup_key_bytes)? 1276 1278 .as_deref() 1277 1279 .map(db_complete::<CountsValue>) 1278 - .transpose()? 1280 + .transpose() 1281 + .inspect_err(|e| { 1282 + log::error!("bad CountsValue at {nsid:?}/{rollup:?} from counts_by_rollup: {e}") 1283 + })? 1279 1284 .unwrap_or_default(); 1280 1285 1281 1286 // now that we have values, we can know the exising ranks