alpha
Login
or
Join now
microcosm.blue
/
microcosm-rs
Star
0
Fork
3
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
Star
0
Fork
3
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
safe cardinality estimator
author
phil
date
1 year ago
(May 6, 2025, 7:55 PM -0400)
commit
cdbdc7ea
cdbdc7ea99ecb51465722ae6aea5c2f81ff5e5f2
parent
f1c708d9
f1c708d9007752447a6b16c9985fc97ef33f047c
+17
-9
4 changed files
Expand all
Collapse all
Unified
Split
Cargo.lock
ufos
Cargo.toml
src
lib.rs
store_types.rs
+12
-1
Cargo.lock
Reviewed
···
573
573
]
574
574
575
575
[[package]]
576
576
+
name = "cardinality-estimator-safe"
577
577
+
version = "2.1.0"
578
578
+
source = "registry+https://github.com/rust-lang/crates.io-index"
579
579
+
checksum = "3961c1d864c72d3d628d18b16ee64ca0e203ce9f0e9d701ecb7403e9da30927a"
580
580
+
dependencies = [
581
581
+
"enum_dispatch",
582
582
+
"serde",
583
583
+
"wyhash",
584
584
+
]
585
585
+
586
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
3795
-
"cardinality-estimator",
3806
3806
+
"cardinality-estimator-safe",
3796
3807
"clap",
3797
3808
"dropshot",
3798
3809
"env_logger",
+1
-1
ufos/Cargo.toml
Reviewed
···
7
7
anyhow = "1.0.97"
8
8
async-trait = "0.1.88"
9
9
bincode = { version = "2.0.1", features = ["serde"] }
10
10
-
cardinality-estimator = { version = "1.0.2", features = ["with_serde"] }
10
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
Reviewed
···
9
9
pub mod store_types;
10
10
11
11
use crate::error::BatchInsertError;
12
12
-
use cardinality_estimator::CardinalityEstimator;
12
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
Reviewed
···
3
3
};
4
4
use crate::{Cursor, Did, Nsid, PutAction, RecordKey, UFOsCommit};
5
5
use bincode::{Decode, Encode};
6
6
-
use cardinality_estimator::CardinalityEstimator;
6
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
224
-
Ok(vec![1, 2, 3]) // TODO: un-stub when their heap overflow is fixed
224
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
228
-
if bytes.len() < 3 {
229
229
-
return Err(EncodingError::DecodeNotEnoughBytes);
230
230
-
}
231
231
-
Ok((Self(CardinalityEstimator::new()), 3)) // TODO: un-stub when their heap overflow is fixed
228
228
+
SerdeBytes::from_bytes(bytes)
232
229
}
233
230
}
234
231