2018-02-13 10:36:19 -05:00
|
|
|
#ifndef OSRM_ENGINE_DATAFACADE_MMAP_MEMORY_ALLOCATOR_HPP_
|
|
|
|
#define OSRM_ENGINE_DATAFACADE_MMAP_MEMORY_ALLOCATOR_HPP_
|
|
|
|
|
|
|
|
#include "engine/datafacade/contiguous_block_allocator.hpp"
|
|
|
|
|
|
|
|
#include "storage/storage_config.hpp"
|
|
|
|
|
|
|
|
#include "util/vector_view.hpp"
|
|
|
|
|
|
|
|
#include <boost/iostreams/device/mapped_file.hpp>
|
|
|
|
|
|
|
|
#include <memory>
|
2018-10-27 02:48:51 -04:00
|
|
|
#include <string>
|
2018-02-13 10:36:19 -05:00
|
|
|
|
2022-12-11 04:10:26 -05:00
|
|
|
namespace osrm::engine::datafacade
|
2018-02-13 10:36:19 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This allocator uses file backed mmap memory block as the data location.
|
|
|
|
*/
|
2022-06-27 19:14:28 -04:00
|
|
|
class MMapMemoryAllocator final : public ContiguousBlockAllocator
|
2018-02-13 10:36:19 -05:00
|
|
|
{
|
|
|
|
public:
|
2018-10-27 02:48:51 -04:00
|
|
|
explicit MMapMemoryAllocator(const storage::StorageConfig &config);
|
2018-02-13 10:36:19 -05:00
|
|
|
~MMapMemoryAllocator() override final;
|
|
|
|
|
|
|
|
// interface to give access to the datafacades
|
2018-04-04 19:05:34 -04:00
|
|
|
const storage::SharedDataIndex &GetIndex() override final;
|
2018-02-13 10:36:19 -05:00
|
|
|
|
|
|
|
private:
|
2018-04-04 19:05:34 -04:00
|
|
|
storage::SharedDataIndex index;
|
2020-09-07 16:04:43 -04:00
|
|
|
std::vector<boost::iostreams::mapped_file_source> mapped_memory_files;
|
2018-10-27 02:48:51 -04:00
|
|
|
std::string rtree_filename;
|
2018-02-13 10:36:19 -05:00
|
|
|
};
|
|
|
|
|
2022-12-20 12:00:11 -05:00
|
|
|
} // namespace osrm::engine::datafacade
|
2018-02-13 10:36:19 -05:00
|
|
|
|
|
|
|
#endif // OSRM_ENGINE_DATAFACADE_SHARED_MEMORY_ALLOCATOR_HPP_
|