@cryptotaxi247 / netdata-1 / commits / 2ec714523

generates dual ksy for njfv2 + fix for padding after page blocks (#14383)

* add ability to generate different ksys * fix dist * fix page_block by metric count instead of till EOF

Timotej S committed Feb 9, 2023 at 10:18 UTC 2ec714523a071f0b72cf91ce1fe8e412bf97509a
4 files changed +37 -11
.gitattributes
+1
@@ -1,2 +1,3 @@
1 *.c diff=cpp
2 *.h diff=cpp
3 +*.ksy.in linguist-language=ksy
.gitignore
+4
@@ -231,3 +231,7 @@ Session.*.vim
231 # Judy stuff
232 JudyLTables.c
233 judyltablesgen
234 +
235 +# m4 generated ksys
236 +database/engine/journalfile_v2.ksy
237 +database/engine/journalfile_v2_virtmemb.ksy
Makefile.am
+15
@@ -78,6 +78,7 @@ dist_noinst_DATA = \
78 packaging/protobuf.checksums \
79 packaging/protobuf.version \
80 packaging/version \
81 + database/engine/journalfile_v2.ksy.in \
82 $(NULL)
83
84 # until integrated within build
@@ -555,6 +556,20 @@ if ENABLE_DBENGINE
556 database/engine/pdc.c \
557 database/engine/pdc.h \
558 $(NULL)
559 +
560 + RRD_PLUGIN_KSY_BUILTFILES = \
561 + database/engine/journalfile_v2.ksy \
562 + database/engine/journalfile_v2_virtmemb.ksy \
563 + $(NULL)
564 +
565 + BUILT_SOURCES += $(RRD_PLUGIN_KSY_BUILTFILES)
566 + CLEANFILES += $(RRD_PLUGIN_KSY_BUILTFILES)
567 +
568 +database/engine/journalfile_v2.ksy: $(abs_top_srcdir)/database/engine/journalfile_v2.ksy.in
569 + m4 $(abs_top_srcdir)/database/engine/journalfile_v2.ksy.in > $@
570 +
571 +database/engine/journalfile_v2_virtmemb.ksy: $(abs_top_srcdir)/database/engine/journalfile_v2.ksy.in
572 + m4 -DVIRT_MEMBERS $(abs_top_srcdir)/database/engine/journalfile_v2.ksy.in > $@
573 endif
574
575 API_PLUGIN_FILES = \
database/engine/journalfile_v2.ksy.in renamed
+17 -11
@@ -1,6 +1,9 @@
1 meta:
2 - id: netdata_journalfile_v2
2 + id: journalfile_v2`'ifdef(`VIRT_MEMBERS',`_virtmemb')
3 endian: le
4 + application: netdata
5 + file-extension: njfv2
6 + license: GPL-3.0-or-later
7
8 seq:
9 - id: journal_v2_header
@@ -19,12 +22,14 @@ seq:
22 - id: metric_trailer
23 type: journal_v2_block_trailer
24 - id: page_blocs
22 - type: jounral_v2_page_blocs
25 + type: journal_v2_page_block
26 + repeat: expr
27 + repeat-expr: _root.journal_v2_header.metric_count
28 + - id: padding
29 size: _root._io.size - _root._io.pos - 4
30 - id: journal_file_trailer
31 type: journal_v2_block_trailer
32
27 -
33 types:
34 journal_v2_metric_list:
35 seq:
@@ -38,11 +43,13 @@ types:
43 type: u4
44 - id: delta_end_s
45 type: u4
41 - instances:
46 +ifdef(`VIRT_MEMBERS',
47 +` instances:
48 page_block:
49 type: journal_v2_page_block
50 io: _root._io
51 pos: page_offset
52 +')dnl
53 journal_v2_page_hdr:
54 seq:
55 - id: crc
@@ -69,11 +76,13 @@ types:
76 type: u1
77 - id: reserved
78 type: u1
72 - instances:
79 +ifdef(`VIRT_MEMBERS',
80 +` instances:
81 extent:
82 io: _root._io
83 type: journal_v2_extent_list
84 pos: _root.journal_v2_header.extent_offset + (extent_idx * 16)
85 +')dnl
86 journal_v2_header:
87 seq:
88 - id: magic
@@ -106,11 +115,13 @@ types:
115 type: u4
116 - id: data
117 type: u8
109 - instances:
118 +ifdef(`VIRT_MEMBERS',
119 +` instances:
120 trailer:
121 io: _root._io
122 type: journal_v2_block_trailer
123 pos: _root._io.size - 4
124 +')dnl
125 journal_v2_block_trailer:
126 seq:
127 - id: checksum
@@ -137,8 +148,3 @@ types:
148 repeat-expr: hdr.entries
149 - id: block_trailer
150 type: journal_v2_block_trailer
140 - jounral_v2_page_blocs:
141 - seq:
142 - - id: blocs
143 - type: journal_v2_page_block
144 - repeat: eos