Skip to main content

relay_core_runtime/services/
flow_read.rs

1use async_trait::async_trait;
2use relay_core_api::flow::Flow;
3use relay_core_api::modification::{FlowQuery, FlowSummary};
4use crate::CoreState;
5
6#[async_trait]
7pub trait FlowReadService: Send + Sync {
8    async fn get_flow(&self, id: &str) -> Option<Flow>;
9    async fn search_flows(&self, query: FlowQuery) -> Vec<FlowSummary>;
10}
11
12#[async_trait]
13impl FlowReadService for CoreState {
14    async fn get_flow(&self, id: &str) -> Option<Flow> {
15        CoreState::get_flow(self, id.to_string()).await
16    }
17
18    async fn search_flows(&self, query: FlowQuery) -> Vec<FlowSummary> {
19        CoreState::search_flows(self, query).await
20    }
21}