tracks lexicons and how many times they appeared on the jetstream

feat(server): add cmd to print all hits

ptr.pet ff50dac5 f4563532

verified
Changed files
+19
server
src
+19
server/src/main.rs
··· 53 53 debug(); 54 54 return; 55 55 } 56 + Some("print") => { 57 + print_all(); 58 + return; 59 + } 56 60 Some(x) => { 57 61 tracing::error!("unknown command: {}", x); 58 62 return; ··· 205 209 ingest_events.join().expect("failed to join ingest events"); 206 210 db_task.await.expect("cant join db task"); 207 211 db.sync(true).expect("cant sync db"); 212 + } 213 + 214 + fn print_all() { 215 + let db = Db::new(DbConfig::default(), CancellationToken::new()).expect("couldnt create db"); 216 + let nsids = db.get_nsids().collect::<Vec<_>>(); 217 + let mut count = 0_usize; 218 + for nsid in nsids { 219 + println!("{}:", nsid.deref()); 220 + for hit in db.get_hits(&nsid, .., usize::MAX) { 221 + let hit = hit.expect("aaa"); 222 + println!("{} {}", hit.timestamp, hit.deser().unwrap().deleted); 223 + count += 1; 224 + } 225 + } 226 + println!("total hits: {}", count); 208 227 } 209 228 210 229 fn debug() {