diff --git a/constellation/src/server/mod.rs b/constellation/src/server/mod.rs --- a/constellation/src/server/mod.rs +++ b/constellation/src/server/mod.rs @@ -274,10 +274,6 @@ .get_links(&query.target, &query.collection, &query.path, limit, until) .map_err(|_| http::StatusCode::INTERNAL_SERVER_ERROR)?; - let total = store - .get_count(&query.target, &query.collection, &query.path) - .map_err(|_| http::StatusCode::INTERNAL_SERVER_ERROR)?; - let cursor = paged.next.map(|next| { ApiCursor { version: paged.version, @@ -289,7 +285,7 @@ Ok(acceptable( accept, GetLinkItemsResponse { - total: total, + total: paged.total, linking_records: paged.items, cursor, query: (*query).clone(), @@ -339,12 +335,6 @@ .get_distinct_dids(&query.target, &query.collection, &query.path, limit, until) .map_err(|_| http::StatusCode::INTERNAL_SERVER_ERROR)?; - let distinct_dids_total = store - .get_distinct_did_count(&query.target, &query.collection, &query.path) - .map_err(|_| http::StatusCode::INTERNAL_SERVER_ERROR)?; - - - let cursor = paged.next.map(|next| { ApiCursor { version: paged.version, @@ -356,7 +346,7 @@ Ok(acceptable( accept, GetDidItemsResponse { - total: distinct_dids_total, + total: paged.total, linking_dids: paged.items, cursor, query: (*query).clone(), diff --git a/constellation/src/storage/mem_store.rs b/constellation/src/storage/mem_store.rs --- a/constellation/src/storage/mem_store.rs +++ b/constellation/src/storage/mem_store.rs @@ -173,6 +173,7 @@ version: (0, 0), items: Vec::new(), next: None, + total: 0, }); }; let Some(did_rkeys) = paths.get(&Source::new(collection, path)) else { @@ -180,6 +181,7 @@ version: (0, 0), items: Vec::new(), next: None, + total: 0, }); }; @@ -209,6 +211,7 @@ version: (total as u64, gone as u64), items, next, + total: alive as u64, }) } @@ -226,6 +229,7 @@ version: (0, 0), items: Vec::new(), next: None, + total: 0, }); }; let Some(did_rkeys) = paths.get(&Source::new(collection, path)) else { @@ -233,6 +237,7 @@ version: (0, 0), items: Vec::new(), next: None, + total: 0, }); }; @@ -275,6 +280,7 @@ version: (total as u64, gone as u64), items, next, + total: alive as u64, }) } diff --git a/constellation/src/storage/mod.rs b/constellation/src/storage/mod.rs --- a/constellation/src/storage/mod.rs +++ b/constellation/src/storage/mod.rs @@ -16,6 +16,7 @@ pub version: (u64, u64), // (collection length, deleted item count) // TODO: change to (total, active)? since dedups isn't "deleted" pub items: Vec, pub next: Option, + pub total: u64, } #[derive(Debug, Deserialize, Serialize, PartialEq)] diff --git a/constellation/src/storage/rocks_store.rs b/constellation/src/storage/rocks_store.rs --- a/constellation/src/storage/rocks_store.rs +++ b/constellation/src/storage/rocks_store.rs @@ -872,6 +872,7 @@ version: (0, 0), items: Vec::new(), next: None, + total: 0, }); }; @@ -914,6 +915,7 @@ version: (total, gone), items, next, + total: alive, }) } @@ -936,6 +938,7 @@ version: (0, 0), items: Vec::new(), next: None, + total: 0, }); }; @@ -974,6 +977,7 @@ version: (total, gone), items, next, + total: alive, }) }