Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,3 @@ jobs:

- name: Run tests
run: cargo test --features experimental --locked --verbose

proto-vendored-up-to-date:
name: Vendored proto code is up to date
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Cargo dependencies and build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: tools/gen-proto -> tools/gen-proto/target

- name: Regenerate vendored proto code
run: cargo run --manifest-path tools/gen-proto/Cargo.toml --locked

- name: Verify src/proto/generated/ has no drift
run: |
if ! git diff --exit-code -- src/proto/generated; then
echo "::error::src/proto/generated/ is out of date. Run:" >&2
echo " cargo run --manifest-path tools/gen-proto/Cargo.toml" >&2
echo "and commit the result." >&2
exit 1
fi
4 changes: 0 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches: [ "main" ]
paths:
- "src/**"
- "proto/**"
- "tools/gen-proto/**"
- "Cargo.toml"
- "Cargo.lock"
- "README.md"
Expand All @@ -16,8 +14,6 @@ on:
branches: [ "main" ]
paths:
- "src/**"
- "proto/**"
- "tools/gen-proto/**"
- "Cargo.toml"
- "Cargo.lock"
- "README.md"
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,21 @@ signals a backwards-compatible change.

### Removed

- **Protobuf** (breaking). Module `proto`, the `.proto` sources,
`tools/gen-proto` and the `prost`/`bytes` dependencies; with them the KLL
value-offset sample encoding.
- **Legacy MessagePack** (breaking). Module `message_pack_format` with
`portable`, `native` and `MessagePackCodec`: the wrapper types
`CountMinSketch`, `CountSketch`, `CountMinSketchWithHeap`,
`CountSketchWithHeap`, `KllSketch`, `HllSketch`, `DdSketch`,
`HydraKllSketch`, their deltas and helpers, and the `xxhash-rust`
dependency. `SetAggregator` and `SetAggregatorDelta` move to
`sketches::set_aggregator`; the ASAPv1 framing is private.
- **serde on sketch types** (breaking). Sketches, their storage and their
inputs no longer implement `Serialize` / `Deserialize`; ASAPv1 is the one
serialized form. `CountMinHll` and `MicroCm` lose
`serialize_to_bytes` / `deserialize_from_bytes`, and the
`serde-big-array` dependency goes.
- **Dead and duplicate APIs** (breaking). `Kll::wire_k` (use `k()`);
`PRECOMPUTED_SAMPLE_RATE_1PERCENT` and module `common::precompute_sample2`;
module `common::hashspec` (`HashSpec`, `derive_index`, `derive_sign`,
Expand Down
69 changes: 0 additions & 69 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ all-features = true
[dependencies]
rand = "0.9.3"
serde = { version = "1.0", features = ["derive"] }
serde-big-array = "0.5"
serde_bytes = "0.11"
rmp-serde = "1.3.0"
twox-hash = "2.1.2"
smallvec = "1.13.2"
prost = "0.13"
bytes = "1"
xxhash-rust = { version = "0.8", features = ["xxh32"] }
core_affinity = { version = "0.8", optional = true }
crossbeam-channel = { version = "0.5", optional = true }

Expand All @@ -39,11 +35,6 @@ default = []
experimental = []
octo-runtime = ["core_affinity", "crossbeam-channel"]

# Note: there are intentionally no `[build-dependencies]`. The prost output
# under `src/proto/generated/` is checked in and refreshed by the maintainer
# tool at `tools/gen-proto/`. This keeps the published crate pure-Rust with
# no requirement on `protoc` for downstream consumers.

[lib]
crate-type = ["rlib"]
name = "asap_sketchlib"
Expand Down
25 changes: 0 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,31 +220,6 @@ cargo build --features experimental
cargo test --features "experimental octo-runtime"
```

## Protobuf code generation

`asap_sketchlib` is a pure-Rust crate: building it does **not** require
`protoc` or any build script. The Rust types generated from
`proto/**/*.proto` are vendored into `src/proto/generated/` and refreshed
manually by maintainers using the in-repo tool at `tools/gen-proto/`.

Downstream users can therefore simply add the crate to their `Cargo.toml` and
build it like any other pure-Rust dependency.

### For maintainers

After editing any `.proto` file, regenerate the vendored output and commit
the result:

```bash
cargo run --manifest-path tools/gen-proto/Cargo.toml
git add src/proto/generated
```

The tool uses `prost-build` together with the `protoc-bin-vendored` binary,
so no system `protoc` is required to regenerate either. CI rejects any pull
request whose committed `src/proto/generated/` does not match the result of
running this command on its current `.proto` sources.

## FAQ

### When is Apache DataSketches a better fit?
Expand Down
8 changes: 0 additions & 8 deletions docs/api/api_bloom.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ word count that disagrees with the declared dimensions, and any bit set in a
row's trailing padding past `cols` — unreachable by `contains`, but counted by
`count_ones`, so it would skew `fill_ratio` and `estimated_fpp` alone.

Independently of ASAPv1, `Bloom` is plain `Serialize`/`Deserialize`; that form is
`{ bits, inserted, mode }`, where `mode` is `"regular"` or `"fast"`. Decoding
into the other hash path fails rather than producing a filter that reports its
own members absent, and so does a row count past `BLOOM_MAX_SLICES`. `BitMatrix`
carries `{ words, rows, cols }` only — the word stride and the fold masks are
recomputed on decode, and a payload whose word count disagrees with its
dimensions is rejected there rather than panicking later.

## Examples

```rust
Expand Down
2 changes: 1 addition & 1 deletion docs/api/api_coco_sketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ that holds nothing. Both methods require `H: HashProfile`.

A zero dimension, a table whose bucket count disagrees with `rows`/`cols`, a payload
length that disagrees with the declared geometry, and a `nil` key carrying a
non-zero value are all rejected on both sides. `CocoSketch` also derives serde.
non-zero value are all rejected on both sides.

Row `i` hashes at seed index `i`, so the wire covers `1 <= d <= 20`
(`MATRIX_MAX_ROWS`, the seed list length): past that, row `i` and row `i + 20`
Expand Down
4 changes: 2 additions & 2 deletions docs/api/api_common_heap.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ No dedicated merge method on `TopKHeap`; reconciliation is sketch-specific.

## Serialization

No dedicated byte API helpers. Derived serde carries the heap and its capacity;
the key index is derived data and is rebuilt on load rather than stored.
None of its own; a sketch holding a `TopKHeap` carries its entries in its
ASAPv1 payload.

## Examples

Expand Down
4 changes: 2 additions & 2 deletions docs/api/api_common_input.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ fn merge(&mut self, other: &HydraCounter) -> Result<(), String>

## Serialization

- `DataInput`, `OwnedDataInput`, `HeapEntry`, and `HydraCounter` derive serde traits.
- `HydraQuery` is query-only and does not derive serde in current code.
None of these types implements serde's `Serialize` / `Deserialize`; a sketch
holding them serializes through its own `to_asapv1`.

## Variants (Core)

Expand Down
4 changes: 1 addition & 3 deletions docs/api/api_count_sketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ as the state serialization: the changed cells as strictly ascending row-major
indices `row * cols + col`, below `rows * cols`, and the non-zero signed value
added to each. `new` and the decoder refuse anything else. `merge_delta` adds
the delta to the counters; a delta of other dimensions or admission rate, or an
integer add that overflows, fails and leaves the sketch unchanged. The crate
root's `CountSketchDelta` is the legacy portable type; this one is
`asap_sketchlib::sketches::CountSketchDelta`.
integer add that overflows, fails and leaves the sketch unchanged.

## Admission rate

Expand Down
8 changes: 1 addition & 7 deletions docs/api/api_countminsketch_hll.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,7 @@ returns an error otherwise, leaving `self` untouched.

## Serialization

```rust
fn serialize_to_bytes(&self) -> Result<Vec<u8>, RmpEncodeError>
fn deserialize_from_bytes(bytes: &[u8]) -> Result<Self, RmpDecodeError>
```

Plain MessagePack, **not** an ASAPv1 envelope: no `kind_id` is allocated for
this sketch while it is experimental.
None: no `kind_id` is allocated for this sketch while it is experimental.

## Accuracy

Expand Down
17 changes: 2 additions & 15 deletions docs/api/api_ddsketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ past `i32`, a non-zero offset on an empty store, counts that overflow the total,
and scalars inconsistent with that total; `to_asapv1` enforces the same
rules, so the format never emits bytes it would refuse to read back.

Independently of ASAPv1, `DdSketch` is plain `Serialize`/`Deserialize` for use
where it is nested in another type (`EhBucketSketch`); that form skips the four
running scalars.

## Deltas

```rust
Expand Down Expand Up @@ -139,17 +135,8 @@ assert!(p50 >= 1.0);
`rank = ceil(q * n)` (1-based), so it answers the order statistic
`sorted[ceil(q*n) - 1]`. `q <= 0` and `q >= 1` short-circuit to the exactly
retained minimum and maximum rather than to a bucket representative, so the
endpoints carry zero error.

This differs from the portable wire twin
`message_pack_format::portable::ddsketch::DdSketch::quantile`, which uses the
lower-quantile convention `floor(q * (n - 1))` of the DDSketch paper and of the
Go reference implementation, and which retains no min/max scalars — its
endpoints are ordinary bucket representatives, accurate to `alpha` like any
other rank. The two agree at most `q` and diverge at small `n` or ragged `q`
(at `n = 3, q = 0.4` this type answers `sorted[1]` and the portable one
`sorted[0]`). Both conventions are deliberate and are pinned by
`ddsketch_core_and_portable_answer_different_order_statistics`.
endpoints carry zero error. The convention is pinned by
`ddsketch_answers_the_ceil_nearest_rank_order_statistic`.

## Caveats

Expand Down
2 changes: 1 addition & 1 deletion docs/api/api_eh_bucket_sketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ and `0x01 0x03` (HIP) are rejected, and `Kll` is compact, so `0x06 0x01`
(dynamic) is rejected. The dispatch is the same in every build: a decoder built
without `experimental` rejects `0x0d 0x00` with an error naming the variant and
the feature, and its encoder can never emit it.
An unrecognized kind_id is rejected. `EhBucketSketch` also derives serde.
An unrecognized kind_id is rejected.

## Examples

Expand Down
2 changes: 1 addition & 1 deletion docs/api/api_elastic_sketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ both sides past it.
A zero dimension, a `heavy_buckets` disagreeing with the heavy table, a free bucket
that still names a flow, a payload length that disagrees with the declared
geometry, and a `nil` flow id whose `vote_pos` is non-zero are all rejected on
both sides. `ElasticSketch` also derives serde.
both sides.

## Examples

Expand Down
4 changes: 1 addition & 3 deletions docs/api/api_hydra.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ A grid mixing counter variants, UnivMon cells mixing key variants, a cell whose
geometry differs from the prototype's, a `prototype` holding data, a
declared grid the storage does not match, a row count past `MATRIX_MAX_ROWS`,
and a payload length that disagrees with the declared geometry are all rejected
on both sides. `Hydra` also derives
serde, which is the nested codec used when a Hydra is embedded in a larger
serde value.
on both sides.

## Examples

Expand Down
Loading
Loading