Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/land/oras/ContainerRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ public static ContainerRef parse(String name) {
* Get the effective registry based on given target
* This methods will perform HEAD request to determine the first unqualified search registry that contains the container reference if the reference is unqualified, otherwise return the registry of the reference.
* This only works with Manifests and Index but now direct blob access.
* See {@link #forRegistry(String)} so set correct registry when getting blobs outside high level API like {@link Registry#pullArtifact(ContainerRef, Path, boolean)}.
* See {@link #forRegistry(String)} to set correct registry when getting blobs outside high level API like {@link Registry#pullArtifact(ContainerRef, Path, OCI.PullOptions)}.
* @param target The target registry
* @return The effective registry
*/
Expand Down
31 changes: 26 additions & 5 deletions src/main/java/land/oras/CopyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ private CopyUtils() {

/**
* Options for copy.
* @param includeReferrers Whether to include referrers in the copy
* @param platformFilter Optional platform filter. When set on an index copy, only manifests matching
* one of the given platforms are copied and the resulting index contains only
* those manifests. The resulting index digest will differ from the source index.
*/
public record CopyOptions(boolean includeReferrers, @Nullable Set<Platform> platformFilter) {
@OrasModel
public static final class CopyOptions {

private final boolean includeReferrers;
private final @Nullable Set<Platform> platformFilter;

private CopyOptions(boolean includeReferrers, @Nullable Set<Platform> platformFilter) {
this.includeReferrers = includeReferrers;
this.platformFilter = platformFilter;
}

/**
* The default copy options with includeReferrers to false
Expand Down Expand Up @@ -82,6 +87,22 @@ public static CopyOptions deep() {
public CopyOptions withPlatformFilter(Set<Platform> platforms) {
return new CopyOptions(includeReferrers, platforms);
}

/**
* Return whether referrers should be included in the copy.
* @return {@code true} if referrers should be included
*/
public boolean includeReferrers() {
return includeReferrers;
}

/**
* Return the optional platform filter.
* @return The platform filter, or {@code null} if not set
*/
public @Nullable Set<Platform> platformFilter() {
return platformFilter;
}
}

/**
Expand Down
Loading
Loading