Package land.oras

Class OCI<T extends Ref<@NonNull T>>

java.lang.Object
land.oras.OCI<T>
Type Parameters:
T - The reference type
Direct Known Subclasses:
OCILayout, Registry

public abstract sealed class OCI<T extends Ref<@NonNull T>> extends Object permits Registry, OCILayout
Abstract class for OCI operation on remote registry or layout Commons methods for OCI operations
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
      The logger
  • Constructor Details

    • OCI

      protected OCI()
      Default constructor
  • Method Details

    • pushArtifact

      public Manifest pushArtifact(T ref, LocalPath... paths)
      Push an artifact
      Parameters:
      ref - The ref
      paths - The paths
      Returns:
      The manifest
    • pushArtifact

      public Manifest pushArtifact(T ref, ArtifactType artifactType, LocalPath... paths)
      Push an artifact
      Parameters:
      ref - The ref
      artifactType - The artifact type
      paths - The paths
      Returns:
      The manifest
    • pushArtifact

      public Manifest pushArtifact(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths)
      Upload an ORAS artifact
      Parameters:
      ref - The ref
      artifactType - The artifact type
      annotations - The annotations
      paths - The paths
      Returns:
      The manifest
    • pushBlob

      public Layer pushBlob(T ref, Path blob)
      Push a blob from file
      Parameters:
      ref - The ref
      blob - The blob
      Returns:
      The layer
    • pushBlob

      public Layer pushBlob(T ref, InputStream input)
      Push a blob from file
      Parameters:
      ref - The ref
      input - The input stream
      Returns:
      The layer
    • pushLayers

      protected final List<Layer> pushLayers(T ref, boolean withDigest, LocalPath... paths)
    • pushConfig

      public final Config pushConfig(T ref, Config config)
      Push config
      Parameters:
      ref - The ref
      config - The config
      Returns:
      The config
    • attachArtifact

      public final Manifest attachArtifact(T ref, ArtifactType artifactType, LocalPath... paths)
      Attach an artifact
      Parameters:
      ref - The ref
      artifactType - The artifact type
      paths - The paths
      Returns:
      The manifest
    • pushArtifact

      public abstract Manifest pushArtifact(T ref, ArtifactType artifactType, Annotations annotations, @Nullable Config config, LocalPath... paths)
      Push an artifact
      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 abstract void pullArtifact(T ref, Path path, boolean overwrite)
      Pull an artifact
      Parameters:
      ref - The reference of the artifact
      path - The path to save the artifact
      overwrite - Overwrite the artifact if it exists
    • pushManifest

      public abstract Manifest pushManifest(T ref, Manifest manifest)
      Push a manifest
      Parameters:
      ref - The ref
      manifest - The manifest
      Returns:
      The location
    • getIndex

      public abstract Index getIndex(T ref)
      Retrieve an index
      Parameters:
      ref - The ref
      Returns:
      The index
    • getManifest

      public abstract Manifest getManifest(T ref)
      Retrieve a manifest
      Parameters:
      ref - The ref
      Returns:
      The manifest
    • getDescriptor

      public abstract Descriptor getDescriptor(T ref)
      Retrieve a descriptor
      Parameters:
      ref - The ref
      Returns:
      The descriptor
    • getBlob

      public abstract byte[] getBlob(T ref)
      Get the blob for the given digest. Not be suitable for large blobs
      Parameters:
      ref - The ref
      Returns:
      The blob as bytes
    • fetchBlob

      public abstract void fetchBlob(T ref, Path path)
      Fetch blob and save it to file
      Parameters:
      ref - The ref
      path - The path to save the blob
    • fetchBlob

      public abstract InputStream fetchBlob(T ref)
      Fetch blob and return it as input stream
      Parameters:
      ref - The ref
      Returns:
      The input stream
    • fetchBlobDescriptor

      public abstract Descriptor fetchBlobDescriptor(T ref)
      Fetch blob and return it's descriptor
      Parameters:
      ref - The ref
      Returns:
      The descriptor
    • pushBlob

      public abstract Layer pushBlob(T ref, Path blob, Map<String,String> annotations)
      Push a blob from file
      Parameters:
      ref - The container
      blob - The blob
      annotations - The annotations
      Returns:
      The layer
    • pushBlob

      public abstract Layer pushBlob(T ref, byte[] data)
      Push the blob for the given layer
      Parameters:
      ref - The container ref
      data - The data
      Returns:
      The layer
    • attachArtifact

      public Manifest attachArtifact(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths)
      Attach file to an existing manifest
      Parameters:
      ref - The ref
      artifactType - The artifact type
      annotations - The annotations
      paths - The paths
      Returns:
      The manifest of the new artifact