diff --git a/features/testbot/distance_matrix.feature b/features/testbot/distance_matrix.feature index 104727350..7befc82e1 100644 --- a/features/testbot/distance_matrix.feature +++ b/features/testbot/distance_matrix.feature @@ -25,6 +25,80 @@ Feature: Basic Distance Matrix Given the query options | exclude | toll | + Scenario: Testbot - Travel time matrix of minimal network with excludes + Given the query options + | exclude | toll | + + Given the node map + """ + a b + c d + """ + + And the ways + | nodes | highway | toll | # | + | ab | motorway | | not drivable for exclude=motorway | + | cd | primary | | always drivable | + | ac | highway | yes | not drivable for exclude=motorway exclude=toll and exclude=motorway,toll | + | bd | highway | yes | not drivable for exclude=motorway exclude=toll | + + When I request a travel time matrix I should get + | | a | b | c | d | + | a | 0 | 15 | | | + | b | 15 | 0 | | | + | c | | | 0 | 10 | + | d | | | 10 | 0 | + + Scenario: Testbot - Travel time matrix of minimal network with different exclude + Given the query options + | exclude | motorway | + + Given the node map + """ + a b + c d + """ + + And the ways + | nodes | highway | toll | # | + | ab | motorway | | not drivable for exclude=motorway | + | cd | primary | | always drivable | + | ac | highway | yes | not drivable for exclude=motorway exclude=toll and exclude=motorway,toll | + | bd | highway | yes | not drivable for exclude=motorway exclude=toll | + + + When I request a travel time matrix I should get + | | a | b | c | d | + | a | 0 | 40 | 15 | 25 | + | b | 40 | 0 | 25 | 15 | + | c | 15 | 25 | 0 | 10 | + | d | 25 | 15 | 10 | 0 | + + Scenario: Testbot - Travel time matrix of minimal network with excludes combination + Given the query options + | exclude | motorway,toll | + + Given the node map + """ + a b + c d + """ + + And the ways + | nodes | highway | toll | # | + | ab | motorway | | not drivable for exclude=motorway | + | cd | primary | | always drivable | + | ac | highway | yes | not drivable for exclude=motorway exclude=toll and exclude=motorway,toll | + | bd | highway | yes | not drivable for exclude=motorway exclude=toll | + + When I request a travel time matrix I should get + | | a | b | c | d | + | a | 0 | 10 | 0 | 10 | + | b | 10 | 0 | 10 | 0 | + | c | 0 | 10 | 0 | 10 | + | d | 10 | 0 | 10 | 0 | + + Scenario: Testbot - Travel time matrix with different way speeds Given the node map """ a b diff --git a/include/engine/data_watchdog.hpp b/include/engine/data_watchdog.hpp index b44274545..a655c4a19 100644 --- a/include/engine/data_watchdog.hpp +++ b/include/engine/data_watchdog.hpp @@ -60,7 +60,8 @@ class DataWatchdogImpl( std::make_shared( std::vector{ - static_region.shm_key, updatable_region.shm_key})); + static_region.shm_key, updatable_region.shm_key}), + static_region.timestamp); } watcher = std::thread(&DataWatchdogImpl::Run, this); @@ -115,7 +116,8 @@ class DataWatchdogImpl( std::make_shared( std::vector{ - static_region.shm_key, updatable_region.shm_key})); + static_region.shm_key, updatable_region.shm_key}), + static_region.timestamp); } util::Log() << "DataWatchdog thread stopped"; diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index 6befce6d0..60aa57507 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -168,6 +168,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade // allocator that keeps the allocation data std::shared_ptr allocator; + std::size_t m_exclude_index; + unsigned m_timestamp; void InitializeInternalPointers(const storage::SharedDataIndex &index, const std::string &metric_name, @@ -183,6 +185,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade m_check_sum = *index.GetBlockPtr("/common/connectivity_checksum"); + m_exclude_index = exclude_index; + std::tie(m_coordinate_list, m_osmnodeid_list) = make_nbn_data_view(index, "/common/nbn_data"); @@ -217,12 +221,16 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade } public: + std::size_t GetTimestamp() const { return m_timestamp; } + std::size_t GetExcludeIndex() const { return m_exclude_index; } + // allows switching between process_memory/shared_memory datafacade, based on the type of // allocator ContiguousInternalMemoryDataFacadeBase(std::shared_ptr allocator_, const std::string &metric_name, - const std::size_t exclude_index) - : allocator(std::move(allocator_)) + const std::size_t exclude_index, + unsigned timestamp) + : allocator(std::move(allocator_)), m_timestamp(timestamp) { InitializeInternalPointers(allocator->GetIndex(), metric_name, exclude_index); } @@ -618,8 +626,9 @@ class ContiguousInternalMemoryDataFacade public: ContiguousInternalMemoryDataFacade(std::shared_ptr allocator, const std::string &metric_name, - const std::size_t exclude_index) - : ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index), + const std::size_t exclude_index, + unsigned timestamp) + : ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index, timestamp), ContiguousInternalMemoryAlgorithmDataFacade(allocator, metric_name, exclude_index) { } @@ -735,8 +744,9 @@ class ContiguousInternalMemoryDataFacade final public: ContiguousInternalMemoryDataFacade(std::shared_ptr allocator, const std::string &metric_name, - const std::size_t exclude_index) - : ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index), + const std::size_t exclude_index, + unsigned timestamp) + : ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index, timestamp), ContiguousInternalMemoryAlgorithmDataFacade(allocator, metric_name, exclude_index) { } diff --git a/include/engine/datafacade_factory.hpp b/include/engine/datafacade_factory.hpp index a4ff57f38..5b459f31c 100644 --- a/include/engine/datafacade_factory.hpp +++ b/include/engine/datafacade_factory.hpp @@ -30,8 +30,8 @@ template