The use case I have is this:
- I have a C++ app that buffers some network events (for e.g., DNS name, start time, end time) in memory.
- Periodically, a timer pops and I want to write the buffered events to disk.
- Rinse and repeat.
and finally,
- A standalone Java application reads the file on disk to get the network events.
I wanted to keep things really simple (a header-only library, cross platform support, simple API, etc.) and so thought flatbuffers might be an ideal solution. The only hitch is that I want to be able to append these network events to the file on disk.
So, a flatbuffer schema might look like this:
namespace NetworkEvents.Dns;
struct TimedEvent {
start: ulong;
end: ulong;
}
table DNSEvent {
name:string;
timestamp: TimedEvent;
}
I want to be able to write a bunch of 'DNSEvent' records every time the timer pops and there is stuff to write out. However, I am stumped as to how do I keep appending these records to this disk while still being able to maintain the overall flatbuffer structure (vtable, and such). Is there a work around for such a use case? I tried to search online, but there aren't enough literature on such things and hence this post.
Thanks,
Karthik