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 COL_FLAG_HAS_NONES: u8 = 1 << 0;
21
22#[derive(Debug, Clone, Copy, PartialEq, Eq)]
23#[repr(u8)]
24pub enum Encoding {
25 Plain = 0,
26
27 Dict = 1,
28
29 Rle = 2,
30
31 Delta = 3,
32
33 BitPack = 4,
34
35 DeltaRle = 5,
36}
37
38impl Encoding {
39 pub fn from_u8(v: u8) -> Option<Encoding> {
40 match v {
41 0 => Some(Encoding::Plain),
42 1 => Some(Encoding::Dict),
43 2 => Some(Encoding::Rle),
44 3 => Some(Encoding::Delta),
45 4 => Some(Encoding::BitPack),
46 5 => Some(Encoding::DeltaRle),
47 _ => None,
48 }
49 }
50}
51
52pub fn dict_index_width_from_flags(flags: u8) -> usize {
53 match (flags >> 4) & 0x03 {
54 0 => 1,
55 1 => 2,
56 2 => 4,
57 _ => 4,
58 }
59}
60
61pub fn dict_index_width_to_flags(width: usize) -> u8 {
62 match width {
63 1 => 0 << 4,
64 2 => 1 << 4,
65 4 => 2 << 4,
66 _ => 2 << 4,
67 }
68}