bifrost: Iceberg → FalkorDB
bifrost watch polls Apache Iceberg tables and keeps a FalkorDB property graph in sync with them. Tables are found directly on S3 (no catalog), through an Iceberg REST catalog, or in a local skade warehouse directory. The data files are read natively in Rust. No Spark or JVM is needed at read time: Spark (or anything else) only writes the tables.
Iceberg tables (S3 / REST catalog) ──poll snapshots──▶ bifrost ──GRAPH.BULK / Cypher──▶ FalkorDB
│
state.json (cursor per table)
This is the slim build of knut-bifrost: the cargo feature bifrost-falkordb (cli + skade-rest + falkordb + metrics-http). It links no Spark, Doris, DataFusion, Arrow Flight, WASM, skidbladnir, Airflow or GraphAr file-drop code; tests/bifrost_falkordb_features.rs holds it to that.
Features
knut-bifrost has no default features. Each source and each sink is one cargo feature, and a bundle is a source plus a sink (plus cli for the bifrost binary).
| feature | kind | what it adds | brings in |
skade-s3 |
source | Iceberg tables read straight off S3/MinIO by their root, no catalog (delivery::IcebergLake::S3) |
skade, skade's S3 client |
skade-rest |
source | Iceberg tables behind a REST catalog (IcebergLake::Catalog over skade::connect::IcebergRest; MinIO AIStor /_iceberg with SigV4 s3tables); includes skade-s3 |
skade's REST client |
skade-grpc |
source | Iceberg tables behind a skade-katalog gRPC front; includes skade-s3 |
tonic, rustls |
catalog-aistor, catalog-polaris, catalog-unity, catalog-gravitino (catalogs = all four) |
source | a vendor preset for --catalog <vendor>; each includes skade-rest |
nothing new |
file-source |
source | a watched directory of GraphAr/columnar file drops (source::FileSource; the CLI's run, gen-sample) |
graphar, graph-ar-ipc |
spark |
source | Spark Connect (source::SparkConnectSource, bifrost iceberg-demo) |
spark-connect, tonic |
falkordb |
sink | sink::FalkorDbSink (a GraphSink), the Valkey ledger SyncState::open_valkey, listener::watch_iceberg_delta*, the CLI's run and watch |
graphar-falkordb, redis |
doris |
sink | sink::DorisSink (a TableSink), Iceberg commits into Apache Doris over Stream Load |
reqwest, rustls |
skade-s3, skade-rest and skade-grpc all build on skade, which on its own reads a local skade warehouse directory. Without a sink feature the library still has the GraphSink and TableSink traits, the mapping, GraphMutation, the transforms and the Listener (generic over its sink), so a program can bring its own sink.
| bundle | source | sink | extra |
bifrost-falkordb |
skade-rest |
falkordb |
cli, metrics-http |
falkordb-service |
skade-rest |
falkordb |
cli, bifrost falkordb install|k8s (skidbladnir) |
iceberg-doris |
skade-rest, skade-grpc |
doris |
none |
service |
falkordb-service + iceberg-doris |
falkordb, doris |
bifrost doris … |
spark41 |
spark |
falkordb |
graphar-falkordb's container autostart, for its test |
The rest are independent of source and sink: cli (the bifrost binary), metrics-http, sql, codegen, airflow, wasm, flight, testmatrix. A bifrost subcommand whose feature is missing still parses and exits non-zero naming it.
Source only, in your own Rust code
To read Iceberg tables into your own program as Arrow batches, with no graph, no redis and no CLI:
[dependencies]
knut-bifrost = { version = "0.3", default-features = false, features = ["skade-rest"] }
skade = { version = "0.8", default-features = false } # the catalog connector type
tokio = { version = "1", features = ["full"] }
tests/source_only_features.rs holds this build to no redis and no graphar-falkordb anywhere in its dependency tree. IcebergSource remembers nothing itself: you keep the cursor (TableState) and pass it back on the next poll. The first poll returns the current snapshot in full; every later one only what changed since the cursor's snapshot, or None.
,no_run
use std::sync::Arc;
use std::time::Duration;
use knut_bifrost::delivery::{IcebergLake, s3_config};
use knut_bifrost::source::{IcebergSource, TableSource};
use knut_bifrost::{SyncMode, TableSpec, TableState};
async fn follow_orders() -> knut_bifrost::Result<()> {
// The data files are on S3; MINIO_ACCESS_KEY / MINIO_SECRET_KEY sign the reads.
let s3 = s3_config("https://s3.example:9000".into(), "eu-north-1".into(), "lake".into(), None)?;
let rest = skade::connect::IcebergRest {
uri: "https://catalog.example:8181".into(),
warehouse: Some("lake".into()),
s3,
..Default::default()
};
let lake = IcebergLake::Catalog { connector: Arc::new(rest), namespace: Some("sales".into()) };
// With no catalog: IcebergLake::S3 { s3, root: "s3://lake/warehouse".into() }.
let source = IcebergSource::from_lake(lake);
// `Cdc`: inserts, updates and deletes (a deleted row comes with `_change_type`).
// `Incremental`: only the rows each new snapshot appended.
let spec = TableSpec::new("orders", SyncMode::Cdc);
let mut cursor = TableState::default(); // store it to resume after a restart
loop {
if let Some((batches, next)) = source.fetch_new(&spec, &cursor).await? {
for batch in &batches {
println!("snapshot {:?}: {} rows", next.snapshot_id, batch.num_rows());
}
cursor = next;
}
tokio::time::sleep(Duration::from_secs(15)).await;
}
}
This snippet is compiled as a doctest of knut-bifrost under skade-rest (cargo test -p knut-bifrost --no-default-features --features skade-rest --doc), so it cannot drift from the library.
Build
From the knut repository root:
cargo build --release -p knut-bifrost --no-default-features --features bifrost-falkordb --bin bifrost
# → target/release/bifrost
cargo test -p knut-bifrost --no-default-features --features bifrost-falkordb # no services needed
Vendor REST presets are opt-in: add catalogs, or one of catalog-aistor, catalog-polaris, catalog-unity, catalog-gravitino, e.g. --features bifrost-falkordb,catalog-polaris. A build with falkordb-service adds bifrost falkordb install|k8s (a systemd unit or a Kubernetes StatefulSet through skidbladnir); this slim build leaves it out and uses the files below.
Run
Tables on S3 with no catalog. A mapping table ns.name is read from <root>/ns/name, and its current metadata is version-hint.text, falling back to the newest *.metadata.json:
bifrost watch \
--s3-root s3://my-bucket/warehouse \
--s3-endpoint https://s3.eu-north-1.amazonaws.com --s3-region eu-north-1 \
--mapping mapping.yml --graph people --state ./people-state.json
Tables behind an Iceberg REST catalog:
bifrost watch \
--rest-uri https://catalog.example:8181 --rest-warehouse lake --rest-namespace ns \
--s3-endpoint https://s3.example:9000 --s3-region eu-north-1 \
--mapping mapping.yml --graph people --state ./people-state.json
A local skade warehouse: --warehouse DIR instead of --s3-root / --rest-uri.
Useful flags: --once (run one round and exit), --interval SECS (default 15), --dry-run (count mutations, write nothing), --metrics-addr 127.0.0.1:9187 (Prometheus /metrics), --metrics-file PATH, --tls-cert/--tls-key/--tls-ca (mutual TLS to FalkorDB), --sigv4 SERVICE, --catalog <vendor>, --s3-bucket, --s3-ca FILE. See bifrost watch --help.
Direct S3 discovery gives you no catalog commit authority. If tables have concurrent writers, read them through the catalog.
Secrets (environment only, never flags)
| variable | used for |
MINIO_ACCESS_KEY / MINIO_SECRET_KEY |
S3 data files (any S3, not only MinIO). Required with --s3-root and --rest-uri. |
BIFROST_FALKOR_URL |
FalkorDB URL when it has a password (default redis://127.0.0.1:6379) |
BIFROST_CATALOG_TOKEN |
REST catalog bearer token |
BIFROST_CATALOG_CREDENTIAL |
REST catalog OAuth2 client credential client_id:client_secret |
BIFROST_S3_CA_PEM |
PEM text of a private CA for S3/REST (or --s3-ca FILE) |
RUST_LOG |
log level (default info) |
S3 is accessed path-style. Credentials are static keys: the AWS default chain and session tokens are not supported.
FalkorDB connection
The target is a Redis URL: --falkor URL, else BIFROST_FALKOR_URL, else redis://127.0.0.1:6379. A hostname or an IP both work.
| FalkorDB | settings |
| test box, no TLS | BIFROST_FALKOR_URL=redis://falkor-test:6379, no --tls-* flags |
| mutual TLS | BIFROST_FALKOR_URL=rediss://bifrost:unused@falkor:16380 plus --tls-cert, --tls-key, --tls-ca |
With mutual TLS:
- The server certificate must name the host you dial (DNS or IP SAN).
- When the server's default user is off and the client user is an ACL
nopassuser, put the user and any password in the URL (bifrost:unused@). A URL with a user but no password sends noAUTH, and FalkorDB answers withNOAUTH. --tls-cais only used together with--tls-cert/--tls-key.
bifrost connects before the first round (TLS handshake, and AUTH when the URL carries a password), so an unreachable FalkorDB or a failed handshake stops it at startup. Keep passwords in BIFROST_FALKOR_URL, not in --falkor: argv is world-readable.
Inside a container, 127.0.0.1 is the container itself. Use the FalkorDB host name, host.containers.internal, or --network host.
Mapping
Iceberg columns alone do not say what is a node and what is an edge, so the mapping does. See examples/mapping.yml:
version: 1
tables:
- table: ns.people
mode: cdc
pipeline:
- vertex: { label: Person, id_column: id, properties: [name, age] }
- table: ns.follows
mode: cdc
pipeline:
- edge:
type: FOLLOWS
src: { label: Person, column: follower_id, id_column: id }
dst: { label: Person, column: followee_id, id_column: id }
properties: [since]
Always set id_column on edge endpoints. Without it, the endpoint is matched on a node property named after the edge column (here follower_id). That never matches Person.id, so every edge creates new, duplicate endpoint nodes.
Modes: cdc applies inserts, updates and deletes from the Iceberg changelog; incremental ships only new rows; full re-reads the whole table when its snapshot changes and upserts it. A PuppyGraph schema.json can also be given as the mapping (--mode then sets the mode for every table).
How data gets into FalkorDB
FalkorDB keeps running the whole time. bifrost never restarts it, never writes RDB files, and never deletes or replaces a graph. Everything goes over the normal Redis connection:
- First load of an empty label / relationship type (in a round with no deletes): rows are deduplicated by id and encoded straight from Arrow into FalkorDB's binary
GRAPH.BULKprotocol, sent in chunks.BEGINis sent only when the graph key does not exist yet; otherwise the chunks are appended. Then indexes are created on the merge keys. This is the fast path. - Everything after that (updates, new rows, labels that already have data): indexed
UNWIND … MERGEbatches. Deletes becomeDETACH DELETEfor nodes andDELETE efor edges. - If the bulk path is refused (e.g. an Arrow type it cannot encode, or unresolved edge endpoints), those rows fall back to MERGE. The result is the same graph.
Existing data in other labels is never overwritten. Bulk only runs into labels that are empty.
Semantics and limits
- "Watch" means polling Iceberg metadata for new snapshot ids. An unchanged snapshot ships nothing.
- The per-table cursor in
--stateadvances only after the sink has applied the round. If the process stops mid-round, that round is replayed (MERGE is idempotent). This is at-least-once, not a distributed transaction. - Keep one state file per (source, mapping, graph). A
--dry-runalso advances its cursor. - Each round is held in memory as Arrow batches, so a large first snapshot or a long backlog needs RAM.
- Iceberg tables commit independently, so a graph spanning several tables is eventually consistent.
- Ctrl-C while bifrost waits between rounds writes
--metrics-fileand exits. SIGTERM stops it at once; the round in flight is replayed on the next start. - A failed table is logged (
table_failed) and retried on the next round; a round in which tables failed and none synced backs the next poll off, up to--max-backoff.
Deploy as a systemd service
The files are in crates/knut-bifrost/:
install -m 0755 target/release/bifrost /usr/local/bin/bifrost
install -d /etc/bifrost
install -m 0644 crates/knut-bifrost/examples/mapping.yml /etc/bifrost/mapping.yml
install -m 0600 crates/knut-bifrost/deploy/bifrost.env.example /etc/bifrost/bifrost.env
install -m 0644 crates/knut-bifrost/deploy/bifrost.service /etc/systemd/system/bifrost.service
install -d -m 0700 /etc/bifrost/tls
install -m 0600 bifrost.crt bifrost.key ca.crt /etc/bifrost/tls/
# edit /etc/bifrost/bifrost.env and the ExecStart flags in bifrost.service, then:
systemctl daemon-reload && systemctl enable --now bifrost
journalctl -u bifrost -f
The unit runs as a dynamic user and keeps its state in /var/lib/bifrost. The client certificate and key stay root-only. LoadCredential= hands the service a private copy, which %d points at. For a FalkorDB without TLS, delete the three LoadCredential= lines and the three --tls-* flags, and set a redis:// URL.
Deploy as a container
crates/knut-bifrost/Containerfile builds exactly the command under Build, from the knut workspace. The workspace names graphar as a git dependency on git.gunnar.rs, which cargo resolves even though this build does not compile it, so the build needs your ssh-agent:
podman build --ssh default -t bifrost:latest -f crates/knut-bifrost/Containerfile .
podman secret create bifrost-falkor-crt /etc/bifrost/tls/bifrost.crt
podman secret create bifrost-falkor-key /etc/bifrost/tls/bifrost.key
podman secret create bifrost-falkor-ca /etc/bifrost/tls/ca.crt
podman run -d --name bifrost \
--env-file /etc/bifrost/bifrost.env \
--secret bifrost-falkor-crt,type=mount,target=falkor.crt,uid=10001,mode=0400 \
--secret bifrost-falkor-key,type=mount,target=falkor.key,uid=10001,mode=0400 \
--secret bifrost-falkor-ca,type=mount,target=falkor-ca.crt,uid=10001,mode=0400 \
-v /etc/bifrost/mapping.yml:/etc/bifrost/mapping.yml:ro \
-v bifrost-state:/var/lib/bifrost \
-p 127.0.0.1:9187:9187 \
bifrost:latest watch \
--rest-uri https://catalog.example:8181 --rest-warehouse lake \
--s3-endpoint https://s3.example:9000 --s3-region eu-north-1 \
--mapping /etc/bifrost/mapping.yml --graph lake \
--tls-cert /run/secrets/falkor.crt --tls-key /run/secrets/falkor.key \
--tls-ca /run/secrets/falkor-ca.crt \
--state /var/lib/bifrost/state.json --metrics-addr 0.0.0.0:9187
Without TLS, leave out the --secret and --tls-* lines and use a redis:// URL.
In Kubernetes, run it as a single-replica Deployment or StatefulSet with a small PVC for /var/lib/bifrost. Run only one instance per state file and graph.
Tests
cargo test -p knut-bifrost --no-default-features --features bifrost-falkordb needs no services. tests/watch_cli_iceberg.rs in it runs the real bifrost watch binary against a local Iceberg warehouse in --dry-run.
Against a live FalkorDB (#[ignore]d, run with -- --ignored --nocapture):
KNUT_FALKORDB_URL=redis://127.0.0.1:6379 \
cargo test -p knut-bifrost --no-default-features --features bifrost-falkordb --test live_falkordb_sink -- --ignored
cargo test -p knut-bifrost --no-default-features --features bifrost-falkordb --test delta_iceberg_falkordb -- --ignored
delta_iceberg_falkordb starts its own FalkorDB container (podman; image from KNUT_FALKORDB_IMAGE) and streams Iceberg snapshot deltas into it.
Layout
| crate | role |
crates/knut-bifrost |
the bifrost binary: CLI, Iceberg sources, mapping, sync loop, FalkorDB sink, metrics |
crates/graphar-falkordb |
Arrow → FalkorDB loader: GRAPH.BULK encoder, UNWIND Cypher, TLS |
crates/knut-tracing |
log setup (pretty or JSON lines) |