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