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
7 changes: 7 additions & 0 deletions Cargo.lock

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

48 changes: 47 additions & 1 deletion crates/encoding/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,55 @@
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

use bilrost::{
DecodeErrorKind,
encoding::{EmptyState, ForOverwrite, Proxiable},
};
use restate_encoding_derive::BilrostNewType;

use crate::NetSerde;
use crate::{NetSerde, bilrost_encodings::RestateEncoding};

struct U128Tag;

impl Proxiable<U128Tag> for u128 {
type Proxy = (u64, u64);

fn encode_proxy(&self) -> Self::Proxy {
((*self >> 64) as u64, *self as u64)
}

fn decode_proxy(&mut self, proxy: Self::Proxy) -> Result<(), DecodeErrorKind> {
*self = (proxy.0 as u128) << 64 | proxy.1 as u128;
Ok(())
}
}

impl ForOverwrite<RestateEncoding, u128> for () {
fn for_overwrite() -> u128 {
0
}
}

impl EmptyState<RestateEncoding, u128> for () {
fn empty() -> u128 {
0
}

fn is_empty(val: &u128) -> bool {
*val == 0
}

fn clear(val: &mut u128) {
*val = 0;
}
}

bilrost::delegate_proxied_encoding!(
use encoding (::bilrost::encoding::General)
to encode proxied type (u128)
using proxy tag (U128Tag)
with encoding (RestateEncoding)
);

/// A Bilrost compatible U128 type.
#[derive(Debug, Clone, Copy, PartialEq, Eq, BilrostNewType)]
Expand Down
5 changes: 4 additions & 1 deletion crates/ingress-kafka/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ restate-workspace-hack = { workspace = true }

restate-bifrost = { workspace = true }
restate-core = { workspace = true }
restate-ingestion-client = { workspace = true }
restate-storage-api = { workspace = true }
restate-timer-queue = { workspace = true }
restate-types = { workspace = true }
Expand All @@ -30,6 +31,7 @@ anyhow = { workspace = true }
base64 = { workspace = true }
bytes = { workspace = true }
derive_more = { workspace = true }
futures = { workspace = true }
metrics = { workspace = true }
opentelemetry = { workspace = true }
opentelemetry_sdk = { workspace = true }
Expand All @@ -44,8 +46,9 @@ thiserror = { workspace = true }
tokio = { workspace = true, features = ["sync", "rt"] }
tracing = { workspace = true }
tracing-opentelemetry = { workspace = true }
xxhash-rust = { workspace = true, features = ["xxh3", "std"] }

[dev-dependencies]
restate-types = { workspace = true, features = ["test-util"] }

base64 = { workspace = true }
base64 = { workspace = true }
Loading
Loading