store_api/
sst_entry.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
15use common_time::Timestamp;
16use serde::{Deserialize, Serialize};
17
18use crate::storage::{RegionGroup, RegionId, RegionNumber, RegionSeq, TableId};
19
20/// An entry describing a SST file known by the engine's manifest.
21#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
22pub struct ManifestSstEntry {
23    /// The table directory this file belongs to.
24    pub table_dir: String,
25    /// The region id this file belongs to.
26    pub region_id: RegionId,
27    /// The table id this file belongs to.
28    pub table_id: TableId,
29    /// The region number this file belongs to.
30    pub region_number: RegionNumber,
31    /// The region group this file belongs to.
32    pub region_group: RegionGroup,
33    /// The region sequence this file belongs to.
34    pub region_sequence: RegionSeq,
35    /// Engine-specific file identifier (string form).
36    pub file_id: String,
37    /// SST level.
38    pub level: u8,
39    /// Full path of the SST file in object store.
40    pub file_path: String,
41    /// File size in bytes.
42    pub file_size: u64,
43    /// Full path of the index file in object store.
44    pub index_file_path: Option<String>,
45    /// File size of the index file in object store.
46    pub index_file_size: Option<u64>,
47    /// Number of rows in the SST.
48    pub num_rows: u64,
49    /// Number of row groups in the SST.
50    pub num_row_groups: u64,
51    /// Min timestamp.
52    pub min_ts: Timestamp,
53    /// Max timestamp.
54    pub max_ts: Timestamp,
55    /// The sequence number associated with this file.
56    pub sequence: Option<u64>,
57}
58
59/// An entry describing a SST file listed from storage layer directly.
60#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
61pub struct StorageSstEntry {
62    /// Full path of the SST file in object store.
63    pub file_path: String,
64    /// File size in bytes.
65    pub file_size: Option<u64>,
66    /// Last modified time in milliseconds since epoch, if available from storage.
67    pub last_modified_ms: Option<Timestamp>,
68}