-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added topic deduplication mechanism 1/2
- Loading branch information
Alexander Galibey
committed
Jul 12, 2023
1 parent
86797cd
commit 86f762f
Showing
22 changed files
with
363 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
crates/fluvio-controlplane-metadata/src/topic/deduplication.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
use std::{time::Duration, collections::BTreeMap}; | ||
|
||
use derive_builder::Builder; | ||
use fluvio_protocol::{Encoder, Decoder}; | ||
|
||
#[derive(Debug, Default, Builder, Clone, PartialEq, Eq, Encoder, Decoder)] | ||
#[cfg_attr( | ||
feature = "use_serde", | ||
derive(serde::Serialize, serde::Deserialize), | ||
serde(rename_all = "kebab-case") | ||
)] | ||
pub struct Deduplication { | ||
pub bounds: Bounds, | ||
pub filter: Filter, | ||
} | ||
|
||
#[derive(Debug, Default, Builder, Clone, PartialEq, Eq, Encoder, Decoder)] | ||
#[cfg_attr( | ||
feature = "use_serde", | ||
derive(serde::Serialize, serde::Deserialize), | ||
serde(rename_all = "kebab-case") | ||
)] | ||
pub struct Bounds { | ||
#[cfg_attr(feature = "use_serde", serde(default, skip_serializing_if = "is_zero"))] | ||
pub count: u64, | ||
#[cfg_attr( | ||
feature = "use_serde", | ||
serde( | ||
default, | ||
skip_serializing_if = "Option::is_none", | ||
with = "humantime_serde" | ||
) | ||
)] | ||
pub age: Option<Duration>, | ||
} | ||
|
||
#[derive(Debug, Default, Builder, Clone, PartialEq, Eq, Encoder, Decoder)] | ||
#[cfg_attr( | ||
feature = "use_serde", | ||
derive(serde::Serialize, serde::Deserialize), | ||
serde(rename_all = "kebab-case") | ||
)] | ||
pub struct Filter { | ||
pub transform: Transform, | ||
} | ||
|
||
#[derive(Debug, Default, Builder, Clone, PartialEq, Eq, Encoder, Decoder)] | ||
#[cfg_attr( | ||
feature = "use_serde", | ||
derive(serde::Serialize, serde::Deserialize), | ||
serde(rename_all = "kebab-case") | ||
)] | ||
pub struct Transform { | ||
pub uses: String, | ||
#[cfg_attr( | ||
feature = "use_serde", | ||
serde(default, skip_serializing_if = "BTreeMap::is_empty") | ||
)] | ||
pub with: BTreeMap<String, String>, | ||
} | ||
|
||
#[cfg(feature = "use_serde")] | ||
fn is_zero(val: &u64) -> bool { | ||
*val == 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.