public Map<String, EdgeLabel> getInEdgeLabels() { Map<String, EdgeLabel> result = new HashMap<>(); result.putAll(this.inEdgeLabels); if (this.schema.getTopology().isSqlWriteLockHeldByCurrentThread()) { result.putAll(this.uncommittedInEdgeLabels); for (String e : this.uncommittedRemovedInEdgeLabels.keySet()) { result.remove(e); } } return result; }
public Map<String, GlobalUniqueIndex> getGlobalUniqueIndexes() { Map<String, GlobalUniqueIndex> result = new HashMap<>(); result.putAll(this.globalUniqueIndexes); if (this.getTopology().isSqlWriteLockHeldByCurrentThread()) { result.putAll(this.uncommittedGlobalUniqueIndexes); for (String s : this.uncommittedRemovedGlobalUniqueIndexes) { result.remove(s); } } return Collections.unmodifiableMap(result); }
public Map<String, EdgeLabel> getInEdgeLabels() { Map<String, EdgeLabel> result = new HashMap<>(); result.putAll(this.inEdgeLabels); if (this.schema.getTopology().isSqlWriteLockHeldByCurrentThread()) { result.putAll(this.uncommittedInEdgeLabels); for (String e : this.uncommittedRemovedInEdgeLabels.keySet()) { result.remove(e); } } return result; }
Optional<EdgeLabel> getUncommittedOutEdgeLabel(String edgeLabelName) { if (this.schema.getTopology().isSqlWriteLockHeldByCurrentThread()) { EdgeLabel edgeLabel = this.getUncommittedOutEdgeLabels().get(edgeLabelName); if (edgeLabel != null) { return Optional.of(edgeLabel); } } return Optional.empty(); }
public Map<String, Partition> getPartitions() { Map<String, Partition> result = new HashMap<>(this.partitions); if (this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.putAll(this.uncommittedPartitions); for (String s : this.uncommittedRemovedPartitions) { result.remove(s); } } return result; }
public Map<String, PropertyColumn> getGlobalUniqueIndexProperties() { Map<String, PropertyColumn> result = new HashMap<>(); result.putAll(this.globalUniqueIndexProperties); if (this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.putAll(this.uncommittedGlobalUniqueIndexProperties); } return 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); }
Map<String, PropertyColumn> getUncommittedPropertyTypeMap() { if (getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { return this.uncommittedProperties; } else { return Collections.emptyMap(); } }
void afterRollbackForInEdges() { Preconditions.checkState(this.schema.getTopology().isSqlWriteLockHeldByCurrentThread(), "VertexLabel.afterRollback must hold the write lock"); super.afterRollback(); for (Iterator<EdgeLabel> it = this.uncommittedInEdgeLabels.values().iterator(); it.hasNext(); ) { EdgeLabel edgeLabel = it.next(); edgeLabel.afterRollbackInEdges(this); it.remove(); } for (EdgeLabel edgeLabel : this.inEdgeLabels.values()) { edgeLabel.afterRollbackInEdges(this); } }
public List<PropertyColumn> getProperties() { List<PropertyColumn> props = new ArrayList<>(properties); if (this.getParentLabel().getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { props.addAll(uncommittedProperties); } return Collections.unmodifiableList(props); }
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); }
public Map<String, Partition> getPartitions() { Map<String, Partition> result = new HashMap<>(this.partitions); if (this.getAbstractLabel().getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.putAll(this.uncommittedPartitions); for (String s : this.uncommittedRemovedPartitions) { result.remove(s); } } return result; }
private Index createIndex(String indexName, IndexType indexType, List<PropertyColumn> properties) { Index index = Index.createIndex(this.sqlgGraph, this, indexName, indexType, properties); this.uncommittedIndexes.put(indexName, index); this.getSchema().getTopology().fire(index, "", TopologyChangeAction.CREATE); return index; }
private Partition createListPartitionWithSubPartition(String name, String in, PartitionType partitionType, String partitionExpression) { Preconditions.checkState(!this.getSchema().isSqlgSchema(), "createListPartitionWithSubPartition may not be called for \"%s\"", SQLG_SCHEMA); this.uncommittedPartitions.remove(name); Partition partition = Partition.createListPartitionWithSubPartition(this.sqlgGraph, this, name, in, partitionType, partitionExpression); this.uncommittedPartitions.put(name, partition); this.getSchema().getTopology().fire(partition, "", TopologyChangeAction.CREATE); return partition; }
private Partition createListPartitionWithSubPartition(String name, String in, PartitionType partitionType, String partitionExpression) { Preconditions.checkState(!this.getSchema().isSqlgSchema(), "createListPartitionWithSubPartition may not be called for \"%s\"", SQLG_SCHEMA); this.uncommittedPartitions.remove(name); Partition partition = Partition.createListPartitionWithSubPartition(this.sqlgGraph, this, name, in, partitionType, partitionExpression); this.uncommittedPartitions.put(name, partition); this.getSchema().getTopology().fire(partition, "", TopologyChangeAction.CREATE); return partition; }
private Partition createListPartition(String name, String in) { Preconditions.checkState(!this.getAbstractLabel().getSchema().isSqlgSchema(), "createSubPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); this.uncommittedPartitions.remove(name); Partition partition = Partition.createListSubPartition(this.sqlgGraph, this, name, in); this.uncommittedPartitions.put(name, partition); this.getAbstractLabel().getSchema().getTopology().fire(partition, "", TopologyChangeAction.CREATE); return partition; }
public ListOrderedSet<String> getIdentifiers() { ListOrderedSet<String> result = ListOrderedSet.listOrderedSet(this.identifiers); if (this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.addAll(this.uncommittedIdentifiers); } return result; }
@Override void removeProperty(PropertyColumn propertyColumn, boolean preserveData) { this.getSchema().getTopology().lock(); if (!uncommittedRemovedProperties.contains(propertyColumn.getName())) { uncommittedRemovedProperties.add(propertyColumn.getName()); TopologyManager.removeVertexColumn(this.sqlgGraph, this.schema.getName(), VERTEX_PREFIX + getLabel(), propertyColumn.getName()); if (!preserveData) { removeColumn(this.schema.getName(), VERTEX_PREFIX + getLabel(), propertyColumn.getName()); } this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.DELETE); } }