Skip to main content

pipeline/
lib.rs

1// Copyright 2023 Greptime 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
15mod dispatcher;
16pub mod error;
17mod etl;
18mod manager;
19mod metrics;
20pub mod options;
21mod tablesuffix;
22
23pub use etl::ctx_req::{ContextOpt, ContextReq};
24pub use etl::processor::Processor;
25pub use etl::transform::GreptimeTransformer;
26pub use etl::transform::transformer::greptime::{GreptimePipelineParams, SchemaInfo};
27pub use etl::transform::transformer::identity_pipeline;
28pub use etl::{
29    Content, DispatchedTo, Pipeline, PipelineExecOutput, PipelineProcessOutput, TransformedOutput,
30    TransformerMode, parse,
31};
32pub use manager::{
33    GREPTIME_INTERNAL_IDENTITY_PIPELINE_NAME, GREPTIME_INTERNAL_TRACE_PIPELINE_V1_NAME,
34    GREPTIME_INTERNAL_TRACE_PIPELINE_V2_NAME, IdentityTimeIndex, PipelineContext,
35    PipelineDefinition, PipelineInfo, PipelineRef, PipelineTableRef, PipelineVersion, PipelineWay,
36    SelectInfo, pipeline_operator, table, util,
37};
38pub use options::PipelineOptions;
39
40#[macro_export]
41macro_rules! unwrap_or_continue_if_err {
42    ($result:expr, $condition:expr) => {{
43        match $result {
44            Ok(value) => value,
45            Err(e) => {
46                if $condition {
47                    continue;
48                } else {
49                    return Err(e);
50                }
51            }
52        }
53    }};
54}
55
56pub fn truthy<V: AsRef<str>>(v: V) -> bool {
57    let v = v.as_ref().to_lowercase();
58    v == "true" || v == "1" || v == "yes" || v == "on" || v == "t"
59}