是否有一个多索引容器用于硬盘存储而不是内存?
对于硬盘存储的情况,我需要一个基于红黑树的多索引容器(类似于boost::multi_index::multi_index_container)。所有数据必须存储在硬盘上而不是内存中。
是否有一个开源容器能够满足所描述的条件?
笔记。我使用C++
。
I need a muti index container based on red-black trees (something like boost::multi_index::multi_index_container
) for the case of the harddisk storage. All data must be store on hard disk rather than in memory.
Is there an open source container such that described conditions hold?
Note. I use C++
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您有内存解决方案,则可以使用内存映射文件和自定义分配器来实现持久存储。
If you have an in-memory solution, you can use a memory-mapped file and a custom allocator to achieve persistent storage.
恐怕我一个也不知道。
对于硬盘存储我只能推荐看看STXXL,它提出了适应数据的STL容器和算法只能存放在磁盘上。他们实现了许多东西来实现更平滑的操作,主要是通过尽可能多地在内存中缓存并在可能的情况下延迟磁盘访问。
现在这不会给你一个多索引,但至少你会有一个 STL :)
然后,如果你下定决心,你可以移植多索引以使用 STXXL 提供的设施:它们已经解除了 IO 访问/来自容器本身的内存缓存。
或者您可以简单地根据他们的 STL 兼容容器编写您需要的内容。
I am afraid I don't know any.
For hard-disk storage I can only recommend a look to STXXL, which proposes STL containers and algorithms adapted to data that can only fit on disk. They have implemented many things to allow for a smoother manipulation, essentially by caching in memory as much as possible and delaying disk access when possible.
Now that won't get you a multi index, but at least you'll have a STL :)
Then, if you are determined, you can port multi-index to use the facilities provided by STXXL: they have decorrelated the IO access / memory caching from the containers themselves.
Or you can simply write what you need based on their STL-compliant containers.
SQLite 怎么样?它可以使用磁盘作为后备存储,并支持数据的多个索引,就像 Boost Multi Index 一样。
How about SQLite? It can use disk as backing store, and supports multiple indexes on data, as Boost Multi Index does.