summaryrefslogtreecommitdiffstats
path: root/database/engine/journalfile_v2.ksy.in
blob: 6a656bc454465cfe726f1ed14f2a200624dd752f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
meta:
  id: journalfile_v2`'ifdef(`VIRT_MEMBERS',`_virtmemb')
  endian: le
  application: netdata
  file-extension: njfv2
  license: GPL-3.0-or-later

seq:
  - id: journal_v2_header
    type: journal_v2_header
    size: 4096
  - id: extent_list
    type: journal_v2_extent_list
    repeat: expr
    repeat-expr: journal_v2_header.extent_count
  - id: extent_trailer
    type: journal_v2_block_trailer
  - id: metric_list
    type: journal_v2_metric_list
    repeat: expr
    repeat-expr: journal_v2_header.metric_count
  - id: metric_trailer
    type: journal_v2_block_trailer
  - id: page_blocs
    type: journal_v2_page_block
    repeat: expr
    repeat-expr: _root.journal_v2_header.metric_count
  - id: padding
    size: _root._io.size - _root._io.pos - 4
  - id: journal_file_trailer
    type: journal_v2_block_trailer

types:
  journal_v2_metric_list:
    seq:
      - id: uuid
        size: 16
      - id: entries
        type: u4
      - id: page_offset
        type: u4
      - id: delta_start_s
        type: u4
      - id: delta_end_s
        type: u4
ifdef(`VIRT_MEMBERS',
`    instances:
      page_block:
        type: journal_v2_page_block
        io: _root._io
        pos: page_offset
')dnl
  journal_v2_page_hdr:
    seq:
      - id: crc
        type: u4
      - id: uuid_offset
        type: u4
      - id: entries
        type: u4
      - id: uuid
        size: 16
  journal_v2_page_list:
    seq:
      - id: delta_start_s
        type: u4
      - id: delta_end_s
        type: u4
      - id: extent_idx
        type: u4
      - id: update_every_s
        type: u4
      - id: page_len
        type: u2
      - id: type
        type: u1
      - id: reserved
        type: u1
ifdef(`VIRT_MEMBERS',
`    instances:
      extent:
        io: _root._io
        type: journal_v2_extent_list
        pos: _root.journal_v2_header.extent_offset + (extent_idx * 16)
')dnl
  journal_v2_header:
    seq:
      - id: magic
        contents: [ 0x19, 0x10, 0x22, 0x01 ] #0x01221019
      - id: reserved
        type: u4
      - id: start_time_ut
        type: u8
      - id: end_time_ut
        type: u8
      - id: extent_count
        type: u4
      - id: extent_offset
        type: u4
      - id: metric_count
        type: u4
      - id: metric_offset
        type: u4
      - id: page_count
        type: u4
      - id: page_offset
        type: u4
      - id: extent_trailer_offset
        type: u4
      - id: metric_trailer_offset
        type: u4
      - id: original_file_size
        type: u4
      - id: total_file_size
        type: u4
      - id: data
        type: u8
ifdef(`VIRT_MEMBERS',
`    instances:
      trailer:
        io: _root._io
        type: journal_v2_block_trailer
        pos: _root._io.size - 4
')dnl
  journal_v2_block_trailer:
    seq:
      - id: checksum
        type: u4
  journal_v2_extent_list:
    seq:
      - id: datafile_offset
        type: u8
      - id: datafile_size
        type: u4
      - id: file_idx
        type: u2
      - id: page_cnt
        type: u1
      - id: padding
        type: u1
  journal_v2_page_block:
    seq:
      - id: hdr
        type: journal_v2_page_hdr
      - id: page_list
        type: journal_v2_page_list
        repeat: expr
        repeat-expr: hdr.entries
      - id: block_trailer
        type: journal_v2_block_trailer