knut-bifrost 0.3.0

Bifröst — watch lakehouse tables (Iceberg via Spark Connect) and materialise them as a FalkorDB property graph
Documentation
//! # knut-bifrost
//!
//! The bridge between the table world and the graph world: watch lakehouse
//! tables (Iceberg via Spark Connect) and continuously materialise them as a
//! FalkorDB property graph, through a declarative-or-custom transform fabric.
//!
//! See `docs/bifrost-design.md` for the full design.
//!
//! ```no_run
//! # #[cfg(feature = "spark")]
//! # async fn demo() -> knut_bifrost::Result<()> {
//! use std::time::Duration;
//! use knut_bifrost::{
//!     Listener, MappingSpec, TransformRegistry, SyncState,
//!     sink::FalkorDbSink, source::SparkConnectSource,
//! };
//!
//! let spec = MappingSpec::load("bifrost.yml")?;
//! let source = SparkConnectSource::connect("sc://spark:15002").await?;
//! let sink = FalkorDbSink::connect("redis://127.0.0.1:6379", "social").await?;
//! let state = SyncState::open("bifrost-state.json")?;
//!
//! let mut listener = Listener::new(spec, TransformRegistry::new(), source, sink, state);
//! listener.run(Duration::from_secs(30), |round| {
//!     println!("{round:?}");
//!     true
//! }).await?;
//! # Ok(())
//! # }
//! ```

mod tests;

/// The short git commit this crate was built from (`KNUT_GIT_HASH`, emitted by
/// `build.rs` via a pure-fs, zero-shell read of the repo's git metadata). `env!`
/// (not `option_env!`) because `build.rs` emits it on every build.
pub const GIT_HASH: &str = env!("KNUT_GIT_HASH");

/// `--version` line: `v<pkg-version> (<git-sha>)`. clap prints `<bin> <this>`,
/// so `--version` reads `<bin> v<ver> (<hash>)` — the suite-wide identity.
pub const VERSION_LINE: &str = concat!(
    "v",
    env!("CARGO_PKG_VERSION"),
    " (",
    env!("KNUT_GIT_HASH"),
    ")"
);

pub mod airflow;
#[cfg(feature = "cli")]
pub mod catalog_args;
pub mod cdc;
pub mod codegen;
#[cfg(feature = "skade")]
pub mod delivery;
#[cfg(feature = "service")]
pub mod doris_cli;
pub mod error;
#[cfg(feature = "falkordb-service")]
pub mod falkordb_cli;
#[cfg(feature = "flight")]
pub mod flight;
pub mod listener;
pub mod mapping;
pub mod metrics;
#[cfg(feature = "metrics-http")]
pub mod metrics_http;
pub mod mutation;
pub mod registry;
pub mod rel2graph;
pub mod sink;
pub mod source;
pub mod spark_demo;
#[cfg(feature = "falkordb-service")]
pub mod service_paths;
#[cfg(feature = "sql")]
pub mod sql;
pub mod puppygraph;
pub mod state;
pub mod testmatrix;
pub mod transform;
#[cfg(feature = "cli")]
pub mod watch_cli;
#[cfg(feature = "wasm")]
pub mod wasm;

pub use airflow::{AssetEmitter, AssetEvent, emit_round, round_to_events};
#[cfg(feature = "skade")]
pub use cdc::SkadeCdc;
pub use cdc::{
    CdcBackend, CdcCapability, CdcKind, ChangeOp, ChangeRequest, ChangeStream, change_row_schema,
    encode_change_rows, fold_updates,
};
#[cfg(feature = "spark")]
pub use cdc::{SparkIcebergCdc, SparkNativeCdc};
pub use codegen::{
    CodegenOptions, EdgePlan, EdgeProposal, GraphPlan, NodePlan, PlanMode, SinkKind, SourceKind,
    Tier,
};
pub use error::{BifrostError, Result};
#[cfg(feature = "flight")]
pub use flight::FlightTransform;
#[cfg(feature = "skade")]
pub use listener::{watch_iceberg_delta, watch_iceberg_delta_with_identity};
pub use listener::{Listener, RoundReport};
pub use source::{ArrowBatches, ArrowSource, EmptyRead, TableSpec};
pub use mapping::{MappingSpec, PipelineStep, SyncMode, TableMapping};
pub use metrics::{Backoff, Metrics, render_prometheus};
#[cfg(feature = "metrics-http")]
pub use metrics_http::{MetricsHandle, MetricsServer};
pub use mutation::{EdgeSet, GraphMutation, SinkReport, VertexDelete, VertexSet};
pub use registry::TransformRegistry;
pub use rel2graph::{ArrowTables, BuildReport, TableSource, build_mutation, build_mutation_reported};
pub use source::FileSource;
#[cfg(feature = "skade")]
pub use source::{DeltaPlan, IcebergSource};
pub use state::{SyncState, TableState};
pub use transform::{
    ChangeRows, EdgeTransform, TableContext, Transform, VertexTransform, deletes_from_change_rows,
    edge_deletes_from_change_rows,
    is_changelog_batch, partition_change_rows,
};
#[cfg(feature = "wasm")]
pub use wasm::WasmTransform;