···219219 linking_records,
220220 })
221221 }
222222-223223- fn summarize(&self, qsize: u32) {
224224- let data = self.0.lock().unwrap();
225225- let dids = data.dids.len();
226226- let targets = data.targets.len();
227227- let target_paths: usize = data.targets.values().map(|paths| paths.len()).sum();
228228- let links = data.links.len();
229229-230230- let sample_target = data.targets.keys().nth(data.targets.len() / 2);
231231- let sample_path = sample_target.and_then(|t| data.targets.get(t).unwrap().keys().next());
232232- println!("queue: {qsize}. {dids} dids, {targets} targets from {target_paths} paths, {links} links. sample: {sample_target:?} {sample_path:?}");
233233- }
234222}
235223236224#[derive(Debug, PartialEq, Hash, Eq, Clone)]
+3-8
link_aggregator/src/storage/mod.rs
···2121pub struct StorageStats {
2222 /// estimate of how many accounts we've seen create links. the _subjects_ of any links are not represented here.
2323 /// for example: new user A follows users B and C. this count will only increment by one, for A.
2424- dids: u64,
2424+ pub dids: u64,
25252626 /// estimate targets * distinct (collection, path)s to reference them.
2727 /// distinct targets alone are currently challenging to estimate.
2828- targetables: u64,
2828+ pub targetables: u64,
29293030 /// estimate of the count of atproto records seen that contain links.
3131 /// records with multiple links are single-counted.
3232 /// for LSM stores, deleted links don't decrement this, and updated records with any links will likely increment it.
3333- linking_records: u64,
3333+ pub linking_records: u64,
3434}
35353636pub trait LinkStorage: Send + Sync {
···61616262 /// assume all stats are estimates, since exact counts are very challenging for LSMs
6363 fn get_stats(&self) -> Result<StorageStats>;
6464-6565- // todo: remove it
6666- fn summarize(&self, qsize: u32) {
6767- println!("queue: {qsize}");
6868- }
6964}
70657166#[cfg(test)]