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(Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]
24pub struct ComputeReplicaLogging {
25    /// Whether to enable logging for the logging dataflows.
26    pub log_logging: bool,
27    /// The interval at which to log.
28    ///
29    /// A `None` value indicates that logging is disabled.
30    pub interval: Option<Duration>,
31}
32
33impl ComputeReplicaLogging {
34    /// Return whether logging is enabled.
35    pub fn enabled(&self) -> bool {
36        self.interval.is_some()
37    }
38}