Skip to content

Commit

Permalink
Added uuid
Browse files Browse the repository at this point in the history
Signed-off-by: shubham <shubhamdixit863@gmail.com>
  • Loading branch information
shubhamdixit863 committed May 29, 2024
1 parent dc505a0 commit 937a0ef
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ chrono = "0.4.31"
serde_json = "1.0.111"
futures-util = "0.3.30"
tracing = "0.1.40"
uuid = { version = "1.8.0", features = ["v4"] }

[build-dependencies]
tonic-build = "0.10.2"
Expand Down
3 changes: 2 additions & 1 deletion examples/simple-source/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ path = "src/main.rs"
tonic = "0.10.2"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
numaflow = { git = "https://github.com/numaproj/numaflow-rs.git", branch = "main" }
chrono = "0.4.30"
chrono = "0.4.30"
uuid = "1.2.0"
4 changes: 2 additions & 2 deletions examples/simple-source/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) mod simple_source {
};
use std::collections::HashMap;
use std::sync::Arc;

use uuid::Uuid;
use numaflow::source::{Message, Offset, SourceReadRequest, Sourcer};
use tokio::{sync::mpsc::Sender, time::Instant};
use tonic::async_trait;
Expand Down Expand Up @@ -55,7 +55,7 @@ pub(crate) mod simple_source {
.store(self.read_idx.load(Ordering::Relaxed) + 1, Ordering::Relaxed);
let offset = self.read_idx.load(Ordering::Relaxed);
let mut headers=HashMap::new();
headers.insert(String::from("key"),String::from("key"));
headers.insert(String::from( Uuid::new_v4()),String::from( Uuid::new_v4()));
let shared_headers = Arc::new(headers);
// send the message to the transmitter
transmitter
Expand Down
3 changes: 2 additions & 1 deletion src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ mod tests {
use tokio::sync::mpsc::Sender;
use tokio::sync::oneshot;
use tonic::transport::Uri;
use uuid::Uuid;

// A source that repeats the `num` for the requested count
struct Repeater {
Expand All @@ -325,7 +326,7 @@ mod tests {
let event_time = Utc::now();
let mut message_offsets = Vec::with_capacity(request.count);
let mut headers=HashMap::new();
headers.insert(String::from("key"),String::from("key"));
headers.insert(String::from( Uuid::new_v4()),String::from( Uuid::new_v4()));
let shared_headers = Arc::new(headers);
for i in 0..request.count {
// we assume timestamp in nanoseconds would be unique on each read operation from our source
Expand Down

0 comments on commit 937a0ef

Please sign in to comment.