Skip to content

Commit

Permalink
chore: minor updates
Browse files Browse the repository at this point in the history
Signed-off-by: Vigith Maurice <[email protected]>
  • Loading branch information
vigith committed Jan 3, 2025
1 parent e8592bc commit 54c2cce
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
9 changes: 5 additions & 4 deletions rust/serving/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ mod metrics;
mod pipeline;

Check warning on line 23 in rust/serving/src/lib.rs

View workflow job for this annotation

GitHub Actions / Unit Tests

Diff in /home/runner/work/numaflow/numaflow/rust/serving/src/lib.rs

pub mod source;
pub use source::{Message, MessageWrapper, ServingSource};
pub use source::{Message, ServingSource};
use crate::source::MessageWrapper;

#[derive(Clone)]
pub(crate) struct AppState<T> {
pub message: mpsc::Sender<MessageWrapper>,
pub settings: Arc<Settings>,
pub callback_state: CallbackState<T>,
pub(crate) message: mpsc::Sender<MessageWrapper>,
pub(crate) settings: Arc<Settings>,
pub(crate) callback_state: CallbackState<T>,
}

pub(crate) async fn serve<T>(
Expand Down
30 changes: 15 additions & 15 deletions rust/serving/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::Error::ParseConfig;
// OperatorType is an enum that contains the types of operators
// that can be used in the conditions for the edge.
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub enum OperatorType {
pub(crate) enum OperatorType {
#[serde(rename = "and")]
And,
#[serde(rename = "or")]
Expand Down Expand Up @@ -43,36 +43,36 @@ impl From<String> for OperatorType {

// Tag is a struct that contains the information about the tags for the edge
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct Tag {
pub operator: Option<OperatorType>,
pub values: Vec<String>,
pub(crate) struct Tag {
pub(crate) operator: Option<OperatorType>,
pub(crate) values: Vec<String>,
}

// Conditions is a struct that contains the information about the conditions for the edge
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct Conditions {
pub tags: Option<Tag>,
pub(crate) struct Conditions {
pub(crate) tags: Option<Tag>,
}

// Edge is a struct that contains the information about the edge in the pipeline.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct Edge {
pub from: String,
pub to: String,
pub conditions: Option<Conditions>,
pub(crate) struct Edge {
pub(crate) from: String,
pub(crate) to: String,
pub(crate) conditions: Option<Conditions>,
}

/// DCG (directed compute graph) of the pipeline with minimal information build using vertices and edges
/// from the pipeline spec
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)]
pub struct PipelineDCG {
pub vertices: Vec<Vertex>,
pub edges: Vec<Edge>,
pub(crate) struct PipelineDCG {
pub(crate) vertices: Vec<Vertex>,
pub(crate) edges: Vec<Edge>,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct Vertex {
pub name: String,
pub(crate) struct Vertex {
pub(crate) name: String,
}

impl FromStr for PipelineDCG {
Expand Down
9 changes: 6 additions & 3 deletions rust/serving/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ use crate::app::tracker::MessageGraph;
use crate::Settings;
use crate::{Error, Result};

pub struct MessageWrapper {
pub confirm_save: oneshot::Sender<()>,
pub message: Message,
/// [Message] with a oneshot for notifying when the message has been completed processed.
pub(crate) struct MessageWrapper {
// TODO: this might be more that saving to ISB.
pub(crate) confirm_save: oneshot::Sender<()>,
pub(crate) message: Message,
}

/// Serving payload passed on to Numaflow.
#[derive(Debug)]
pub struct Message {
pub value: Bytes,
Expand Down

0 comments on commit 54c2cce

Please sign in to comment.