1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
910// Disallow usage of `unwrap()`.
11#![warn(clippy::unwrap_used)]
12#![cfg_attr(nightly_doc_features, feature(doc_cfg))]
13// Without this, cargo clippy complains with:
14// overflow evaluating the requirement `&str: std::marker::Send`
15// in implement_peek_plan's return of a Result<crate::ExecuteResponse, AdapterError>.
16#![recursion_limit = "256"]
1718//! Coordinates client requests with the dataflow layer.
19//!
20//! This crate hosts the "coordinator", an object which sits at the center of
21//! the system and coordinates communication between the various components.
22//! Responsibilities of the coordinator include:
23//!
24//! * Launching the dataflow workers.
25//! * Periodically allowing the dataflow workers to compact existing data.
26//! * Executing SQL queries from clients by parsing and planning them, sending
27//! the plans to the dataflow layer, and then streaming the results back to
28//! the client.
29//! * Assigning timestamps to incoming source data.
30//!
31//! The main interface to the coordinator is [`Client`]. To start a coordinator,
32//! use the [`serve`] function.
3334// TODO(benesch): delete this once we use structured errors everywhere.
35macro_rules! coord_bail {
36 ($($e:expr),*) => {
37return Err(crate::error::AdapterError::Unstructured(::anyhow::anyhow!($($e),*)))
38 }
39}
4041mod active_compute_sink;
42mod command;
43mod coord;
44mod error;
45mod explain;
46mod notice;
47mod optimize;
48mod util;
4950pub mod catalog;
51pub mod client;
52pub mod config;
53pub mod continual_task;
54pub mod flags;
55pub mod metrics;
56pub mod session;
57pub mod statement_logging;
58pub mod telemetry;
59pub mod webhook;
6061pub use crate::client::{Client, Handle, SessionClient};
62pub use crate::command::{ExecuteResponse, ExecuteResponseKind, RowsFuture, StartupResponse};
63pub use crate::coord::ExecuteContext;
64pub use crate::coord::ExecuteContextExtra;
65pub use crate::coord::id_bundle::CollectionIdBundle;
66pub use crate::coord::peek::PeekResponseUnary;
67pub use crate::coord::read_policy::ReadHolds;
68pub use crate::coord::timeline::TimelineContext;
69pub use crate::coord::timestamp_selection::{
70 TimestampContext, TimestampExplanation, TimestampProvider,
71};
72pub use crate::coord::{Config, load_remote_system_parameters, serve};
73pub use crate::error::AdapterError;
74pub use crate::notice::AdapterNotice;
75pub use crate::util::{ResultExt, verify_datum_desc};
76pub use crate::webhook::{
77 AppendWebhookError, AppendWebhookResponse, AppendWebhookValidator, WebhookAppenderCache,
78};