1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

#![cfg_attr(nightly_doc_features, feature(doc_cfg))]

//! Coordinates client requests with the dataflow layer.
//!
//! This crate hosts the "coordinator", an object which sits at the center of
//! the system and coordinates communication between the various components.
//! Responsibilities of the coordinator include:
//!
//!   * Launching the dataflow workers.
//!   * Periodically allowing the dataflow workers to compact existing data.
//!   * Executing SQL queries from clients by parsing and planning them, sending
//!     the plans to the dataflow layer, and then streaming the results back to
//!     the client.
//!   * Assigning timestamps to incoming source data.
//!
//! The main interface to the coordinator is [`Client`]. To start a coordinator,
//! use the [`serve`] function.

// TODO(benesch): delete this once we use structured errors everywhere.
macro_rules! coord_bail {
    ($($e:expr),*) => {
        return Err(crate::error::CoordError::Unstructured(::anyhow::anyhow!($($e),*)))
    }
}

mod client;
mod command;
mod coord;
mod error;
mod id_alloc;
mod persistcfg;
mod sink_connector;
mod tail;
mod util;

pub mod catalog;
pub mod session;

pub use crate::client::{Client, ConnClient, Handle, SessionClient};
pub use crate::command::{Canceled, ExecuteResponse, StartupMessage, StartupResponse};
pub use crate::coord::{serve, Config, LoggingConfig};
pub use crate::error::CoordError;
pub use crate::persistcfg::{
    PersistConfig, PersistFileStorage, PersistS3Storage, PersistStorage, PersisterWithConfig,
};