Rename the datafacades to more clearly describe what they do.
This commit is contained in:
+8
-7
@@ -1,7 +1,5 @@
|
||||
#ifndef MEMORYBLOCK_DATAFACADE_HPP
|
||||
#define MEMORYBLOCK_DATAFACADE_HPP
|
||||
|
||||
// implements all data storage when shared memory _IS_ used
|
||||
#ifndef CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|
||||
#define CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|
||||
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
|
||||
@@ -57,9 +55,12 @@ using OSMNodeArrayRef = ConstArrayRef<const OSMNodeID *>;
|
||||
|
||||
/**
|
||||
* This base class implements the Datafacade interface for accessing
|
||||
* data that's stored in a single large block of memory.
|
||||
* data that's stored in a single large block of memory (RAM).
|
||||
*
|
||||
* In this case "internal memory" refers to RAM - as opposed to "external memory",
|
||||
* which usually refers to disk.
|
||||
*/
|
||||
class BigRAMBlockDataFacadeBase : public BaseDataFacade
|
||||
class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
{
|
||||
private:
|
||||
using super = BaseDataFacade;
|
||||
@@ -940,4 +941,4 @@ class BigRAMBlockDataFacadeBase : public BaseDataFacade
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MEMORYBLOCK_DATAFACADE_HPP
|
||||
#endif // CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|
||||
+7
-7
@@ -1,9 +1,9 @@
|
||||
#ifndef INTERNAL_DATAFACADE_HPP
|
||||
#define INTERNAL_DATAFACADE_HPP
|
||||
#ifndef PROCESS_MEMORY_DATAFACADE_HPP
|
||||
#define PROCESS_MEMORY_DATAFACADE_HPP
|
||||
|
||||
// implements all data storage when shared memory is _NOT_ used
|
||||
|
||||
#include "engine/datafacade/bigramblock_datafacade_base.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade_base.hpp"
|
||||
#include "storage/storage.hpp"
|
||||
|
||||
namespace osrm
|
||||
@@ -16,12 +16,12 @@ namespace datafacade
|
||||
/**
|
||||
* This datafacade uses a process-local memory block to load
|
||||
* data into. The structure and layout is the same as when using
|
||||
* shared memory, so this class, and the SharedDatafacade both
|
||||
* shared memory, so this class, and the SharedMemoryDataFacade both
|
||||
* share a common base.
|
||||
* This class holds a unique_ptr to the memory block, so it
|
||||
* is auto-freed upon destruction.
|
||||
*/
|
||||
class InternalDataFacade final : public BigRAMBlockDataFacadeBase
|
||||
class ProcessMemoryDataFacade final : public ContiguousInternalMemoryDataFacadeBase
|
||||
{
|
||||
|
||||
private:
|
||||
@@ -29,7 +29,7 @@ class InternalDataFacade final : public BigRAMBlockDataFacadeBase
|
||||
std::unique_ptr<storage::DataLayout> internal_layout;
|
||||
|
||||
public:
|
||||
explicit InternalDataFacade(const storage::StorageConfig &config)
|
||||
explicit ProcessMemoryDataFacade(const storage::StorageConfig &config)
|
||||
{
|
||||
storage::Storage storage(config);
|
||||
|
||||
@@ -49,4 +49,4 @@ class InternalDataFacade final : public BigRAMBlockDataFacadeBase
|
||||
}
|
||||
}
|
||||
|
||||
#endif // INTERNAL_DATAFACADE_HPP
|
||||
#endif // PROCESS_MEMORY_DATAFACADE_HPP
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "storage/shared_barriers.hpp"
|
||||
#include "storage/shared_datatype.hpp"
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "engine/datafacade/bigramblock_datafacade_base.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade_base.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -17,10 +17,10 @@ namespace datafacade
|
||||
|
||||
/**
|
||||
* This datafacade uses an IPC shared memory block as the data location.
|
||||
* Many SharedDataFacade objects can be created that point to the same shared
|
||||
* Many SharedMemoryDataFacade objects can be created that point to the same shared
|
||||
* memory block.
|
||||
*/
|
||||
class SharedDataFacade : public BigRAMBlockDataFacadeBase
|
||||
class SharedMemoryDataFacade : public ContiguousInternalMemoryDataFacadeBase
|
||||
{
|
||||
|
||||
protected:
|
||||
@@ -31,12 +31,12 @@ class SharedDataFacade : public BigRAMBlockDataFacadeBase
|
||||
storage::SharedDataType data_region;
|
||||
unsigned shared_timestamp;
|
||||
|
||||
SharedDataFacade() {}
|
||||
SharedMemoryDataFacade() {}
|
||||
|
||||
public:
|
||||
// this function handle the deallocation of the shared memory it we can prove it will not be
|
||||
// used anymore. We crash hard here if something goes wrong (noexcept).
|
||||
virtual ~SharedDataFacade() noexcept
|
||||
virtual ~SharedMemoryDataFacade() noexcept
|
||||
{
|
||||
boost::interprocess::scoped_lock<boost::interprocess::named_sharable_mutex> exclusive_lock(
|
||||
data_region == storage::DATA_1 ? shared_barriers->regions_1_mutex
|
||||
@@ -67,10 +67,10 @@ class SharedDataFacade : public BigRAMBlockDataFacadeBase
|
||||
}
|
||||
}
|
||||
|
||||
SharedDataFacade(const std::shared_ptr<storage::SharedBarriers> &shared_barriers_,
|
||||
storage::SharedDataType layout_region_,
|
||||
storage::SharedDataType data_region_,
|
||||
unsigned shared_timestamp_)
|
||||
SharedMemoryDataFacade(const std::shared_ptr<storage::SharedBarriers> &shared_barriers_,
|
||||
storage::SharedDataType layout_region_,
|
||||
storage::SharedDataType data_region_,
|
||||
unsigned shared_timestamp_)
|
||||
: shared_barriers(shared_barriers_), layout_region(layout_region_),
|
||||
data_region(data_region_), shared_timestamp(shared_timestamp_)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user