mito2/series_index/artifact.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//! Immutable, potentially multi-object format outputs.
16
17use serde::{Deserialize, Serialize};
18use store_api::storage::FileId;
19
20/// Persisted artifact identifiers. Concrete codecs are added with their implementations.
21#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
22pub(crate) enum ArtifactFormat {
23 #[serde(rename = "columnar-series")]
24 ColumnarSeries,
25 #[serde(rename = "columnar-samples")]
26 ColumnarSamples,
27}
28
29/// One immutable object produced by a backend build.
30#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
31pub(crate) struct ArtifactObject {
32 pub(crate) path: String,
33 pub(crate) file_size: u64,
34}
35
36/// Identifies the exact bytes produced by one backend build.
37#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
38pub(crate) struct ArtifactMetadata {
39 pub(crate) format: ArtifactFormat,
40 pub(crate) generation: FileId,
41 /// Every object owned by this build, including metadata and auxiliary files.
42 pub(crate) objects: Vec<ArtifactObject>,
43 pub(crate) file_size: u64,
44}