Skip to content

Commit 795d69a

Browse files
committed
add config option for beast dump compression level
1 parent bfc4a0b commit 795d69a

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

help.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static struct argp_option optionsReadsb[] = {
102102
{"write-state-only-on-exit", OptStateOnlyOnExit, 0, 0, "Don't continously update state.", 1},
103103
{"heatmap-dir", OptHeatmapDir, "<dir>", 0, "Change the directory where heatmaps are saved (default is in globe history dir)", 1},
104104
{"heatmap", OptHeatmap, "<interval in seconds>", 0, "Make Heatmap, each aircraft at most every interval seconds (creates historydir/heatmap.bin and exit after that)", 1},
105-
{"dump-beast", OptDumpBeastDir, "<dir>,<interval>", 0, "Dump compressed beast files to this directory, start a new file evey interval seconds", 1},
105+
{"dump-beast", OptDumpBeastDir, "<dir>,<interval>,<compressionLevel>", 0, "Dump compressed beast files to this directory, start a new file evey interval seconds", 1},
106106
{"write-json-every", OptJsonTime, "<sec>", 0, "Write json output and update API json every sec seconds (default 1)", 1},
107107
{"json-location-accuracy", OptJsonLocAcc , "<n>", 0, "Accuracy of receiver location in json metadata: 0=no location, 1=approximate, 2=exact", 1},
108108
{"write-json-globe-index", OptJsonGlobeIndex, 0, 0, "Write specially indexed globe_xxxx.json files (for tar1090)", 1},

readsb.c

+2
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ static void configSetDefaults(void) {
233233

234234
// in seconds, default to 1 hour
235235
Modes.dump_interval = 60 * 60;
236+
Modes.dump_compressionLevel = 4;
236237

237238

238239
Modes.ping_reduce = PING_REDUCE;
@@ -1757,6 +1758,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
17571758
sfree(Modes.dump_beast_dir);
17581759
Modes.dump_beast_dir = strdup(token[0]);
17591760
if (token[1]) { Modes.dump_interval = atoi(token[1]); }
1761+
if (token[2]) { Modes.dump_compressionLevel = atoi(token[2]); }
17601762
// enable networking as this is required
17611763
Modes.net = 1;
17621764

readsb.h

+1
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ struct _Modes
821821
int32_t dump_interval;
822822
int32_t dump_beast_index;
823823
uint64_t dump_lastReceiverId;
824+
int8_t dump_compressionLevel;
824825
int8_t writeTraces;
825826
int8_t dump_reduce; // only dump beast that would be sent out according to reduce_interval
826827
int8_t state_only_on_exit;

util.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ void dump_beast_check(int64_t now) {
11261126
}
11271127

11281128
// start new file
1129-
zstdFwStartFile(fw, pathbuf, 4);
1129+
zstdFwStartFile(fw, pathbuf, Modes.dump_compressionLevel);
11301130

11311131
//fprintf(stderr, "dump_beast started file: %s\n", pathbuf);
11321132
}

0 commit comments

Comments
 (0)