public Map<String, Index> getIndexes() { Map<String, Index> result = new HashMap<>(); result.putAll(this.indexes); if (this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.putAll(this.uncommittedIndexes); for (String i : this.uncommittedRemovedIndexes) { result.remove(i); } } return result; }
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<GlobalUniqueIndex> getGlobalUniqueIndices() { HashSet<GlobalUniqueIndex> result = new HashSet<>(); result.addAll(this.globalUniqueIndices); if (this.abstractLabel.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.addAll(this.uncommittedGlobalUniqueIndices); } return result; }
public Map<String, PropertyColumn> getProperties() { Map<String, PropertyColumn> result = new HashMap<>(this.properties); if (this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.putAll(this.uncommittedProperties); for (String s : this.uncommittedRemovedProperties) { result.remove(s); } } return result; }
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.getSchema().isSqlgSchema(), "createListPartition may not be called for \"%s\"", SQLG_SCHEMA); this.uncommittedPartitions.remove(name); Partition partition = Partition.createListPartition(this.sqlgGraph, this, name, in); this.uncommittedPartitions.put(name, partition); this.getSchema().getTopology().fire(partition, "", TopologyChangeAction.CREATE); return partition; }
Set<String> getUncommittedRemovedProperties() { if (getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { return this.uncommittedRemovedProperties; } else { return Collections.emptySet(); } }
void afterRollback() { Preconditions.checkState(this.getAbstractLabel().getSchema().getTopology().isSqlWriteLockHeldByCurrentThread(), "Partition.afterCommit must hold the write lock"); this.uncommittedRemovedPartitions.clear(); for (Iterator<Map.Entry<String, Partition>> it = this.partitions.entrySet().iterator(); it.hasNext(); ) { Map.Entry<String, Partition> entry = it.next(); entry.getValue().afterRollback(); } }
Map<String, PropertyColumn> getUncommittedPropertyTypeMap() { if (getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { return this.uncommittedProperties; } else { return Collections.emptyMap(); } }
Set<String> getUncommittedRemovedProperties() { if (getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { return this.uncommittedRemovedProperties; } else { return Collections.emptySet(); } }
public List<PropertyColumn> getProperties() { List<PropertyColumn> props = new ArrayList<>(properties); if (this.getParentLabel().getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { props.addAll(uncommittedProperties); } return Collections.unmodifiableList(props); }
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 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; }
private Partition createRangePartition(String name, String from, String to) { Preconditions.checkState(!this.getAbstractLabel().getSchema().isSqlgSchema(), "createSubPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); this.uncommittedPartitions.remove(name); Partition partition = Partition.createRangeSubPartition(this.sqlgGraph, this, name, from, to); this.uncommittedPartitions.put(name, partition); this.getAbstractLabel().getSchema().getTopology().fire(partition, "", TopologyChangeAction.CREATE); return partition; }
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 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; }
void addIdentifier(String propertyName, int index) { Preconditions.checkState(this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()); if (index > this.identifiers.size() - 1) { this.identifiers.add(propertyName); } else { this.identifiers.add(index, propertyName); } }
public ListOrderedSet<String> getIdentifiers() { ListOrderedSet<String> result = ListOrderedSet.listOrderedSet(this.identifiers); if (this.getSchema().getTopology().isSqlWriteLockHeldByCurrentThread()) { result.addAll(this.uncommittedIdentifiers); } return result; }