Added network catalog slices

This commit is contained in:
Ultradesu
2026-07-25 22:40:27 +03:00
parent b725ca8d05
commit 788bc2e01f
14 changed files with 878 additions and 152 deletions
+16
View File
@@ -2239,6 +2239,22 @@ impl DeviceSync {
Ok(rows.collect::<rusqlite::Result<Vec<_>>>()?)
}
pub fn active_remote_endpoint_ids(&self) -> Result<Vec<String>> {
let own = self.ensure_identity()?.device_id;
let conn = lock(&self.conn);
let mut stmt = conn.prepare(
"SELECT endpoint_id
FROM sync_devices
WHERE trusted_at_ms IS NOT NULL
AND revoked_at_ms IS NULL
AND device_id != ?1
AND endpoint_id != ''
ORDER BY last_seen_ms DESC",
)?;
let rows = stmt.query_map([own], |row| row.get::<_, String>(0))?;
Ok(rows.collect::<rusqlite::Result<Vec<_>>>()?)
}
fn active_device_count(&self) -> Result<usize> {
let conn = lock(&self.conn);
Ok(conn.query_row(