Package land.oras

Class OCILayout


public final class OCILayout extends OCI<LayoutRef>
Index from an OCI layout
  • Method Details

    • pushArtifact

      public Manifest pushArtifact(LayoutRef ref, ArtifactType artifactType, Annotations annotations, @Nullable Config config, LocalPath... paths)
      Description copied from class: OCI
      Push an artifact
      Specified by:
      pushArtifact in class OCI<LayoutRef>
      Parameters:
      ref - The container
      artifactType - The artifact type. Can be null
      annotations - The annotations
      config - The config
      paths - The paths
      Returns:
      The manifest
    • pullArtifact

      public void pullArtifact(LayoutRef ref, Path path, boolean overwrite)
      Description copied from class: OCI
      Pull an artifact
      Specified by:
      pullArtifact in class OCI<LayoutRef>
      Parameters:
      ref - The reference of the artifact
      path - The path to save the artifact
      overwrite - Overwrite the artifact if it exists
    • pushManifest

      public Manifest pushManifest(LayoutRef layoutRef, Manifest manifest)
      Description copied from class: OCI
      Push a manifest
      Specified by:
      pushManifest in class OCI<LayoutRef>
      Parameters:
      layoutRef - The ref
      manifest - The manifest
      Returns:
      The location
    • getIndex

      public Index getIndex(LayoutRef ref)
      Description copied from class: OCI
      Retrieve an index
      Specified by:
      getIndex in class OCI<LayoutRef>
      Parameters:
      ref - The ref
      Returns:
      The index
    • getManifest

      public Manifest getManifest(LayoutRef ref)
      Description copied from class: OCI
      Retrieve a manifest
      Specified by:
      getManifest in class OCI<LayoutRef>
      Parameters:
      ref - The ref
      Returns:
      The manifest
    • getBlob

      public byte[] getBlob(LayoutRef layoutRef)
      Description copied from class: OCI
      Get the blob for the given digest. Not be suitable for large blobs
      Specified by:
      getBlob in class OCI<LayoutRef>
      Parameters:
      layoutRef - The ref
      Returns:
      The blob as bytes
    • fetchBlob

      public void fetchBlob(LayoutRef ref, Path path)
      Description copied from class: OCI
      Fetch blob and save it to file
      Specified by:
      fetchBlob in class OCI<LayoutRef>
      Parameters:
      ref - The ref
      path - The path to save the blob
    • fetchBlob

      public InputStream fetchBlob(LayoutRef ref)
      Description copied from class: OCI
      Fetch blob and return it as input stream
      Specified by:
      fetchBlob in class OCI<LayoutRef>
      Parameters:
      ref - The ref
      Returns:
      The input stream
    • fetchBlobDescriptor

      public Descriptor fetchBlobDescriptor(LayoutRef ref)
      Description copied from class: OCI
      Fetch blob and return it's descriptor
      Specified by:
      fetchBlobDescriptor in class OCI<LayoutRef>
      Parameters:
      ref - The ref
      Returns:
      The descriptor
    • pushBlob

      public Layer pushBlob(LayoutRef ref, Path blob, Map<String,String> annotations)
      Description copied from class: OCI
      Push a blob from file
      Specified by:
      pushBlob in class OCI<LayoutRef>
      Parameters:
      ref - The container
      blob - The blob
      annotations - The annotations
      Returns:
      The layer
    • pushBlob

      public Layer pushBlob(LayoutRef ref, byte[] data)
      Description copied from class: OCI
      Push the blob for the given layer
      Specified by:
      pushBlob in class OCI<LayoutRef>
      Parameters:
      ref - The container ref
      data - The data
      Returns:
      The layer
    • toJson

      public String toJson()
      Return the JSON representation of the referrers
      Returns:
      The JSON string
    • fromJson

      public static OCILayout fromJson(String json)
      Create the OCI layout file from a JSON string
      Parameters:
      json - The JSON string
      Returns:
      The OCI layout
    • getImageLayoutVersion

      public String getImageLayoutVersion()
      Return the image layout version
      Returns:
      The image layout version
    • copy

      public void copy(Registry registry, ContainerRef containerRef)
      Copy the direct container ref from registry into oci-layout
      Parameters:
      registry - The registry
      containerRef - The container
    • copy

      public void copy(Registry registry, ContainerRef containerRef, boolean recursive)
      Copy the container ref from registry into oci-layout
      Parameters:
      registry - The registry
      containerRef - The container
      recursive - True if references should be copied
    • getDescriptor

      public Descriptor getDescriptor(LayoutRef ref)
      Description copied from class: OCI
      Retrieve a descriptor
      Specified by:
      getDescriptor in class OCI<LayoutRef>
      Parameters:
      ref - The ref
      Returns:
      The descriptor
    • fromLayoutIndex

      public static OCILayout fromLayoutIndex(Path layoutPath)
      Return the OCI layout from the index.json file
      Parameters:
      layoutPath - The path to the layout containing the index.json file
      Returns:
      The OCI layout