Reviewers: teon.banek, dgleich Reviewed By: teon.banek, dgleich Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1110
25 lines
653 B
C++
25 lines
653 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace storage {
|
|
|
|
/**
|
|
* Defines an interface for mapping IDs to values and vice-versa. The interface
|
|
* is necessary because in the distributed system implementations are different
|
|
* for the master (single source of truth) and worker (must query master).
|
|
* Both implementations must be concurrent.
|
|
*
|
|
* @TParam TId - One of storage types (Label, EdgeType, Property).
|
|
*/
|
|
template <typename TId>
|
|
class ConcurrentIdMapper {
|
|
public:
|
|
virtual ~ConcurrentIdMapper() {}
|
|
|
|
virtual TId value_to_id(const std::string &value) = 0;
|
|
virtual const std::string &id_to_value(const TId &id) = 0;
|
|
};
|
|
|
|
} // namespace storage
|