Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FlatBuffers: How to write giant files

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.

like image 930
benjist Avatar asked Feb 10 '16 18:02

benjist


People also ask

How do you use Flatbuffer in C++?

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.

How does a Flatbuffer work?

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.

How do you install FlatBuffers on a window?

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.


1 Answers

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.

like image 72
Aardappel Avatar answered Oct 22 '22 05:10

Aardappel