reifydb_codec/frame/
format.rs1pub const RBCF_MAGIC: u32 = 0x46434252;
5
6pub const RBCF_VERSION: u16 = 1;
7
8pub const MESSAGE_HEADER_SIZE: usize = 16;
9
10pub const FRAME_HEADER_SIZE: usize = 12;
11
12pub const COLUMN_DESCRIPTOR_SIZE: usize = 28;
13
14pub const META_HAS_ROW_NUMBERS: u8 = 1 << 0;
15
16pub const META_HAS_CREATED_AT: u8 = 1 << 1;
17
18pub const META_HAS_UPDATED_AT: u8 = 1 << 2;
19
20pub const META_HAS_TIME: u8 = 1 << 3;
21
22pub const COL_FLAG_HAS_NONES: u8 = 1 << 0;
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25#[repr(u8)]
26pub enum Encoding {
27 Plain = 0,
28
29 Dict = 1,
30
31 Rle = 2,
32
33 Delta = 3,
34
35 BitPack = 4,
36
37 DeltaRle = 5,
38}
39
40impl Encoding {
41 pub fn from_u8(v: u8) -> Option<Encoding> {
42 match v {
43 0 => Some(Encoding::Plain),
44 1 => Some(Encoding::Dict),
45 2 => Some(Encoding::Rle),
46 3 => Some(Encoding::Delta),
47 4 => Some(Encoding::BitPack),
48 5 => Some(Encoding::DeltaRle),
49 _ => None,
50 }
51 }
52}
53
54pub fn dict_index_width_from_flags(flags: u8) -> usize {
55 match (flags >> 4) & 0x03 {
56 0 => 1,
57 1 => 2,
58 2 => 4,
59 _ => 4,
60 }
61}
62
63pub fn dict_index_width_to_flags(width: usize) -> u8 {
64 match width {
65 1 => 0 << 4,
66 2 => 1 << 4,
67 4 => 2 << 4,
68 _ => 2 << 4,
69 }
70}