Skip to main content

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    /// Whether arrangements on this replica request dictionary compression.
21    ///
22    /// This carries the configured value. Whether the replica honors it is
23    /// gated at replica creation by the `enable_arrangement_dictionary_compression_alpha`
24    /// feature flag.
25    pub arrangement_compression: bool,
26}
27
28/// Logging configuration of a replica.
29#[derive(
30    Clone,
31    Debug,
32    Default,
33    Eq,
34    PartialEq,
35    Ord,
36    PartialOrd,
37    Serialize,
38    Deserialize
39)]
40pub struct ComputeReplicaLogging {
41    /// Whether to enable logging for the logging dataflows.
42    pub log_logging: bool,
43    /// The interval at which to log.
44    ///
45    /// A `None` value indicates that logging is disabled.
46    pub interval: Option<Duration>,
47}
48
49impl ComputeReplicaLogging {
50    /// Return whether logging is enabled.
51    pub fn enabled(&self) -> bool {
52        self.interval.is_some()
53    }
54}