-
Notifications
You must be signed in to change notification settings - Fork 546
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
registry: add disk-backed storage #488
Comments
I've wanted to take advantage of the handler code (and registry) but have swappable implementations of the actual storage. There's more than just disk vs memory, e.g. I'd like to be able to use this to run a proxy registry. We could start by defining an actual interface for the content (instead of just maps) and use that interface from the handlers. Something like: type blobStore interface {
Get(key string) (io.ReadSeeker, error)
Put(key string, blob io.ReadCloser) error
Delete(key string) error
}
// Wrapper for current implementation.
type memBlobStore struct {
contents map[string][]byte
}
func (bs *memBlobStore) Get(key string) (io.ReadSeeker, error) {
if b, ok := bs.contents[key]; ok {
return bytes.NewReader(b), nil
}
return nil, errNotFound
}
func (bs *memBlobStore) Put(key string, blob io.ReadCloser) error {
b, err := ioutil.ReadAll(blob)
if err != nil {
return err
}
bs.contents[key] = b
return nil
}
func (bs *memBlobStore) Delete(key string) error {
delete(bs.contents, key)
return nil
} (I'm not 100% sold on this as a good blobs API, just a strawman.) If that is easy enough, we can figure out an API for the manifests as well. I'm not actually that familiar with this code, so I'd defer to @clrprod's thoughts. |
sgtm - as long as you're adding a second implementation (i.e. postgres or another registry). I generally don't like unused abstraction. |
Ah didn't see the original comment, yeah a disk backed version is totally doable. Maybe default to ioutil.TempDir(), but allow for an alternate path? |
I'd probably do something like
|
Then you can call New(Dir("/foo")) and store on disk, or New(TmpDir()) if you just want a random dir, while leaving the default behaviour in memory. The underlying implementation could implement Jon's interface with memory and disk. (or a different interface if that doesn't quite work). |
But yeah - do it, I'll gladly look forwards to the PR :D |
This seems related to https://godoc.org/github.com/google/go-containerregistry/pkg/v1/cache#NewFilesystemCache -- if you decide on a different API to describe filesystem-backed...things..., please consider updating that API to match it. |
I'd love if the |
Functional options sound good to me. Will definitely abstract away the storage. I don't think we should have |
SGTM
…On Thu, Jul 25, 2019 at 1:13 PM Ammar Bandukwala ***@***.***> wrote:
Functional options sound good to me.
Will definitely abstract away the storage.
I don't think we should have TmpDir() because the user should really be
removing a temporary directory when they're done.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#488?email_source=notifications&email_token=AHRSOCAQUTTJY4ELR3HZ5ZDQBHNMNA5CNFSM4IG37P62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD22EIRA#issuecomment-515130436>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHRSOCCW2DXCBZGJ4QIA7ALQBHNMNANCNFSM4IG37P6Q>
.
|
Pre-requisite for google#488
Sorry for the necromancy, but this is still an issue right? |
This issue covers the If you're hitting kaniko memory usage limits, it's probably because they're buffering layers in memory, which they could get around either by writing layer data to disk (e.g., with |
We might want to create a new issue from this -- it seems like we're the ones who should be using a go-containerregistry/pkg/v1/mutate/mutate.go Lines 332 to 340 in 38ad4ec
At some point I thought it was necessary to hack this commit together: jonjohnsonjr@542d74b It may be that naively changing the layertime implementation to use |
@jonjohnsonjr it was a comment on the issue opened on the kaniko repo by @nathan-c that led me to |
No worries. Filed #749 to track this separately. |
This issue is stale because it has been open for 90 days with no |
The current implementation is a big memory hog for my tests.
I'm thinking we create
NewMemory()
andNewDisk(root string)
functions, and deprecate the currentNew()
function.If this idea is OK with you @jonjohnsonjr, I can implement it.
The text was updated successfully, but these errors were encountered: