java.lang.Object
land.oras.OCI<T>
- Type Parameters:
T
- The reference type
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionattachArtifact
(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths) Attach file to an existing manifestfinal Manifest
attachArtifact
(T ref, ArtifactType artifactType, LocalPath... paths) Attach an artifactcollectLayers
(T ref, String contentType, boolean includeAll) Collect layers from the refabstract InputStream
Fetch blob and return it as input streamabstract void
Fetch blob and save it to fileabstract Descriptor
fetchBlobDescriptor
(T ref) Fetch blob and return it's descriptorabstract byte[]
Get the blob for the given digest.abstract Descriptor
getDescriptor
(T ref) Retrieve a descriptorabstract Index
Retrieve an indexabstract Manifest
getManifest
(T ref) Retrieve a manifestabstract Referrers
getReferrers
(T ref, @Nullable ArtifactType artifactType) Get the referrers of a containerabstract Repositories
Get the tags for a refabstract Tags
Get the tags for a refprotected boolean
isIndexMediaType
(String mediaType) Return if a media type is an index media typeprotected boolean
isManifestMediaType
(String mediaType) Return if a media type is a manifest media typeabstract Descriptor
probeDescriptor
(T ref) Probe a descriptor.abstract void
pullArtifact
(T ref, Path path, boolean overwrite) Pull an artifactfinal InputStream
pullConfig
(T ref, Config config) Pull config data or just return the data from config if set inlineabstract Manifest
pushArtifact
(T ref, ArtifactType artifactType, Annotations annotations, @Nullable Config config, LocalPath... paths) Push an artifactpushArtifact
(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths) Upload an ORAS artifactpushArtifact
(T ref, ArtifactType artifactType, LocalPath... paths) Push an artifactpushArtifact
(T ref, LocalPath... paths) Push an artifactabstract Layer
Push the blob for the given layerpushBlob
(T ref, InputStream input) Push a blob from filePush a blob from fileabstract Layer
Push a blob from filefinal Config
pushConfig
(T ref, Config config) Push configabstract Index
Push an indexpushLayers
(T ref, boolean withDigest, LocalPath... paths) Push layers to the targetabstract Manifest
pushManifest
(T ref, Manifest manifest) Push a manifest
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGThe logger
-
-
Constructor Details
-
OCI
protected OCI()Default constructor
-
-
Method Details
-
pushArtifact
Push an artifact- Parameters:
ref
- The refpaths
- The paths- Returns:
- The manifest
-
pushArtifact
Push an artifact- Parameters:
ref
- The refartifactType
- The artifact typepaths
- The paths- Returns:
- The manifest
-
pushArtifact
public Manifest pushArtifact(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths) Upload an ORAS artifact- Parameters:
ref
- The refartifactType
- The artifact typeannotations
- The annotationspaths
- The paths- Returns:
- The manifest
-
pushBlob
Push a blob from file- Parameters:
ref
- The refblob
- The blob- Returns:
- The layer
-
pushBlob
Push a blob from file- Parameters:
ref
- The refinput
- The input stream- Returns:
- The layer
-
collectLayers
Collect layers from the ref- Parameters:
ref
- The refcontentType
- The content typeincludeAll
- Include all layers or only the ones with title annotation- Returns:
- The layers
-
pushLayers
Push layers to the target- Parameters:
ref
- The refwithDigest
- Push with digestpaths
- The paths to the files- Returns:
- The layers
-
isIndexMediaType
Return if a media type is an index media type- Parameters:
mediaType
- The media type- Returns:
- True if it is a index media type
-
isManifestMediaType
Return if a media type is a manifest media type- Parameters:
mediaType
- The media type- Returns:
- True if it is a manifest media type
-
pushConfig
Push config- Parameters:
ref
- The refconfig
- The config- Returns:
- The config
-
pullConfig
Pull config data or just return the data from config if set inline- Parameters:
ref
- The refconfig
- The config- Returns:
- The input stream
-
attachArtifact
Attach an artifact- Parameters:
ref
- The refartifactType
- The artifact typepaths
- The paths- Returns:
- The manifest
-
getTags
Get the tags for a ref- Parameters:
ref
- The ref- Returns:
- The tags
-
getRepositories
Get the tags for a ref- Returns:
- The repositories
-
pushArtifact
public abstract Manifest pushArtifact(T ref, ArtifactType artifactType, Annotations annotations, @Nullable Config config, LocalPath... paths) Push an artifact- Parameters:
ref
- The containerartifactType
- The artifact type. Can be nullannotations
- The annotationsconfig
- The configpaths
- The paths- Returns:
- The manifest
-
pullArtifact
Pull an artifact- Parameters:
ref
- The reference of the artifactpath
- The path to save the artifactoverwrite
- Overwrite the artifact if it exists
-
pushManifest
Push a manifest- Parameters:
ref
- The refmanifest
- The manifest- Returns:
- The location
-
pushIndex
Push an index- Parameters:
ref
- The refindex
- The index- Returns:
- The index
-
getIndex
Retrieve an index- Parameters:
ref
- The ref- Returns:
- The index
-
getManifest
Retrieve a manifest- Parameters:
ref
- The ref- Returns:
- The manifest
-
getDescriptor
Retrieve a descriptor- Parameters:
ref
- The ref- Returns:
- The descriptor
-
probeDescriptor
Probe a descriptor. Typically used to get digest, size and media type without the content- Parameters:
ref
- The ref- Returns:
- The descriptor
-
getBlob
Get the blob for the given digest. Not be suitable for large blobs- Parameters:
ref
- The ref- Returns:
- The blob as bytes
-
fetchBlob
Fetch blob and save it to file- Parameters:
ref
- The refpath
- The path to save the blob
-
fetchBlob
Fetch blob and return it as input stream- Parameters:
ref
- The ref- Returns:
- The input stream
-
fetchBlobDescriptor
Fetch blob and return it's descriptor- Parameters:
ref
- The ref- Returns:
- The descriptor
-
pushBlob
Push a blob from file- Parameters:
ref
- The containerblob
- The blobannotations
- The annotations- Returns:
- The layer
-
pushBlob
Push the blob for the given layer- Parameters:
ref
- The container refdata
- The data- Returns:
- The layer
-
getReferrers
Get the referrers of a container- Parameters:
ref
- The refartifactType
- The optional artifact type- Returns:
- The referrers
-
attachArtifact
public Manifest attachArtifact(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths) Attach file to an existing manifest- Parameters:
ref
- The refartifactType
- The artifact typeannotations
- The annotationspaths
- The paths- Returns:
- The manifest of the new artifact
-