rustfs_tls_runtime/config.rs
1// Copyright 2024 RustFS Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use std::time::Duration;
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq)]
18pub enum ReloadDetectMode {
19 Poll,
20 Watch, // TODO: implement fs::watch-based reload
21 Hybrid, // TODO: implement poll + fs::watch hybrid
22}
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub enum ReloadApplyHint {
26 Lazy,
27 SoftReconnect,
28}
29
30#[derive(Debug, Clone, PartialEq, Eq)]
31pub struct TlsReloadOptions {
32 pub enabled: bool,
33 pub detect_mode: ReloadDetectMode,
34 pub interval: Duration,
35 pub debounce: Duration,
36 pub min_stable_age: Duration,
37 pub apply_hint: ReloadApplyHint,
38}
39
40impl Default for TlsReloadOptions {
41 fn default() -> Self {
42 Self {
43 enabled: true,
44 detect_mode: ReloadDetectMode::Poll,
45 interval: Duration::from_secs(15),
46 debounce: Duration::from_secs(2),
47 min_stable_age: Duration::from_secs(1),
48 apply_hint: ReloadApplyHint::Lazy,
49 }
50 }
51}