faucet_sink_spanner/lib.rs
1#![cfg_attr(docsrs, feature(doc_cfg))]
2//! Google Cloud Spanner sink connector for faucet-stream.
3//!
4//! Writes JSON records to a Spanner table as batched **mutations**: `Insert`
5//! for append, `InsertOrUpdate` for `write_mode: upsert`, and `Delete`
6//! mutations for `write_mode: delete` / `delete_marker` rows. Exactly-once
7//! delivery (`delivery: exactly_once`) commits each page atomically with a
8//! `_faucet_commit_token` watermark row in one read-write transaction.
9//!
10//! ```yaml
11//! sink:
12//! kind: spanner
13//! config:
14//! project_id: my-project
15//! instance: my-instance
16//! database: my-db
17//! table_name: events
18//! write_mode: upsert # append (default) | upsert | delete
19//! key: [id] # must equal the table's PRIMARY KEY
20//! auth:
21//! type: application_default
22//! ```
23//!
24//! Values are encoded against the destination column types read from
25//! `INFORMATION_SCHEMA`; commits are chunked at `batch_size` rows and a
26//! conservative 60,000-mutated-cell budget (Spanner's hard limit is ~80,000
27//! cells per commit including secondary-index amplification).
28
29mod config;
30mod sink;
31
32pub use config::SpannerSinkConfig;
33pub use faucet_common_spanner::{SpannerConnection, SpannerCredentials};
34pub use sink::SpannerSink;
35
36mod descriptor;
37pub use descriptor::DESCRIPTOR;