private Partition createRangePartition(String name, String from, String to) { Preconditions.checkState(!this.getSchema().isSqlgSchema(), "createRangePartition may not be called for \"%s\"", SQLG_SCHEMA); this.uncommittedPartitions.remove(name); Partition partition = Partition.createRangePartition(this.sqlgGraph, this, name, from, to); this.uncommittedPartitions.put(name, partition); this.getSchema().getTopology().fire(partition, "", TopologyChangeAction.CREATE); return partition; }
public void ensureRangePartitionExists(String name, String from, String to) { Objects.requireNonNull(name, "Sub-partition's \"name\" must not be null"); Objects.requireNonNull(from, "Sub-partition's \"from\" must not be null"); Objects.requireNonNull(to, "Sub-partition's \"to\" must not be null"); Preconditions.checkState(this.partitionType == PartitionType.RANGE, "ensureRangePartitionExists(String name, String from, String to) can only be called for a RANGE 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.createRangePartition(name, from, to)); } else { partitionOptional.get(); } }
public void ensureRangePartitionExists(String name, String from, String to) { Objects.requireNonNull(name, "Sub-partition's \"name\" must not be null"); Objects.requireNonNull(from, "Sub-partition's \"from\" must not be null"); Objects.requireNonNull(to, "Sub-partition's \"to\" must not be null"); Preconditions.checkState(this.partitionType == PartitionType.RANGE, "ensureRangePartitionExists(String name, String from, String to) can only be called for a RANGE 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.createRangePartition(name, from, to)); } else { partitionOptional.get(); } }
private Partition createRangePartition(String name, String from, String to) { Preconditions.checkState(!this.getSchema().isSqlgSchema(), "createRangePartition may not be called for \"%s\"", SQLG_SCHEMA); this.uncommittedPartitions.remove(name); Partition partition = Partition.createRangePartition(this.sqlgGraph, this, name, from, to); this.uncommittedPartitions.put(name, partition); this.getSchema().getTopology().fire(partition, "", TopologyChangeAction.CREATE); return partition; }