Skip to main content

Module data_sink

Module data_sink 

Source
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§

SinkReceipt
Confirmation that a SinkRecord was successfully accepted by the sink.
SinkRecord
A single structured record to be published through a DataSinkPort.

Enums§

DataSinkError
Errors that a DataSinkPort implementation may return.

Traits§

DataSinkPort
Outbound data sink port — publish scraped records to an external system.