metric_engine/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//! Metric Engine is a region engine to store timeseries data in metric monitoring
16//! scenario. It is something like a multiplexer over the [Mito](mito2::engine::MitoEngine)
17//! engine, which is for a more generic use case. By leveraging a synthetic wide physical
18//! table (region) that offers storage for multiple logical tables, Metric Engine is able to
19//! provide a more efficient storage solution that is able to handle a tremendous number of
20//! small tables in scenarios like Prometheus metrics.
21//!
22//! For more details about implementation, please refer to [MetricEngine](crate::engine::MetricEngine).
23//!
24//! This new engine doesn't re-implement low level components like file R/W etc. It warps the
25//! existing mito engine, with extra storage and metadata multiplexing logic. I.e., it expose
26//! multiple logical regions based on two physical mito engine regions like this:
27//!
28//! ```plaintext
29//! ┌───────────────┐ ┌───────────────┐ ┌───────────────┐
30//! │ Metric Engine │ │ Metric Engine │ │ Metric Engine │
31//! │ Region 1 │ │ Region 2 │ │ Region 3 │
32//! └───────────────┘ └───────────────┘ └───────────────┘
33//! ▲ ▲ ▲
34//! │ │ │
35//! └───────────────┼───────────────────┘
36//! │
37//! ┌─────────┴────────┐
38//! │ Metric Region │
39//! │ Engine │
40//! │ ┌─────────────┤
41//! │ │ Mito Region │
42//! │ │ Engine │
43//! └────▲─────────────┘
44//! │
45//! │
46//! ┌─────┴───────────────┐
47//! │ │
48//! │ Mito Engine Regions │
49//! │ │
50//! └─────────────────────┘
51//! ```
52
53#![feature(let_chains)]
54#![feature(assert_matches)]
55
56pub mod config;
57mod data_region;
58pub mod engine;
59pub mod error;
60mod metadata_region;
61mod metrics;
62mod repeated_task;
63pub mod row_modifier;
64#[cfg(test)]
65mod test_util;
66mod utils;