very fast at protocol indexer with flexible filtering, xrpc queries, cursor-backed event stream, and more, built on fjall
rust fjall at-protocol atproto indexer
58
fork

Configure Feed

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

[lib,api] return account count when querying host status

dawn 26b126d1 9af943f2

+18 -2
+1 -1
src/api/xrpc/get_host_status.rs
··· 20 20 }; 21 21 22 22 Ok(Json(GetHostStatusOutput { 23 - account_count: None, 23 + account_count: Some(host.account_count as i64), 24 24 hostname: CowStr::Owned(host.name), 25 25 seq: Some(host.seq), 26 26 status: None,
+1 -1
src/api/xrpc/list_hosts.rs
··· 25 25 hostname: CowStr::Owned(h.name), 26 26 seq: Some(h.seq), 27 27 status: None, 28 - account_count: None, 28 + account_count: Some(h.account_count as i64), 29 29 extra_data: None, 30 30 }) 31 31 .collect(),
+12
src/control/mod.rs
··· 57 57 58 58 /// infromation about a host hydrant is consuming from. 59 59 pub struct Host { 60 + /// hostname of the host. 60 61 pub name: SmolStr, 62 + /// latest seq hydrant has processed from this host. 61 63 pub seq: i64, 64 + /// the amount of accounts hydrant has seen from this host. 65 + pub account_count: u64, 62 66 } 63 67 64 68 /// an event emitted by the hydrant event stream. ··· 789 793 .into_diagnostic() 790 794 .wrap_err("cursor value is not 8 bytes")?, 791 795 ); 796 + let account_count = state 797 + .db 798 + .get_count_sync(&keys::pds_account_count_key(&hostname)); 792 799 793 800 Ok(Some(Host { 794 801 name: hostname.into(), 795 802 seq, 803 + account_count, 796 804 })) 797 805 }) 798 806 .await ··· 839 847 .into_diagnostic() 840 848 .wrap_err("cursor value is not 8 bytes")?, 841 849 ); 850 + let account_count = state 851 + .db 852 + .get_count_sync(&keys::pds_account_count_key(hostname)); 842 853 hosts.push(Host { 843 854 name: hostname.into(), 844 855 seq, 856 + account_count, 845 857 }); 846 858 } 847 859
+4
src/db/mod.rs
··· 747 747 .await 748 748 .unwrap_or(0) 749 749 } 750 + 751 + pub fn get_count_sync(&self, key: &str) -> u64 { 752 + self.counts_map.read_sync(key, |_, v| *v).unwrap_or(0) 753 + } 750 754 } 751 755 752 756 #[cfg(feature = "indexer")]