8000 Feature/hybrid smart graph api by hkernbach · Pull Request #14037 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/hybrid smart graph api #14037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c702439
init commit - working on api - still wip - important: ee branch exists
hkernbach Apr 16, 2021
f9406c5
more api adjustment
hkernbach Apr 19, 2021
4891d44
added place to store satellites
hkernbach Apr 20, 2021
9e25d83
Merge branch 'devel' of github.com:arangodb/arangodb into feature/hyb…
hkernbach Apr 20, 2021
3397a0c
expose type of EdgeDefinition in toVelocypack method
hkernbach Apr 20, 2021
7f5c2ad
expose type of EdgeDefinition in toVelocypack method
hkernbach Apr 20, 2021
d5bc06b
added basic implementation of type detection in edge definitions
hkernbach Apr 20, 2021
e37cbe2
rm assert
hkernbach Apr 20, 2021
6b921d3
Added Protected default constructor for Valdiators
mchacki Apr 20, 2021
d27d803
add satellites from slices
hkernbach Apr 20, 2021
56d9098
Merge branch 'feature/hybrid-smart-graph-api' of github.com:arangodb/…
hkernbach Apr 20, 2021
4ffa3ff
more satellite validation
hkernbach Apr 20, 2021
ed41238
Merge branch 'devel' of github.com:arangodb/arangodb into feature/hyb…
hkernbach Apr 20, 2021
063acf0
Revert "Added Protected default constructor for Valdiators"
mchacki Apr 21, 2021
9b33b0c
Update arangod/Graph/Graph.cpp
hkernbach Apr 21, 2021
2b3b9ce
applied some applied changes
hkernbach Apr 21, 2021
dc3d119
Typo
hkernbach Apr 21, 2021
851a995
applied some applied changes
hkernbach Apr 21, 2021
0adee0b
simplified if
hkernbach Apr 21, 2021
81572c1
simplified if, moved some code
hkernbach Apr 21, 2021
139b054
edge type set to public, code cleanup
hkernbach Apr 22, 2021
4db8c3f
applied request code change
hkernbach Apr 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added basic implementation of type detection in edge definitions
  • Loading branch information
hkernbach committed Apr 20, 2021
commit d5bc06b7d0015b26a9e24e8ec7fd6b0bd2cbcd04
29 changes: 27 additions & 2 deletions arangod/Graph/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void EdgeDefinition::toVelocyPack(VPackBuilder& builder) const {
builder.add("type", VPackValue(getType()));
}

ResultT<EdgeDefinition> EdgeDefinition::createFromVelocypack(VPackSlice edgeDefinition) {
ResultT<EdgeDefinition> EdgeDefinition::createFromVelocypack(VPackSlice edgeDefinition, std::set<std::string> const& satCollections) {
Result res = EdgeDefinition::validateEdgeDefinition(edgeDefinition);
if (res.fail()) {
return res;
Expand All @@ -436,15 +436,40 @@ ResultT<EdgeDefinition> EdgeDefinition::createFromVelocypack(VPackSlice edgeDefi

std::set<std::string> fromSet;
std::set<std::string> toSet;
EdgeDefinitionType type = EdgeDefinitionType::DEFAULT;
bool foundFromSat = false;
bool foundToSat = false;

// duplicates in from and to shouldn't occur, but are safely ignored here
for (VPackSlice it : VPackArrayIterator(from)) {
TRI_ASSERT(it.isString());
if (satCollections.find(it.copyString()) != satCollections.end()) {
// found a sat collection defined in from's
foundFromSat = true;
}

fromSet.emplace(it.copyString());
}
for (VPackSlice it : VPackArrayIterator(to)) {
TRI_ASSERT(it.isString());
if (satCollections.find(it.copyString()) != satCollections.end()) {
// found a sat collection defined in to's
foundToSat = true;
}

toSet.emplace(it.copyString());
}

if (foundFromSat && !foundToSat) {
type = EdgeDefinitionType::SATTOSMART;
} else if (!foundFromSat && foundToSat) {
type = EdgeDefinitionType::SMARTTOSAT;
} else if (foundFromSat && foundToSat) {
type = EdgeDefinitionType::SATTOSAT;
} else if (!foundFromSat && !foundToSat) {
type = EdgeDefinitionType::SMARTTOSMART;
}

// We do not allow creating an edge definition with either an empty from
// or an empty to set
if (fromSet.size() == 0 || toSet.size() == 0) {
Expand Down Expand Up @@ -609,7 +634,7 @@ ResultT<EdgeDefinition const*> Graph::addEdgeDefinition(EdgeDefinition const& ed
}

ResultT<EdgeDefinition const*> Graph::addEdgeDefinition(VPackSlice const& edgeDefinitionSlice) {
auto res = EdgeDefinition::createFromVelocypack(edgeDefinitionSlice);
auto res = EdgeDefinition::createFromVelocypack(edgeDefinitionSlice, satelliteCollections());

if (res.fail()) {
return std::move(res).result();
Expand Down
2 changes: 1 addition & 1 deletion arangod/Graph/Graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class EdgeDefinition {
/// types of values.
static Result validateEdgeDefinition(const velocypack::Slice& edgeDefinition);

static ResultT<EdgeDefinition> createFromVelocypack(velocypack::Slice edgeDefinition);
static ResultT<EdgeDefinition> createFromVelocypack(velocypack::Slice edgeDefinition, std::set<std::string> const& satCollections);

void toVelocyPack(velocypack::Builder&) const;

Expand Down
2 changes: 1 addition & 1 deletion arangod/Graph/GraphOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ OperationResult GraphOperations::editEdgeDefinition(VPackSlice edgeDefinitionSli
bool waitForSync,
std::string const& edgeDefinitionName) {
OperationOptions options(ExecContext::current());
auto maybeEdgeDef = EdgeDefinition::createFromVelocypack(edgeDefinitionSlice);
auto maybeEdgeDef = EdgeDefinition::createFromVelocypack(edgeDefinitionSlice, graph().satelliteCollections());
if (!maybeEdgeDef) {
return OperationResult{std::move(maybeEdgeDef).result(), options};
}
Expand Down
0