Expand description
Data sink port — publish scraped records to an external system
DataSink port — outbound counterpart to DataSourcePort.
DataSinkPort is the abstraction that lets pipeline nodes publish scraped
records to an external system without being coupled to any particular backend
(file system, webhook endpoint, message queue, Scrape Exchange, etc.).
§Architecture
Following the hexagonal architecture model:
- This file lives in the ports layer — pure trait definitions, no I/O.
- Concrete adapters (file sink, HTTP sink, …) implement this trait and live
under
adapters/.
§Example
use stygian_graph::ports::data_sink::{DataSinkPort, SinkRecord};
// Any adapter that implements DataSinkPort can be used here.
async fn publish_one(sink: &dyn DataSinkPort, payload: serde_json::Value) {
let record = SinkRecord::new("my-schema", "https://example.com", payload);
match sink.publish(&record).await {
Ok(receipt) => println!("Published: {}", receipt.id),
Err(e) => eprintln!("Publish failed: {e}"),
}
}Structs§
- Sink
Receipt - Confirmation that a
SinkRecordwas successfully accepted by the sink. - Sink
Record - A single structured record to be published through a
DataSinkPort.
Enums§
- Data
Sink Error - Errors that a
DataSinkPortimplementation may return.
Traits§
- Data
Sink Port - Outbound data sink port — publish scraped records to an external system.