MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / query_count

Method query_count

nodedb/tests/wal_catchup.rs:101–126  ·  view source on GitHub ↗
(&self, collection: &str)

Source from the content-addressed store, hash-verified

99 }
100
101 async fn query_count(&self, collection: &str) -> u64 {
102 let resp = self
103 .dispatch(
104 PhysicalPlan::Timeseries(TimeseriesOp::Scan {
105 collection: collection.to_string(),
106 time_range: (0, i64::MAX),
107 projection: Vec::new(),
108 limit: usize::MAX,
109 filters: Vec::new(),
110 bucket_interval_ms: 0,
111 group_by: Vec::new(),
112 aggregates: vec![("count".into(), "*".into())],
113 gap_fill: String::new(),
114 rls_filters: Vec::new(),
115 system_as_of_ms: None,
116 valid_at_ms: None,
117 computed_columns: Vec::new(),
118 }),
119 collection,
120 )
121 .await;
122 resp.as_array()
123 .and_then(|a| a.first())
124 .and_then(|r| r["count(*)"].as_u64())
125 .unwrap_or(0)
126 }
127
128 fn write_to_wal(&self, collection: &str, payload: Vec<u8>) {
129 let wal_payload = zerompk::to_msgpack_vec(&(collection.to_string(), payload)).unwrap();

Calls 5

to_stringMethod · 0.80
as_arrayMethod · 0.80
firstMethod · 0.80
dispatchMethod · 0.45
as_u64Method · 0.45

Tested by

no test coverage detected