Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regitry.Repository does not implement content.ReadOnlyGraphStorage #806

Open
JefeDavis opened this issue Aug 14, 2024 · 1 comment · May be fixed by #807
Open

regitry.Repository does not implement content.ReadOnlyGraphStorage #806

JefeDavis opened this issue Aug 14, 2024 · 1 comment · May be fixed by #807
Labels
v3 Things belongs to version 3.x

Comments

@JefeDavis
Copy link

currently remote.NewRepository("myreg/myrepo") returns a remote.Repository object
but i use reg, err := remote.NewRegistry("myreg") and then call reg.Repository("myrepo") it returns a registry.Repository interface.

Unfortunately this interface is missing the Predecessors() method which means that it does not implement the content.ReadOnlyGraphStorage

this means that while i can use content.CopyGraph, i cannot use content.ExtendedCopyGraph

@shizhMSFT shizhMSFT added the v3 Things belongs to version 3.x label Aug 14, 2024
@shizhMSFT
Copy link
Contributor

Thank @JefeDavis for mentioning this.
It is a breaking change to introduce content.PredecessorFinder in the Repository interface. Therefore, the change cannot be introduced to oras-go v2.
As a workaround, you can do type casting like

reg, err := remote.NewRegistry("myreg")
if err != nil {
    // handle error
}
repo, err := reg.Repository("myrepo")
if err != nil {
    // handle error
}
target, ok := repo.(content.GraphTarget)
if !ok {
    // handle exception
    // note that *remote.Repository implements oras.GraphTarget
}
// use target with Copy or ExtendedCopy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 Things belongs to version 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants