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

getdozer / dozer / 6299724219

25 Sep 2023 12:58PM UTC coverage: 77.81% (+0.5%) from 77.275%
6299724219

push

github

chubei
fix: Add `BINDGEN_EXTRA_CLANG_ARGS` to cross compile rocksdb

50223 of 64546 relevant lines covered (77.81%)

148909.49 hits per line

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

29.69
/dozer-cli/src/lib.rs
1
pub mod cli;
2
pub mod errors;
3
pub mod live;
4
pub mod pipeline;
5
pub mod shutdown;
6
pub mod simple;
7
use dozer_core::{app::AppPipeline, errors::ExecutionError};
8
use dozer_sql::{builder::statement_to_pipeline, errors::PipelineError};
9
use dozer_types::log::debug;
10
use errors::OrchestrationError;
11
use shutdown::ShutdownSender;
12
use std::{
13
    backtrace::{Backtrace, BacktraceStatus},
14
    panic, process,
15
    thread::current,
16
};
17
use tokio::task::JoinHandle;
18
#[cfg(feature = "cloud")]
19
pub mod cloud_app_context;
20
#[cfg(feature = "cloud")]
21
mod cloud_helper;
22
pub mod config_helper;
23
pub mod console_helper;
24
#[cfg(test)]
25
mod tests;
26
mod utils;
27

28
#[cfg(feature = "cloud")]
29
pub trait CloudOrchestrator {
30
    fn deploy(
31
        &mut self,
32
        cloud: Cloud,
33
        deploy: DeployCommandArgs,
34
        config_paths: Vec<String>,
35
    ) -> Result<(), OrchestrationError>;
36
    fn delete(&mut self, cloud: Cloud) -> Result<(), OrchestrationError>;
37
    fn list(&mut self, cloud: Cloud, list: ListCommandArgs) -> Result<(), OrchestrationError>;
38
    fn status(&mut self, cloud: Cloud) -> Result<(), OrchestrationError>;
39
    fn monitor(&mut self, cloud: Cloud) -> Result<(), OrchestrationError>;
40
    fn trace_logs(&mut self, cloud: Cloud, logs: LogCommandArgs) -> Result<(), OrchestrationError>;
41
    fn login(
42
        &mut self,
43
        cloud: Cloud,
44
        organisation_slug: Option<String>,
45
        profile: Option<String>,
46
        client_id: Option<String>,
47
        client_secret: Option<String>,
48
    ) -> Result<(), OrchestrationError>;
49
    fn execute_secrets_command(
50
        &mut self,
51
        cloud: Cloud,
52
        command: SecretsCommand,
53
    ) -> Result<(), OrchestrationError>;
54
}
55

56
// Re-exports
57
pub use dozer_ingestion::{
58
    connectors::{get_connector, TableInfo},
59
    errors::ConnectorError,
60
};
61
pub use dozer_sql::builder::QueryContext;
62
pub fn wrapped_statement_to_pipeline(sql: &str) -> Result<QueryContext, PipelineError> {
×
63
    let mut pipeline = AppPipeline::new_with_default_flags();
×
64
    statement_to_pipeline(sql, &mut pipeline, None, vec![])
×
65
}
×
66

67
#[cfg(feature = "cloud")]
68
use crate::cli::cloud::{
69
    Cloud, DeployCommandArgs, ListCommandArgs, LogCommandArgs, SecretsCommand,
70
};
71
pub use dozer_types::models::connection::Connection;
72
use dozer_types::tracing::error;
73

74
async fn flatten_join_handle(
120✔
75
    handle: JoinHandle<Result<(), OrchestrationError>>,
120✔
76
) -> Result<(), OrchestrationError> {
120✔
77
    match handle.await {
120✔
78
        Ok(Ok(_)) => Ok(()),
120✔
79
        Ok(Err(err)) => Err(err),
×
80
        Err(err) => Err(OrchestrationError::JoinError(err)),
×
81
    }
82
}
120✔
83

84
fn join_handle_map_err<E: Send + 'static>(
30✔
85
    handle: JoinHandle<Result<(), E>>,
30✔
86
    f: impl FnOnce(E) -> OrchestrationError + Send + 'static,
30✔
87
) -> JoinHandle<Result<(), OrchestrationError>> {
30✔
88
    tokio::spawn(async move {
30✔
89
        match handle.await {
30✔
90
            Ok(Ok(_)) => Ok(()),
30✔
91
            Ok(Err(err)) => Err(f(err)),
×
92
            Err(err) => Err(OrchestrationError::JoinError(err)),
×
93
        }
94
    })
30✔
95
}
30✔
96

97
pub fn set_panic_hook() {
5✔
98
    panic::set_hook(Box::new(move |panic_info| {
5✔
99
        // All the orchestrator errors are captured here
100
        if let Some(e) = panic_info.payload().downcast_ref::<OrchestrationError>() {
×
101
            error!("{}", e);
×
102
            debug!("{:?}", e);
×
103
        // All the connector errors are captured here
104
        } else if let Some(e) = panic_info.payload().downcast_ref::<ConnectorError>() {
×
105
            error!("{}", e);
×
106
            debug!("{:?}", e);
×
107
        // All the pipeline errors are captured here
108
        } else if let Some(e) = panic_info.payload().downcast_ref::<ExecutionError>() {
×
109
            error!("{}", e);
×
110
            debug!("{:?}", e);
×
111
        // If any errors are sent as strings.
112
        } else if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
×
113
            error!("{s:?}");
×
114
        } else {
115
            error!("{}", panic_info);
×
116
        }
117

118
        let backtrace = Backtrace::capture();
×
119
        if backtrace.status() == BacktraceStatus::Captured {
×
120
            error!(
×
121
                "thread '{}' panicked at '{}'\n stack backtrace:\n{}",
×
122
                current()
×
123
                    .name()
×
124
                    .map(ToString::to_string)
×
125
                    .unwrap_or_default(),
×
126
                panic_info
×
127
                    .location()
×
128
                    .map(ToString::to_string)
×
129
                    .unwrap_or_default(),
×
130
                backtrace
×
131
            );
×
132
        }
×
133

134
        process::exit(1);
×
135
    }));
5✔
136
}
5✔
137

138
pub fn set_ctrl_handler(shutdown_sender: ShutdownSender) {
×
139
    let mut shutdown = Some(shutdown_sender);
×
140
    ctrlc::set_handler(move || {
×
141
        if let Some(shutdown) = shutdown.take() {
×
142
            shutdown.shutdown()
×
143
        }
×
144
    })
×
145
    .expect("Error setting Ctrl-C handler");
×
146
}
×
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