Search in sources :

Example 1 with ContainerInfoProto

use of org.apache.hadoop.hdds.protocol.proto.HddsProtos.ContainerInfoProto in project ozone by apache.

the class ContainerManagerImpl method allocateContainer.

private ContainerInfo allocateContainer(final Pipeline pipeline, final String owner) throws IOException {
    final long uniqueId = sequenceIdGen.getNextId(CONTAINER_ID);
    Preconditions.checkState(uniqueId > 0, "Cannot allocate container, negative container id" + " generated. %s.", uniqueId);
    final ContainerID containerID = ContainerID.valueOf(uniqueId);
    final ContainerInfoProto containerInfo = ContainerInfoProto.newBuilder().setState(LifeCycleState.OPEN).setPipelineID(pipeline.getId().getProtobuf()).setUsedBytes(0).setNumberOfKeys(0).setStateEnterTime(Time.now()).setOwner(owner).setContainerID(containerID.getId()).setDeleteTransactionId(0).setReplicationFactor(ReplicationConfig.getLegacyFactor(pipeline.getReplicationConfig())).setReplicationType(pipeline.getType()).build();
    containerStateManager.addContainer(containerInfo);
    scmContainerManagerMetrics.incNumSuccessfulCreateContainers();
    return containerStateManager.getContainer(containerID);
}
Also used : ContainerInfoProto(org.apache.hadoop.hdds.protocol.proto.HddsProtos.ContainerInfoProto)

Aggregations

ContainerInfoProto (org.apache.hadoop.hdds.protocol.proto.HddsProtos.ContainerInfoProto)1