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; }
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; }
public void ensureListPartitionExists(String name, String in) { Objects.requireNonNull(name, "Sub-partition's \"name\" must not be null"); Objects.requireNonNull(in, "Sub-partition's \"in\" must not be null"); Preconditions.checkState(this.partitionType == PartitionType.LIST, "ensureRangePartitionExists(String name, String in) can only be called for a LIST partitioned VertexLabel. Found %s", this.partitionType.name()); Optional<Partition> partitionOptional = this.getPartition(name); if (!partitionOptional.isPresent()) { this.getAbstractLabel().getSchema().getTopology().lock(); partitionOptional = this.getPartition(name); partitionOptional.orElseGet(() -> this.createListPartition(name, in)); } else { partitionOptional.get(); } }
public void ensureListPartitionExists(String name, String in) { Objects.requireNonNull(name, "Sub-partition's \"name\" must not be null"); Objects.requireNonNull(in, "Sub-partition's \"in\" must not be null"); Preconditions.checkState(this.partitionType == PartitionType.LIST, "ensureRangePartitionExists(String name, String in) can only be called for a LIST partitioned VertexLabel. Found %s", this.partitionType.name()); Optional<Partition> partitionOptional = this.getPartition(name); if (!partitionOptional.isPresent()) { this.getAbstractLabel().getSchema().getTopology().lock(); partitionOptional = this.getPartition(name); partitionOptional.orElseGet(() -> this.createListPartition(name, in)); } else { partitionOptional.get(); } }