Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
0

Configure Feed

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

safe cardinality estimator

+17 -9
+12 -1
Cargo.lock
··· 573 573 ] 574 574 575 575 [[package]] 576 + name = "cardinality-estimator-safe" 577 + version = "2.1.0" 578 + source = "registry+https://github.com/rust-lang/crates.io-index" 579 + checksum = "3961c1d864c72d3d628d18b16ee64ca0e203ce9f0e9d701ecb7403e9da30927a" 580 + dependencies = [ 581 + "enum_dispatch", 582 + "serde", 583 + "wyhash", 584 + ] 585 + 586 + [[package]] 576 587 name = "cc" 577 588 version = "1.2.18" 578 589 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3792 3803 "anyhow", 3793 3804 "async-trait", 3794 3805 "bincode 2.0.1", 3795 - "cardinality-estimator", 3806 + "cardinality-estimator-safe", 3796 3807 "clap", 3797 3808 "dropshot", 3798 3809 "env_logger",
+1 -1
ufos/Cargo.toml
··· 7 7 anyhow = "1.0.97" 8 8 async-trait = "0.1.88" 9 9 bincode = { version = "2.0.1", features = ["serde"] } 10 - cardinality-estimator = { version = "1.0.2", features = ["with_serde"] } 10 + cardinality-estimator-safe = { version = "2.1.0", features = ["with_serde"] } 11 11 clap = { version = "4.5.31", features = ["derive"] } 12 12 dropshot = "0.16.0" 13 13 env_logger = "0.11.7"
+1 -1
ufos/src/lib.rs
··· 9 9 pub mod store_types; 10 10 11 11 use crate::error::BatchInsertError; 12 - use cardinality_estimator::CardinalityEstimator; 12 + use cardinality_estimator_safe::CardinalityEstimator; 13 13 use error::FirehoseEventError; 14 14 use jetstream::events::{CommitEvent, CommitOp, Cursor}; 15 15 use jetstream::exports::{Did, Nsid, RecordKey};
+3 -6
ufos/src/store_types.rs
··· 3 3 }; 4 4 use crate::{Cursor, Did, Nsid, PutAction, RecordKey, UFOsCommit}; 5 5 use bincode::{Decode, Encode}; 6 - use cardinality_estimator::CardinalityEstimator; 6 + use cardinality_estimator_safe::CardinalityEstimator; 7 7 use std::ops::Range; 8 8 9 9 /// key format: ["js_cursor"] ··· 221 221 222 222 #[cfg(not(test))] 223 223 fn to_db_bytes(&self) -> Result<Vec<u8>, EncodingError> { 224 - Ok(vec![1, 2, 3]) // TODO: un-stub when their heap overflow is fixed 224 + SerdeBytes::to_bytes(self) 225 225 } 226 226 #[cfg(not(test))] 227 227 fn from_db_bytes(bytes: &[u8]) -> Result<(Self, usize), EncodingError> { 228 - if bytes.len() < 3 { 229 - return Err(EncodingError::DecodeNotEnoughBytes); 230 - } 231 - Ok((Self(CardinalityEstimator::new()), 3)) // TODO: un-stub when their heap overflow is fixed 228 + SerdeBytes::from_bytes(bytes) 232 229 } 233 230 } 234 231