saving Btrees to a disk file and read it

后端 未结 4 1093
后悔当初
后悔当初 2020-12-03 06:32

I want to save a Btree(not sure a binary one) in a disk file. and then read it to the memory. some Level-order traversal may be a good way for a binary Btree. but if it is n

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-03 06:42

    You might want to check out Protocol Buffers. They're compact, binary, extensible, easy to read and write, and available in C++, Java and Python (as well as third party implementations in other languages).

    You can define a protocol buffer message for a BTree node, with file offsets for child nodes, and simply serialize it to disk in the obvious manner.

提交回复
热议问题