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;
20mod tablesuffix;
21
22pub use etl::ctx_req::{ContextOpt, ContextReq};
23pub use etl::processor::Processor;
24pub use etl::transform::transformer::greptime::{GreptimePipelineParams, SchemaInfo};
25pub use etl::transform::transformer::identity_pipeline;
26pub use etl::transform::GreptimeTransformer;
27pub use etl::value::{Array, Map, Value};
28pub use etl::{
29    json_array_to_map, json_to_map, parse, simd_json_array_to_map, simd_json_to_map, Content,
30    DispatchedTo, Pipeline, PipelineExecOutput, TransformedOutput, TransformerMode,
31};
32pub use manager::{
33    pipeline_operator, table, util, IdentityTimeIndex, PipelineContext, PipelineDefinition,
34    PipelineInfo, PipelineRef, PipelineTableRef, PipelineVersion, PipelineWay, SelectInfo,
35    GREPTIME_INTERNAL_IDENTITY_PIPELINE_NAME, GREPTIME_INTERNAL_TRACE_PIPELINE_V1_NAME,
36};
37
38#[macro_export]
39macro_rules! unwrap_or_continue_if_err {
40    ($result:expr, $condition:expr) => {{
41        match $result {
42            Ok(value) => value,
43            Err(e) => {
44                if $condition {
45                    continue;
46                } else {
47                    return Err(e);
48                }
49            }
50        }
51    }};
52}
53
54#[macro_export]
55macro_rules! unwrap_or_warn_continue {
56    ($expr:expr, $msg:expr) => {
57        if let Some(value) = $expr {
58            value
59        } else {
60            warn!($msg);
61            continue;
62        }
63    };
64
65    ($expr:expr, $fmt:expr, $($arg:tt)*) => {
66        if let Some(value) = $expr {
67            value
68        } else {
69            warn!($fmt, $($arg)*);
70            continue;
71        }
72    };
73}