mz_compute_types/config.rs
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.
9
10//! Compute configuration types.
11
12use serde::{Deserialize, Serialize};
13use std::time::Duration;
14
15/// Replica configuration
16#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
17pub struct ComputeReplicaConfig {
18 /// TODO(database-issues#7533): Add documentation.
19 pub logging: ComputeReplicaLogging,
20}
21
22/// Logging configuration of a replica.
23#[derive(
24 Clone,
25 Debug,
26 Default,
27 Eq,
28 PartialEq,
29 Ord,
30 PartialOrd,
31 Serialize,
32 Deserialize
33)]
34pub struct ComputeReplicaLogging {
35 /// Whether to enable logging for the logging dataflows.
36 pub log_logging: bool,
37 /// The interval at which to log.
38 ///
39 /// A `None` value indicates that logging is disabled.
40 pub interval: Option<Duration>,
41}
42
43impl ComputeReplicaLogging {
44 /// Return whether logging is enabled.
45 pub fn enabled(&self) -> bool {
46 self.interval.is_some()
47 }
48}