Class ContainerDataYaml

java.lang.Object
org.apache.hadoop.ozone.container.common.impl.ContainerDataYaml

public final class ContainerDataYaml extends Object
Class for creating and reading .container files.
  • Method Details

    • createContainerFile

      public static void createContainerFile(ContainerData containerData, File containerFile) throws IOException
      Creates a .container file in yaml format.
      Throws:
      IOException
    • readContainerFile

      public static ContainerData readContainerFile(File containerFile) throws IOException
      Read the yaml file, and return containerData.
      Throws:
      IOException
    • readContainer

      public static ContainerData readContainer(byte[] containerFileContent) throws IOException
      Read the yaml file content, and return containerData.
      Throws:
      IOException
    • readContainer

      public static ContainerData readContainer(InputStream input) throws IOException
      Read the yaml content, and return containerData.
      Throws:
      IOException
    • getYamlForContainerType

      public static org.yaml.snakeyaml.Yaml getYamlForContainerType(org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType containerType, boolean withReplicaIndex) throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Given a ContainerType this method returns a Yaml representation of the container properties.
      Parameters:
      containerType - type of container
      withReplicaIndex - in the container yaml
      Returns:
      Yamal representation of container properties
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException - if the type is unrecognized