Package land.oras

Class OCILayout


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

    • builder

      public static OCILayout.Builder builder()
      Return a new builder for this oci layout
      Returns:
      The builder
    • 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
    • pushIndex

      public Index pushIndex(LayoutRef layoutRef, Index index)
      Description copied from class: OCI
      Push an index
      Specified by:
      pushIndex in class OCI<LayoutRef>
      Parameters:
      layoutRef - The ref
      index - The index
      Returns:
      The index
    • 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
    • getTags

      public Tags getTags(LayoutRef ref)
      Description copied from class: OCI
      Get the tags for a ref
      Specified by:
      getTags in class OCI<LayoutRef>
      Parameters:
      ref - The ref
      Returns:
      The tags
    • getRepositories

      public Repositories getRepositories()
      Description copied from class: OCI
      Get the tags for a ref
      Specified by:
      getRepositories in class OCI<LayoutRef>
      Returns:
      The repositories
    • getReferrers

      public Referrers getReferrers(LayoutRef ref, @Nullable ArtifactType artifactType)
      Description copied from class: OCI
      Get the referrers of a container
      Specified by:
      getReferrers in class OCI<LayoutRef>
      Parameters:
      ref - The ref
      artifactType - The optional artifact type
      Returns:
      The referrers
    • 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
    • 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
    • probeDescriptor

      public Descriptor probeDescriptor(LayoutRef ref)
      Description copied from class: OCI
      Probe a descriptor. Typically used to get digest, size and media type without the content
      Specified by:
      probeDescriptor 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
    • getPath

      public Path getPath()
      Return the path to the OCI layout
      Returns:
      The path to the OCI layout