Skip to content

Commit c869761

Browse files
committed
Interface update.
1 parent ab9f286 commit c869761

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/ops/interface.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,30 @@ pub struct FlowInstanceContext {
1414
pub flow_instance_name: String,
1515
}
1616

17+
pub struct SourceData<'a> {
18+
pub update_time: Option<chrono::DateTime<chrono::Utc>>,
19+
pub data: BoxFuture<'a, Result<FieldValues>>,
20+
}
21+
22+
pub struct SourceChange<'a> {
23+
/// Last update/deletion time. None means unavailable.
24+
pub time: Option<chrono::DateTime<chrono::Utc>>,
25+
/// None means a deletion.
26+
pub data: Option<BoxFuture<'a, Result<FieldValues>>>,
27+
}
28+
1729
#[async_trait]
1830
pub trait SourceExecutor: Send + Sync {
1931
/// Get the list of keys for the source.
2032
async fn list_keys(&self) -> Result<Vec<KeyValue>>;
2133

2234
// Get the value for the given key.
23-
async fn get_value(&self, key: &KeyValue) -> Result<Option<FieldValues>>;
35+
async fn get_value(
36+
&self,
37+
key: &'async_trait KeyValue,
38+
) -> Result<Option<SourceData<'async_trait>>>;
39+
40+
async fn get_changes(&self) -> Result<Vec<SourceChange<'async_trait>>>;
2441
}
2542

2643
pub trait SourceFactory {

0 commit comments

Comments
 (0)