risingwave_common/
constants.rs1pub mod hummock {
16
17 use bitflags::bitflags;
18 bitflags! {
19
20 #[derive(Default)]
21 pub struct CompactionFilterFlag: u32 {
22 const NONE = 0b00000000;
23 const STATE_CLEAN = 0b00000010;
24 const TTL = 0b00000100;
25 }
26 }
27
28 impl From<CompactionFilterFlag> for u32 {
29 fn from(flag: CompactionFilterFlag) -> Self {
30 flag.bits()
31 }
32 }
33}
34
35pub mod log_store {
36 use crate::types::DataType;
37 use crate::util::sort_util::OrderType;
38
39 pub const EPOCH_COLUMN_NAME: &str = "kv_log_store_epoch";
40 pub const SEQ_ID_COLUMN_NAME: &str = "kv_log_store_seq_id";
41 pub const ROW_OP_COLUMN_NAME: &str = "kv_log_store_row_op";
42 pub const VNODE_COLUMN_NAME: &str = "kv_log_store_vnode";
43
44 pub const EPOCH_COLUMN_TYPE: DataType = DataType::Int64;
45 pub const SEQ_ID_COLUMN_TYPE: DataType = DataType::Int32;
46 pub const ROW_OP_COLUMN_TYPE: DataType = DataType::Int16;
47 pub const VNODE_COLUMN_TYPE: DataType = DataType::Int16;
48
49 pub mod v1 {
50 use std::sync::LazyLock;
51
52 use super::*;
53
54 pub const KV_LOG_STORE_PREDEFINED_COLUMNS: [(&str, DataType); 3] = [
56 (EPOCH_COLUMN_NAME, EPOCH_COLUMN_TYPE),
57 (SEQ_ID_COLUMN_NAME, SEQ_ID_COLUMN_TYPE),
58 (ROW_OP_COLUMN_NAME, ROW_OP_COLUMN_TYPE),
59 ];
60
61 pub const EPOCH_COLUMN_INDEX: usize = 0;
62 pub const SEQ_ID_COLUMN_INDEX: usize = 1;
63 pub const ROW_OP_COLUMN_INDEX: usize = 2;
64
65 pub static PK_ORDERING: LazyLock<[OrderType; 2]> =
67 LazyLock::new(|| [OrderType::ascending(), OrderType::ascending_nulls_last()]);
68 }
69
70 pub mod v2 {
71 use std::sync::LazyLock;
72
73 use super::*;
74
75 pub const KV_LOG_STORE_PREDEFINED_COLUMNS: [(&str, DataType); 4] = [
77 (EPOCH_COLUMN_NAME, EPOCH_COLUMN_TYPE),
78 (SEQ_ID_COLUMN_NAME, SEQ_ID_COLUMN_TYPE),
79 (VNODE_COLUMN_NAME, VNODE_COLUMN_TYPE),
80 (ROW_OP_COLUMN_NAME, ROW_OP_COLUMN_TYPE),
81 ];
82
83 pub const EPOCH_COLUMN_INDEX: usize = 0;
84 pub const SEQ_ID_COLUMN_INDEX: usize = 1;
85 pub const VNODE_COLUMN_INDEX: usize = 2;
86 pub const ROW_OP_COLUMN_INDEX: usize = 3;
87
88 pub static PK_ORDERING: LazyLock<[OrderType; 3]> = LazyLock::new(|| {
89 [
90 OrderType::ascending(),
91 OrderType::ascending_nulls_last(),
92 OrderType::ascending(),
93 ]
94 });
95 }
96}