public GlobalUniqueIndex ensureGlobalUniqueIndexExist(final Set<PropertyColumn> properties) { Objects.requireNonNull(properties, "properties may not be null"); Schema globalUniqueIndexSchema = getGlobalUniqueIndexSchema(); return globalUniqueIndexSchema.ensureGlobalUniqueIndexExist(properties); }
@Override public void remove(boolean preserveData) { topology.getGlobalUniqueIndexSchema().removeGlobalUniqueIndex(this,preserveData); } }
public GlobalUniqueIndex ensureGlobalUniqueIndexExist(final Set<PropertyColumn> properties) { Objects.requireNonNull(properties, "properties may not be null"); Schema globalUniqueIndexSchema = getGlobalUniqueIndexSchema(); return globalUniqueIndexSchema.ensureGlobalUniqueIndexExist(properties); }
@Override public void remove(boolean preserveData) { topology.getGlobalUniqueIndexSchema().removeGlobalUniqueIndex(this,preserveData); } }
public Optional<GlobalUniqueIndex> getGlobalUniqueIndexes(String name) { return getGlobalUniqueIndexSchema().getGlobalUniqueIndex(name); }
public Optional<GlobalUniqueIndex> getGlobalUniqueIndexes(String name) { return getGlobalUniqueIndexSchema().getGlobalUniqueIndex(name); }
public Set<GlobalUniqueIndex> getGlobalUniqueIndexes() { return new HashSet<>(getGlobalUniqueIndexSchema().getGlobalUniqueIndexes().values()); }
public Set<GlobalUniqueIndex> getGlobalUniqueIndexes() { return new HashSet<>(getGlobalUniqueIndexSchema().getGlobalUniqueIndexes().values()); }
public Optional<Schema> getSchema(String schema) { if (schema == null) { return Optional.empty(); } if (isSqlWriteLockHeldByCurrentThread() && this.uncommittedRemovedSchemas.contains(schema)) { return Optional.empty(); } if (schema.equals(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA)) { return Optional.of(getGlobalUniqueIndexSchema()); } else { z_internalTopologyMapReadLock(); try { Schema result = this.schemas.get(schema); if (result == null) { if (isSqlWriteLockHeldByCurrentThread()) { result = this.uncommittedSchemas.get(schema); } if (result == null) { result = this.metaSchemas.get(schema); } } return Optional.ofNullable(result); } finally { z_internalTopologyMapReadUnLock(); } } }
public Optional<Schema> getSchema(String schema) { if (schema == null) { return Optional.empty(); } if (isSqlWriteLockHeldByCurrentThread() && this.uncommittedRemovedSchemas.contains(schema)) { return Optional.empty(); } if (schema.equals(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA)) { return Optional.of(getGlobalUniqueIndexSchema()); } else { z_internalTopologyMapReadLock(); try { Schema result = this.schemas.get(schema); if (result == null) { if (isSqlWriteLockHeldByCurrentThread()) { result = this.uncommittedSchemas.get(schema); } if (result == null) { result = this.metaSchemas.get(schema); } } return Optional.ofNullable(result); } finally { z_internalTopologyMapReadUnLock(); } } }
@SuppressWarnings("OptionalGetWithoutIsPresent") static GlobalUniqueIndex createGlobalUniqueIndex(SqlgGraph sqlgGraph, Topology topology, String globalUniqueIndexName, Set<PropertyColumn> properties) { //all PropertyColumns must be for the same PropertyType PropertyType propertyType = properties.iterator().next().getPropertyType(); Map<String, PropertyType> valueColumn = new HashMap<>(); valueColumn.put(GLOBAL_UNIQUE_INDEX_RECORD_ID, PropertyType.STRING); valueColumn.put(GLOBAL_UNIQUE_INDEX_PROPERTY_NAME, PropertyType.STRING); valueColumn.put(GLOBAL_UNIQUE_INDEX_VALUE, propertyType); VertexLabel vertexLabel = topology.getGlobalUniqueIndexSchema().ensureVertexLabelExist(globalUniqueIndexName, valueColumn); PropertyColumn valuePropertyColumn = vertexLabel.getProperty(GLOBAL_UNIQUE_INDEX_VALUE).get(); PropertyColumn recordIdColumn = vertexLabel.getProperty(GLOBAL_UNIQUE_INDEX_RECORD_ID).get(); PropertyColumn propertyColumn = vertexLabel.getProperty(GLOBAL_UNIQUE_INDEX_PROPERTY_NAME).get(); vertexLabel.ensureIndexExists(IndexType.UNIQUE, Collections.singletonList(valuePropertyColumn)); vertexLabel.ensureIndexExists(IndexType.UNIQUE, Arrays.asList(recordIdColumn, propertyColumn)); GlobalUniqueIndex globalUniqueIndex = new GlobalUniqueIndex(topology, globalUniqueIndexName, properties); topology.getGlobalUniqueIndexSchema().globalUniqueIndexes.put(globalUniqueIndex.getName(),globalUniqueIndex); TopologyManager.addGlobalUniqueIndex(sqlgGraph, globalUniqueIndexName, properties); globalUniqueIndex.committed = false; return globalUniqueIndex; }
@SuppressWarnings("OptionalGetWithoutIsPresent") static GlobalUniqueIndex createGlobalUniqueIndex(SqlgGraph sqlgGraph, Topology topology, String globalUniqueIndexName, Set<PropertyColumn> properties) { //all PropertyColumns must be for the same PropertyType PropertyType propertyType = properties.iterator().next().getPropertyType(); Map<String, PropertyType> valueColumn = new HashMap<>(); valueColumn.put(GLOBAL_UNIQUE_INDEX_RECORD_ID, PropertyType.STRING); valueColumn.put(GLOBAL_UNIQUE_INDEX_PROPERTY_NAME, PropertyType.STRING); valueColumn.put(GLOBAL_UNIQUE_INDEX_VALUE, propertyType); VertexLabel vertexLabel = topology.getGlobalUniqueIndexSchema().ensureVertexLabelExist(globalUniqueIndexName, valueColumn); PropertyColumn valuePropertyColumn = vertexLabel.getProperty(GLOBAL_UNIQUE_INDEX_VALUE).get(); PropertyColumn recordIdColumn = vertexLabel.getProperty(GLOBAL_UNIQUE_INDEX_RECORD_ID).get(); PropertyColumn propertyColumn = vertexLabel.getProperty(GLOBAL_UNIQUE_INDEX_PROPERTY_NAME).get(); vertexLabel.ensureIndexExists(IndexType.UNIQUE, Collections.singletonList(valuePropertyColumn)); vertexLabel.ensureIndexExists(IndexType.UNIQUE, Arrays.asList(recordIdColumn, propertyColumn)); GlobalUniqueIndex globalUniqueIndex = new GlobalUniqueIndex(topology, globalUniqueIndexName, properties); topology.getGlobalUniqueIndexSchema().globalUniqueIndexes.put(globalUniqueIndex.getName(),globalUniqueIndex); TopologyManager.addGlobalUniqueIndex(sqlgGraph, globalUniqueIndexName, properties); globalUniqueIndex.committed = false; return globalUniqueIndex; }
String globalUniqueIndexName = globalUniqueIndexVertex.value("name"); GlobalUniqueIndex globalUniqueIndex = GlobalUniqueIndex.instantiateGlobalUniqueIndex(this, globalUniqueIndexName); getGlobalUniqueIndexSchema().globalUniqueIndexes.put(globalUniqueIndexName, globalUniqueIndex);
String globalUniqueIndexName = globalUniqueIndexVertex.value("name"); GlobalUniqueIndex globalUniqueIndex = GlobalUniqueIndex.instantiateGlobalUniqueIndex(this, globalUniqueIndexName); getGlobalUniqueIndexSchema().globalUniqueIndexes.put(globalUniqueIndexName, globalUniqueIndex);