Add glue-code between vertex_count_cache and the coordinator
This commit is contained in:
parent
27d99b620d
commit
f2c4376a44
@ -38,12 +38,15 @@ class VertexCountCache {
|
||||
auto NameToProperty(const std::string &name) { return request_router_->NameToProperty(name); }
|
||||
auto NameToEdgeType(const std::string &name) { return request_router_->NameToEdgeType(name); }
|
||||
|
||||
int64_t VerticesCount() { return 1; }
|
||||
int64_t VerticesCount() { return request_router_->GetApproximateVertexCount(); }
|
||||
|
||||
int64_t VerticesCount(storage::v3::LabelId /*label*/) { return 1; }
|
||||
int64_t VerticesCount(storage::v3::LabelId label) { return request_router_->GetApproximateVertexCount(label); }
|
||||
|
||||
int64_t VerticesCount(storage::v3::LabelId /*label*/, storage::v3::PropertyId /*property*/) { return 1; }
|
||||
int64_t VerticesCount(storage::v3::LabelId label, storage::v3::PropertyId property) {
|
||||
return request_router_->GetApproximateVertexCount(label, property);
|
||||
}
|
||||
|
||||
// TODO(gvolfing) check if we actually use these overloads...
|
||||
int64_t VerticesCount(storage::v3::LabelId /*label*/, storage::v3::PropertyId /*property*/,
|
||||
const storage::v3::PropertyValue & /*value*/) {
|
||||
return 1;
|
||||
|
@ -122,6 +122,10 @@ class RequestRouterInterface {
|
||||
virtual std::optional<std::pair<uint64_t, uint64_t>> AllocateInitialEdgeIds(io::Address coordinator_address) = 0;
|
||||
virtual void InstallSimulatorTicker(std::function<bool()> tick_simulator) = 0;
|
||||
virtual const std::vector<coordinator::SchemaProperty> &GetSchemaForLabel(storage::v3::LabelId label) const = 0;
|
||||
|
||||
virtual int64_t GetApproximateVertexCount() const = 0;
|
||||
virtual int64_t GetApproximateVertexCount(storage::v3::LabelId label) const = 0;
|
||||
virtual int64_t GetApproximateVertexCount(storage::v3::LabelId label, storage::v3::PropertyId property) const = 0;
|
||||
};
|
||||
|
||||
// TODO(kostasrim)rename this class template
|
||||
@ -415,6 +419,17 @@ class RequestRouter : public RequestRouterInterface {
|
||||
return shards_map_.GetLabelId(name);
|
||||
}
|
||||
|
||||
int64_t GetApproximateVertexCount() const override { return 1; }
|
||||
|
||||
int64_t GetApproximateVertexCount(storage::v3::LabelId label) const override {
|
||||
const auto &label_space = shards_map_.label_spaces.at(label);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int64_t GetApproximateVertexCount(storage::v3::LabelId label, storage::v3::PropertyId property) const override {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<ShardRequestState<msgs::CreateVerticesRequest>> RequestsForCreateVertices(
|
||||
const std::vector<msgs::NewVertex> &new_vertices) {
|
||||
|
@ -45,6 +45,10 @@ class MockedRequestRouter : public RequestRouterInterface {
|
||||
MOCK_METHOD((std::optional<std::pair<uint64_t, uint64_t>>), AllocateInitialEdgeIds, (io::Address));
|
||||
MOCK_METHOD(void, InstallSimulatorTicker, (std::function<bool()>));
|
||||
MOCK_METHOD(const std::vector<coordinator::SchemaProperty> &, GetSchemaForLabel, (storage::v3::LabelId), (const));
|
||||
MOCK_METHOD(int64_t, GetApproximateVertexCount, (), (const));
|
||||
MOCK_METHOD(int64_t, GetApproximateVertexCount, (storage::v3::LabelId label), (const));
|
||||
MOCK_METHOD(int64_t, GetApproximateVertexCount, (storage::v3::LabelId label, storage::v3::PropertyId property),
|
||||
(const));
|
||||
};
|
||||
|
||||
class MockedLogicalOperator : public plan::LogicalOperator {
|
||||
|
@ -135,6 +135,13 @@ class MockedRequestRouter : public RequestRouterInterface {
|
||||
return schema;
|
||||
};
|
||||
|
||||
// TODO(gvolfing) once the real implementation is done make sure these are solved as well.
|
||||
int64_t GetApproximateVertexCount() const override { return 1; }
|
||||
int64_t GetApproximateVertexCount(storage::v3::LabelId label) const override { return 1; }
|
||||
int64_t GetApproximateVertexCount(storage::v3::LabelId label, storage::v3::PropertyId property) const override {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetUpNameIdMappers() {
|
||||
std::unordered_map<uint64_t, std::string> id_to_name;
|
||||
|
Loading…
Reference in New Issue
Block a user