Package land.oras
Class Registry
A registry is the main entry point for interacting with a container registry
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class land.oras.OCI
OCI.PullOptions, OCI.PushOptions -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Registry.Builderbuilder()Return a new builder for this registrybooleancanMount(OCI<?> other, ContainerRef sourceRef, ContainerRef targetRef) Return whether this OCI instance supports mounting blobs from the given source OCI instance.Return a new registry with the given registry URL but with same settingsvoiddeleteBlob(ContainerRef containerRef) Delete a blobvoiddeleteManifest(ContainerRef containerRef) Delete a manifestprotected LayerdoPushBlob(ContainerRef ref, Path blob, OCI.PushOptions options) Push a blob from a file path, respecting the given push options.fetchBlob(ContainerRef containerRef) Fetch blob and return it as input streamvoidfetchBlob(ContainerRef containerRef, Path path) Fetch blob and save it to filefetchBlobDescriptor(ContainerRef containerRef) Fetch blob and return it's descriptorbyte[]getBlob(ContainerRef containerRef) Get the blob for the given digest.getBlobStream(ContainerRef containerRef) Get blob as stream to avoid loading into memoryReturn the containers policy used for trust verification.getDescriptor(ContainerRef containerRef) Retrieve a descriptorGet the executor service for concurrent operations.getIndex(ContainerRef containerRef) Retrieve an indexgetManifest(ContainerRef containerRef) Retrieve a manifestgetReferrers(ContainerRef containerRef, @Nullable ArtifactType artifactType) Get the referrers of a containerGet the registries configuration@Nullable StringGet the registry URLGet the tags for a refGet the HTTP scheme depending on the insecure flaggetTags(ContainerRef containerRef) Get the tags for a refgetTags(ContainerRef containerRef, int n, @Nullable String last) Get the tags for a refbooleanReturn if this registry is insecurebooleanmountBlob(ContainerRef sourceRef, ContainerRef targetRef) Mount a blob from another repository in the same OCI target.Probe a descriptor.voidpullArtifact(ContainerRef containerRef, Path path, OCI.PullOptions options) Pull an artifact using the given optionspushArtifact(ContainerRef containerRef, ArtifactType artifactType, Annotations annotations, @Nullable Config config, OCI.PushOptions options, LocalPath... paths) Push an artifactpushBlob(ContainerRef containerRef, byte[] data) Push the blob for the given layerpushBlob(ContainerRef ref, long size, Supplier<InputStream> stream, Map<String, String> annotations) Push a blob from input stream with known digest and sizePush a blob from filepushBlobChunked(ContainerRef containerRef, InputStream stream, long totalSize, long chunkSize) Push a blob using chunked uploadpushBlobChunked(ContainerRef containerRef, Path blob, long chunkSize) Push a blob using chunked uploadpushIndex(ContainerRef containerRef, Index index) Push an indexpushManifest(ContainerRef containerRef, Manifest manifest) Push a manifestwithAuthToken(String authToken) Return a new registry with a new auth external token and same settingsMethods inherited from class land.oras.OCI
attachArtifact, attachArtifact, collectLayers, isIndexMediaType, isManifestMediaType, pullArtifact, pullConfig, pushArtifact, pushArtifact, pushArtifact, pushArtifact, pushArtifact, pushArtifact, pushArtifact, pushBlob, pushBlob, pushConfig, pushLayer, pushLayer, pushLayers, pushLayers
-
Method Details
-
canMount
Description copied from class:OCIReturn whether this OCI instance supports mounting blobs from the given source OCI instance.- Specified by:
canMountin classOCI<ContainerRef>- Parameters:
other- The source OCI instance to check compatibility withsourceRef- The source referencetargetRef- The target reference- Returns:
trueif mounting fromotheris supported
-
mountBlob
Description copied from class:OCIMount a blob from another repository in the same OCI target.- Specified by:
mountBlobin classOCI<ContainerRef>- Parameters:
sourceRef- The source reference containing the source repository or layout pathtargetRef- The target reference containing the digest to mount- Returns:
trueif the blob is successfully mounted,falseotherwise (not supported by registry)
-
getRegistriesConf
Get the registries configuration- Returns:
- The registries configuration
-
builder
Return a new builder for this registry- Returns:
- The builder
-
isInsecure
public boolean isInsecure()Return if this registry is insecure- Returns:
- True if insecure
-
getContainersPolicy
Return the containers policy used for trust verification.- Returns:
- the containers policy
-
getScheme
Get the HTTP scheme depending on the insecure flag- Returns:
- The scheme
-
copy
Return a new registry with the given registry URL but with same settings- Parameters:
newRegistry- The new target registry URL to use in the new registry- Returns:
- The new registry
-
withAuthToken
Return a new registry with a new auth external token and same settings- Parameters:
authToken- The new refreshed token- Returns:
- The new registry
-
getRegistry
Get the registry URL- Returns:
- The registry URL
-
getExecutorService
Description copied from class:OCIGet the executor service for concurrent operations. This is used for concurrent pushing and pulling of layers.- Specified by:
getExecutorServicein classOCI<ContainerRef>- Returns:
- The executor service
-
getTags
Description copied from class:OCIGet the tags for a ref- Specified by:
getTagsin classOCI<ContainerRef>- Parameters:
containerRef- The ref- Returns:
- The tags
-
getTags
Description copied from class:OCIGet the tags for a ref- Specified by:
getTagsin classOCI<ContainerRef>- Parameters:
containerRef- The refn- The number of tags to return. If n is less than or equal to 0, return all tagslast- The last tag index, to iterate. If null, start from the beginning- Returns:
- The tags
-
getRepositories
Description copied from class:OCIGet the tags for a ref- Specified by:
getRepositoriesin classOCI<ContainerRef>- Returns:
- The repositories
-
getReferrers
Description copied from class:OCIGet the referrers of a container- Specified by:
getReferrersin classOCI<ContainerRef>- Parameters:
containerRef- The refartifactType- The optional artifact type- Returns:
- The referrers
-
deleteManifest
Delete a manifest- Parameters:
containerRef- The artifact
-
pushManifest
Description copied from class:OCIPush a manifest- Specified by:
pushManifestin classOCI<ContainerRef>- Parameters:
containerRef- The refmanifest- The manifest- Returns:
- The location
-
pushIndex
Description copied from class:OCIPush an index- Specified by:
pushIndexin classOCI<ContainerRef>- Parameters:
containerRef- The refindex- The index- Returns:
- The index
-
deleteBlob
Delete a blob- Parameters:
containerRef- The container
-
pullArtifact
Description copied from class:OCIPull an artifact using the given options- Specified by:
pullArtifactin classOCI<ContainerRef>- Parameters:
containerRef- The reference of the artifactpath- The path to save the artifactoptions- The pull options
-
pushArtifact
public Manifest pushArtifact(ContainerRef containerRef, ArtifactType artifactType, Annotations annotations, @Nullable Config config, OCI.PushOptions options, LocalPath... paths) Description copied from class:OCIPush an artifact- Specified by:
pushArtifactin classOCI<ContainerRef>- Parameters:
containerRef- The containerartifactType- The artifact type. Can be nullannotations- The annotationsconfig- The configoptions- The push optionspaths- The paths- Returns:
- The manifest
-
doPushBlob
Description copied from class:OCIPush a blob from a file path, respecting the given push options. Subclasses may override to support chunked upload.- Overrides:
doPushBlobin classOCI<ContainerRef>- Parameters:
ref- The refblob- The blob fileoptions- The push options- Returns:
- The layer
-
pushBlob
Description copied from class:OCIPush a blob from file- Specified by:
pushBlobin classOCI<ContainerRef>- Parameters:
containerRef- The containerblob- The blobannotations- The annotations- Returns:
- The layer
-
pushBlob
public Layer pushBlob(ContainerRef ref, long size, Supplier<InputStream> stream, Map<String, String> annotations) Description copied from class:OCIPush a blob from input stream with known digest and size- Specified by:
pushBlobin classOCI<ContainerRef>- Parameters:
ref- The container ref with digestsize- The size of the blobstream- The input stream of the blobannotations- The annotations- Returns:
- The layer
-
pushBlob
Description copied from class:OCIPush the blob for the given layer- Specified by:
pushBlobin classOCI<ContainerRef>- Parameters:
containerRef- The container refdata- The data- Returns:
- The layer
-
pushBlobChunked
Push a blob using chunked upload- Parameters:
containerRef- The container referenceblob- The blob file to uploadchunkSize- Maximum number of bytes per chunk. Must be > 0.- Returns:
- The
Layerdescriptor for the uploaded blob. - Throws:
OrasException- if the upload fails at any stage.
-
pushBlobChunked
public Layer pushBlobChunked(ContainerRef containerRef, InputStream stream, long totalSize, long chunkSize) Push a blob using chunked upload- Parameters:
containerRef- The container referencestream- Input streamtotalSize- Total size of the streamchunkSize- Maximum number of bytes per chunk. Must be > 0.- Returns:
- The
Layerdescriptor for the uploaded blob. - Throws:
OrasException- if the upload fails at any stage.
-
getBlob
Get the blob for the given digest. Not be suitable for large blobs- Specified by:
getBlobin classOCI<ContainerRef>- Parameters:
containerRef- The container- Returns:
- The blob as bytes
-
fetchBlob
Description copied from class:OCIFetch blob and save it to file- Specified by:
fetchBlobin classOCI<ContainerRef>- Parameters:
containerRef- The refpath- The path to save the blob
-
fetchBlob
Description copied from class:OCIFetch blob and return it as input stream- Specified by:
fetchBlobin classOCI<ContainerRef>- Parameters:
containerRef- The ref- Returns:
- The input stream
-
fetchBlobDescriptor
Description copied from class:OCIFetch blob and return it's descriptor- Specified by:
fetchBlobDescriptorin classOCI<ContainerRef>- Parameters:
containerRef- The ref- Returns:
- The descriptor
-
getManifest
Description copied from class:OCIRetrieve a manifest- Specified by:
getManifestin classOCI<ContainerRef>- Parameters:
containerRef- The ref- Returns:
- The manifest
-
getIndex
Description copied from class:OCIRetrieve an index- Specified by:
getIndexin classOCI<ContainerRef>- Parameters:
containerRef- The ref- Returns:
- The index
-
getDescriptor
Description copied from class:OCIRetrieve a descriptor- Specified by:
getDescriptorin classOCI<ContainerRef>- Parameters:
containerRef- The ref- Returns:
- The descriptor
-
probeDescriptor
Description copied from class:OCIProbe a descriptor. Typically used to get digest, size and media type without the content- Specified by:
probeDescriptorin classOCI<ContainerRef>- Parameters:
ref- The ref- Returns:
- The descriptor
-
getBlobStream
Get blob as stream to avoid loading into memory- Parameters:
containerRef- The container ref- Returns:
- The input stream
-