-
Notifications
You must be signed in to change notification settings - Fork 267
Add truncindex to stores, to allow use of truncated IDs #6
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
Conversation
storage/layers.go
Outdated
| } | ||
| if layer, ok := r.byname[id]; ok { | ||
| id = layer.ID | ||
| } else if longid, err := r.idindex.Get(id); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you have a function which fisrt check the r.byname[id] and the the truncindex to not repeat this else if over? skip this if you think it's not worth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well; it should make a dent in the lint warnings.
|
Okay, updated. I think it got rid of a couple of lint warnings, at least. |
59bcd9d to
63fecb6
Compare
Add a truncindex to the layer, image, and container stores, so that layers, images, and containers can also be referred to by truncated versions of their IDs in any place where we previously accepted names. For containers, we don't add a truncated index for referring to containers by layer ID, because there doesn't appear to be a minimum length in truncindex, and we don't want to mistakenly treat a truncated but not sufficiently-unique container ID as a layer ID, which would likely resolve to some other different container. Signed-off-by: Nalin Dahyabhai <[email protected]>
Signed-off-by: Nalin Dahyabhai <[email protected]>
Signed-off-by: Nalin Dahyabhai <[email protected]>
Factor out name/ID lookups (ID as-is, name, top layer ID for containers, truncated ID) into a helper function to keep from duplicating them many times over. Factor out removeNames() helpers, too, since they all do the same thing. Signed-off-by: Nalin Dahyabhai <[email protected]>
|
Rebased on top of #24. |
|
@runcom PTAL We need to get this in. |
|
👍 |
|
LGTM |
|
@nalind Can we merge this now? |
|
Sure, merging. |
Fix the Lookup methods in container and image stores, which broke when we merged #6. Signed-off-by: Nalin Dahyabhai <[email protected]>
Fix canonicalization of layer IDs when computing layer differences, which we also broke in #6. Signed-off-by: Nalin Dahyabhai <[email protected]>
Fix canonicalization of layer IDs when computing layer differences, which we also broke in #6. Signed-off-by: Nalin Dahyabhai <[email protected]>
Add a truncindex to the layer, image, and container stores, so that layers, images, and containers can also be referred to by truncated versions of their IDs in any place where we previously accepted names.
For containers, we don't add a truncated index for referring to containers by layer ID, because there doesn't appear to be a minimum length in truncindex, and we don't want to mistakenly treat a truncated but not sufficiently-unique container ID as a layer ID, which would likely resolve to some other different container.