Skip to content

Commit

Permalink
adds clone on consumption type and hash on recv data
Browse files Browse the repository at this point in the history
  • Loading branch information
austbot committed Mar 15, 2023
1 parent d97f995 commit f15be4b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
7 changes: 4 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions plerkle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "plerkle"
description = "Geyser plugin with dynamic config reloading, message bus agnostic abstractions and a whole lot of fun."
version = "1.5.1"
version = "1.5.2"
authors = ["Metaplex Developers <[email protected]>"]
repository = "https://github.com/metaplex-foundation/digital-asset-validator-plugin"
license = "AGPL-3.0"
Expand Down Expand Up @@ -31,9 +31,9 @@ cadence-macros = "0.29.0"
chrono = "0.4.19"
tracing = "0.1.35"
hex = "0.4.3"
plerkle_messenger = { path = "../plerkle_messenger", version = "1.5.0", features = ["redis"] }
plerkle_messenger = { path = "../plerkle_messenger", version = "1.5.2", features = ["redis"] }
flatbuffers = "23.1.21"
plerkle_serialization = { path = "../plerkle_serialization", version = "1.5.0" }
plerkle_serialization = { path = "../plerkle_serialization", version = "1.5.2" }
tokio = { version = "1.23.0", features = ["full"] }
figment = { version = "0.10.6", features = ["env", "test"] }
dashmap = {version = "5.4.0"}
Expand Down
3 changes: 2 additions & 1 deletion plerkle_messenger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "plerkle_messenger"
description = "Metaplex Messenger trait for Geyser plugin producer/consumer patterns."
version = "1.5.1"
version = "1.5.2"
authors = ["Metaplex Developers <[email protected]>"]
repository = "https://github.com/metaplex-foundation/digital-asset-validator-plugin"
license = "AGPL-3.0"
Expand All @@ -17,6 +17,7 @@ figment = "0.10.6"
futures = "0.3"
async-mutex = "1.4.0"
serde = {version = "1.0.137", features = ["derive"] }
blake3 = "1.3.3"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
11 changes: 10 additions & 1 deletion plerkle_messenger/src/plerkle_messenger.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::error::MessengerError;
use async_trait::async_trait;
use blake3::OUT_LEN;
use figment::value::{Dict, Value};
use serde::Deserialize;
use std::collections::BTreeMap;
Expand All @@ -15,6 +16,7 @@ pub const SLOT_STREAM: &str = "SLT";
pub const TRANSACTION_STREAM: &str = "TXN";
pub const BLOCK_STREAM: &str = "BLK";

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RecvData {
pub id: String,
pub tries: usize,
Expand All @@ -29,9 +31,16 @@ impl RecvData {
pub fn new_retry(id: String, data: Vec<u8>, tries: usize) -> Self {
RecvData { id, data, tries }
}

pub fn hash(&mut self) -> [u8; OUT_LEN] {
let mut hasher = blake3::Hasher::new();
hasher.update(&self.data);
let hash = hasher.finalize();
hash.as_bytes().to_owned()
}
}

#[derive(Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ConsumptionType {
New,
Redeliver,
Expand Down
2 changes: 1 addition & 1 deletion plerkle_serialization/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "plerkle_serialization"
description = "Metaplex Flatbuffers Plerkle Serialization for Geyser plugin producer/consumer patterns."
version = "1.5.1"
version = "1.5.2"
authors = ["Metaplex Developers <[email protected]>"]
repository = "https://github.com/metaplex-foundation/digital-asset-validator-plugin"
license = "AGPL-3.0"
Expand Down

0 comments on commit f15be4b

Please sign in to comment.