Module storage

Module storage 

Source
Expand description

Storage port — persist and retrieve pipeline results Storage port — persist and retrieve pipeline results.

Defines the generic StoragePort trait plus the OutputFormatter helper that serialises pipeline outputs to CSV, JSONL, or JSON.

§Architecture

stygian-graph
  ├─ StoragePort (this file)             ← always compiled
  └─ Adapters (adapters/)
       ├─ FileStorage       (always)     → writes .jsonl to disk
       ├─ NullStorage       (always)     → no-op for tests
       └─ PostgresStorage   (feature="postgres")  → sqlx PgPool

§Example — writing results

use stygian_graph::ports::storage::{StoragePort, StorageRecord};
use serde_json::json;

async fn persist<S: StoragePort>(storage: &S) {
    let record = StorageRecord::new("pipe-1", "fetch", json!({"url": "https://example.com"}));
    storage.store(record).await.unwrap();
}

Structs§

StorageRecord
A single result record produced by a pipeline node.

Enums§

OutputFormat
Supported serialisation formats for pipeline result export.

Traits§

OutputFormatter
Port: serialise a slice of StorageRecords to bytes in a given format.
StoragePort
Port: persist and retrieve StorageRecords produced by pipelines.