• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

getdozer / dozer / 5923086724

21 Aug 2023 07:05AM UTC coverage: 74.763% (-1.2%) from 75.988%
5923086724

push

github

web-flow
chore: Remove short form of `enable_progress` because it's conflicting with `dozer cloud` (#1876)

46105 of 61668 relevant lines covered (74.76%)

39792.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.92
/dozer-cli/src/utils.rs
1
use dozer_cache::{cache::CacheManagerOptions, dozer_log::replication::LogOptions};
2
use dozer_core::executor::ExecutorOptions;
3
use dozer_types::models::{
4
    api_config::{
5
        default_api_grpc, default_api_rest, default_app_grpc, AppGrpcOptions, GrpcApiOptions,
6
        RestApiOptions,
7
    },
8
    api_security::ApiSecurity,
9
    app_config::{
10
        default_app_buffer_size, default_commit_size, default_commit_timeout,
11
        default_error_threshold, default_log_entry_max_size, default_log_max_num_immutable_entries,
12
    },
13
    config::{default_cache_max_map_size, Config},
14
};
15
use std::time::Duration;
16

17
fn get_cache_max_map_size(config: &Config) -> u64 {
6✔
18
    config
6✔
19
        .cache_max_map_size
6✔
20
        .unwrap_or_else(default_cache_max_map_size)
6✔
21
}
6✔
22

23
fn get_commit_time_threshold(config: &Config) -> Duration {
6✔
24
    Duration::from_millis(
6✔
25
        config
6✔
26
            .app
6✔
27
            .as_ref()
6✔
28
            .and_then(|app| app.commit_timeout)
6✔
29
            .unwrap_or_else(default_commit_timeout),
6✔
30
    )
6✔
31
}
6✔
32

33
fn get_buffer_size(config: &Config) -> u32 {
6✔
34
    config
6✔
35
        .app
6✔
36
        .as_ref()
6✔
37
        .and_then(|app| app.app_buffer_size)
6✔
38
        .unwrap_or_else(default_app_buffer_size)
6✔
39
}
6✔
40

41
fn get_commit_size(config: &Config) -> u32 {
6✔
42
    config
6✔
43
        .app
6✔
44
        .as_ref()
6✔
45
        .and_then(|app| app.commit_size)
6✔
46
        .unwrap_or_else(default_commit_size)
6✔
47
}
6✔
48

49
fn get_error_threshold(config: &Config) -> u32 {
6✔
50
    config
6✔
51
        .app
6✔
52
        .as_ref()
6✔
53
        .and_then(|app| app.error_threshold)
6✔
54
        .unwrap_or_else(default_error_threshold)
6✔
55
}
6✔
56

57
pub fn get_log_options(config: &Config) -> LogOptions {
12✔
58
    let app = config.app.as_ref();
12✔
59
    let storage_config = app
12✔
60
        .and_then(|app| app.log_storage.clone())
12✔
61
        .unwrap_or_default();
12✔
62
    let entry_max_size = app
12✔
63
        .and_then(|app| app.log_entry_max_size)
12✔
64
        .unwrap_or_else(default_log_entry_max_size) as usize;
12✔
65
    let max_num_immutable_entries =
12✔
66
        app.and_then(|app| app.log_max_num_immutable_entries)
12✔
67
            .unwrap_or_else(default_log_max_num_immutable_entries) as usize;
12✔
68
    LogOptions {
12✔
69
        storage_config,
12✔
70
        entry_max_size,
12✔
71
        max_num_immutable_entries,
12✔
72
    }
12✔
73
}
12✔
74

×
75
pub fn get_grpc_config(config: &Config) -> GrpcApiOptions {
6✔
76
    config
6✔
77
        .api
6✔
78
        .as_ref()
6✔
79
        .and_then(|api| api.grpc.clone())
6✔
80
        .unwrap_or_else(default_api_grpc)
6✔
81
}
6✔
82

×
83
pub fn get_rest_config(config: &Config) -> RestApiOptions {
6✔
84
    config
6✔
85
        .api
6✔
86
        .as_ref()
6✔
87
        .and_then(|api| api.rest.clone())
6✔
88
        .unwrap_or_else(default_api_rest)
6✔
89
}
6✔
90

×
91
pub fn get_app_grpc_config(config: &Config) -> AppGrpcOptions {
12✔
92
    config
12✔
93
        .api
12✔
94
        .as_ref()
12✔
95
        .and_then(|api| api.app_grpc.clone())
12✔
96
        .unwrap_or_else(default_app_grpc)
12✔
97
}
12✔
98

×
99
pub fn get_api_security_config(config: &Config) -> Option<&ApiSecurity> {
12✔
100
    config
12✔
101
        .api
12✔
102
        .as_ref()
12✔
103
        .and_then(|api| api.api_security.as_ref())
12✔
104
}
12✔
105

106
pub fn get_executor_options(config: &Config) -> ExecutorOptions {
6✔
107
    ExecutorOptions {
6✔
108
        commit_sz: get_commit_size(config),
6✔
109
        channel_buffer_sz: get_buffer_size(config) as usize,
6✔
110
        commit_time_threshold: get_commit_time_threshold(config),
6✔
111
        error_threshold: Some(get_error_threshold(config)),
6✔
112
    }
6✔
113
}
6✔
114

115
pub fn get_cache_manager_options(config: &Config) -> CacheManagerOptions {
6✔
116
    CacheManagerOptions {
6✔
117
        path: Some(config.cache_dir.clone().into()),
6✔
118
        max_size: get_cache_max_map_size(config) as usize,
6✔
119
        ..CacheManagerOptions::default()
6✔
120
    }
6✔
121
}
6✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc