osrm-backend/include/engine/datafacade/mmap_memory_allocator.hpp

39 lines
1.0 KiB
C++
Raw Permalink Normal View History

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>
#include <string>
2018-02-13 10:36:19 -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:
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;
std::vector<boost::iostreams::mapped_file_source> mapped_memory_files;
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_