Skip to content

Commit

Permalink
chore: move message conversions to appropriate modules (#2306)
Browse files Browse the repository at this point in the history
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Co-authored-by: Vigith Maurice <[email protected]>
  • Loading branch information
yhl25 and vigith authored Jan 2, 2025
1 parent bb4a0de commit 0c86e82
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 368 deletions.
2 changes: 1 addition & 1 deletion rust/numaflow-core/src/config/monovertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Default for MonovertexConfig {
source_type: source::SourceType::Generator(GeneratorConfig::default()),
},
sink_config: SinkConfig {
sink_type: sink::SinkType::Log(sink::LogConfig::default()),
sink_type: SinkType::Log(sink::LogConfig::default()),
retry_config: None,
},
transformer_config: None,
Expand Down
18 changes: 18 additions & 0 deletions rust/numaflow-core/src/mapper/map/user_defined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use tracing::error;
use crate::config::get_vertex_name;
use crate::error::{Error, Result};
use crate::message::{Message, MessageID, Offset};
use crate::shared::grpc::prost_timestamp_from_utc;

type ResponseSenderMap =
Arc<Mutex<HashMap<String, (ParentMessageInfo, oneshot::Sender<Result<Vec<Message>>>)>>>;
Expand All @@ -26,6 +27,23 @@ struct ParentMessageInfo {
headers: HashMap<String, String>,
}

impl From<Message> for MapRequest {
fn from(message: Message) -> Self {
Self {
request: Some(map::map_request::Request {
keys: message.keys.to_vec(),
value: message.value.to_vec(),
event_time: prost_timestamp_from_utc(message.event_time),
watermark: None,
headers: message.headers,
}),
id: message.offset.unwrap().to_string(),
handshake: None,
status: None,
}
}
}

/// UserDefinedUnaryMap is a grpc client that sends unary requests to the map server
/// and forwards the responses.
pub(in crate::mapper) struct UserDefinedUnaryMap {
Expand Down
Loading

0 comments on commit 0c86e82

Please sign in to comment.