I'm experimenting with FlatBuffers to store OpenStreetMap data. So, this would be 50GB.
Since usually everything is kept in memory, how is it possible (if at all) to sequentially write data into a file?
I have a feeling this is not quite where FlatBuffers is good for.
To use FlatBuffers in your code, first generate the C++ classes from your schema with the --cpp option to flatc . Then you can include both FlatBuffers and the generated code to read or write FlatBuffers.
FlatBuffers is a statically typed system, meaning the user of a buffer needs to know what kind of buffer it is. FlatBuffers can of course be wrapped inside other containers where needed, or you can use its union feature to dynamically identify multiple possible sub-objects stored.
Install FlatbuffersAt the beginning we have to get flatc — FlatBuffers compiler. It can be built from source code hosted in Google's flatbuffers repository. Let's download/clone it. Whole build process is described on FlatBuffers Building documentation.
There currently is no way to create a single FlatBuffer without having it all in memory at once. The only way to do it is to instead write out a chain of (length-prefixed) smaller independent FlatBuffers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With