@Override public void remove(boolean preserveData) { getSchema().removeEdgeLabel(this, preserveData); }
@Override public void remove(boolean preserveData) { getSchema().removeEdgeLabel(this, preserveData); }
public Set<VertexLabel> getInVertexLabels() { Set<VertexLabel> result = new HashSet<>(this.inVertexLabels); if (isValid() && this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.addAll(this.uncommittedInVertexLabels); result.removeAll(this.uncommittedRemovedInVertexLabels); } return Collections.unmodifiableSet(result); }
public Set<VertexLabel> getOutVertexLabels() { Set<VertexLabel> result = new HashSet<>(this.outVertexLabels); if (isValid() && this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.addAll(this.uncommittedOutVertexLabels); result.removeAll(this.uncommittedRemovedOutVertexLabels); } return Collections.unmodifiableSet(result); }
public Set<VertexLabel> getOutVertexLabels() { Set<VertexLabel> result = new HashSet<>(this.outVertexLabels); if (isValid() && this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.addAll(this.uncommittedOutVertexLabels); result.removeAll(this.uncommittedRemovedOutVertexLabels); } return Collections.unmodifiableSet(result); }
public Set<VertexLabel> getInVertexLabels() { Set<VertexLabel> result = new HashSet<>(this.inVertexLabels); if (isValid() && this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.addAll(this.uncommittedInVertexLabels); result.removeAll(this.uncommittedRemovedInVertexLabels); } return Collections.unmodifiableSet(result); }
void afterRollbackInEdges(VertexLabel vertexLabel) { Preconditions.checkState(this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread(), "EdgeLabel.afterRollback must hold the write lock"); super.afterRollback(); this.uncommittedInVertexLabels.remove(vertexLabel); this.uncommittedRemovedInVertexLabels.remove(vertexLabel); }
void afterRollbackInEdges(VertexLabel vertexLabel) { Preconditions.checkState(this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread(), "EdgeLabel.afterRollback must hold the write lock"); super.afterRollback(); this.uncommittedInVertexLabels.remove(vertexLabel); this.uncommittedRemovedInVertexLabels.remove(vertexLabel); }
void afterRollbackOutEdges(VertexLabel vertexLabel) { Preconditions.checkState(this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread(), "EdgeLabel.afterRollback must hold the write lock"); super.afterRollback(); this.uncommittedOutVertexLabels.remove(vertexLabel); this.uncommittedRemovedOutVertexLabels.remove(vertexLabel); }
void afterRollbackOutEdges(VertexLabel vertexLabel) { Preconditions.checkState(this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread(), "EdgeLabel.afterRollback must hold the write lock"); super.afterRollback(); this.uncommittedOutVertexLabels.remove(vertexLabel); this.uncommittedRemovedOutVertexLabels.remove(vertexLabel); }
Pair<Set<SchemaTable>, Set<SchemaTable>> getUncommittedSchemaTableForeignKeys() { Pair<Set<SchemaTable>, Set<SchemaTable>> result = Pair.of(new HashSet<>(), new HashSet<>()); for (Map.Entry<String, EdgeLabel> uncommittedEdgeLabelEntry : this.uncommittedOutEdgeLabels.entrySet()) { result.getRight().add(SchemaTable.of(this.getSchema().getName(), EDGE_PREFIX + uncommittedEdgeLabelEntry.getValue().getLabel())); } for (Map.Entry<String, EdgeLabel> uncommittedEdgeLabelEntry : this.uncommittedInEdgeLabels.entrySet()) { result.getLeft().add(SchemaTable.of(uncommittedEdgeLabelEntry.getValue().getSchema().getName(), EDGE_PREFIX + uncommittedEdgeLabelEntry.getValue().getLabel())); } return result; }
Pair<Set<SchemaTable>, Set<SchemaTable>> getUncommittedSchemaTableForeignKeys() { Pair<Set<SchemaTable>, Set<SchemaTable>> result = Pair.of(new HashSet<>(), new HashSet<>()); for (Map.Entry<String, EdgeLabel> uncommittedEdgeLabelEntry : this.uncommittedOutEdgeLabels.entrySet()) { result.getRight().add(SchemaTable.of(this.getSchema().getName(), EDGE_PREFIX + uncommittedEdgeLabelEntry.getValue().getLabel())); } for (Map.Entry<String, EdgeLabel> uncommittedEdgeLabelEntry : this.uncommittedInEdgeLabels.entrySet()) { result.getLeft().add(SchemaTable.of(uncommittedEdgeLabelEntry.getValue().getSchema().getName(), EDGE_PREFIX + uncommittedEdgeLabelEntry.getValue().getLabel())); } return result; }
void addToInEdgeLabels(EdgeLabel edgeLabel) { edgeLabel.addToInVertexLabel(this); this.inEdgeLabels.put(edgeLabel.getSchema().getName() + "." + edgeLabel.getLabel(), edgeLabel); }
void addToInEdgeLabels(EdgeLabel edgeLabel) { edgeLabel.addToInVertexLabel(this); this.inEdgeLabels.put(edgeLabel.getSchema().getName() + "." + edgeLabel.getLabel(), edgeLabel); }
/** * delete a given column from the table * * @param column The column to delete. */ private void deleteColumn(String column) { removeColumn(getSchema().getName(), EDGE_PREFIX + getLabel(), column); }
@Override void removeProperty(PropertyColumn propertyColumn, boolean preserveData) { this.getSchema().getTopology().lock(); if (!uncommittedRemovedProperties.contains(propertyColumn.getName())) { uncommittedRemovedProperties.add(propertyColumn.getName()); TopologyManager.removeEdgeColumn(this.sqlgGraph, this.getSchema().getName(), EDGE_PREFIX + getLabel(), propertyColumn.getName()); if (!preserveData) { removeColumn(this.getSchema().getName(), EDGE_PREFIX + getLabel(), propertyColumn.getName()); } this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.DELETE); } }
/** * delete a given column from the table * * @param column The column to delete. */ private void deleteColumn(String column) { removeColumn(getSchema().getName(), EDGE_PREFIX + getLabel(), column); }
@Override void removeProperty(PropertyColumn propertyColumn, boolean preserveData) { this.getSchema().getTopology().lock(); if (!uncommittedRemovedProperties.contains(propertyColumn.getName())) { uncommittedRemovedProperties.add(propertyColumn.getName()); TopologyManager.removeEdgeColumn(this.sqlgGraph, this.getSchema().getName(), EDGE_PREFIX + getLabel(), propertyColumn.getName()); if (!preserveData) { removeColumn(this.getSchema().getName(), EDGE_PREFIX + getLabel(), propertyColumn.getName()); } this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.DELETE); } }
/** * add in foreign key between a vertex label and a edge label * * @param vertexLabel * @param edgeLabel */ void addInForeignKeysToVertexLabel(VertexLabel vertexLabel, EdgeLabel edgeLabel) { Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread()); SchemaTable schemaTable = SchemaTable.of(vertexLabel.getSchema().getName(), VERTEX_PREFIX + vertexLabel.getLabel()); Pair<Set<SchemaTable>, Set<SchemaTable>> foreignKeys = this.schemaTableForeignKeyCache.computeIfAbsent( schemaTable, k -> Pair.of(new HashSet<>(), new HashSet<>()) ); foreignKeys.getLeft().add(SchemaTable.of(edgeLabel.getSchema().getName(), EDGE_PREFIX + edgeLabel.getLabel())); }
/** * remove in foreign key for a given vertex label and edge label * * @param vertexLabel * @param edgeLabel */ void removeInForeignKeysFromVertexLabel(VertexLabel vertexLabel, EdgeLabel edgeLabel) { Preconditions.checkState(isSqlWriteLockHeldByCurrentThread() || isTopologyMapWriteLockHeldByCurrentThread()); SchemaTable schemaTable = SchemaTable.of(vertexLabel.getSchema().getName(), VERTEX_PREFIX + vertexLabel.getLabel()); Pair<Set<SchemaTable>, Set<SchemaTable>> foreignKeys = this.schemaTableForeignKeyCache.get(schemaTable); if (foreignKeys != null && edgeLabel.isValid()) { foreignKeys.getLeft().remove(SchemaTable.of(edgeLabel.getSchema().getName(), EDGE_PREFIX + edgeLabel.getLabel())); } }