Skip to content

Conversation

@nalind
Copy link
Member

@nalind nalind commented Dec 6, 2016

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.

}
if layer, ok := r.byname[id]; ok {
id = layer.ID
} else if longid, err := r.idindex.Get(id); err == nil {
Copy link
Member

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.

Copy link
Member Author

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.

@nalind
Copy link
Member Author

nalind commented Dec 7, 2016

Okay, updated. I think it got rid of a couple of lint warnings, at least.

@nalind nalind force-pushed the truncindex branch 6 times, most recently from 59bcd9d to 63fecb6 Compare January 25, 2017 12:47
nalind added 4 commits March 6, 2017 13:53
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]>
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]>
@nalind
Copy link
Member Author

nalind commented Mar 6, 2017

Rebased on top of #24.

@rhatdan
Copy link
Member

rhatdan commented Apr 3, 2017

@runcom PTAL We need to get this in.

@rhatdan
Copy link
Member

rhatdan commented Apr 3, 2017

👍

@runcom
Copy link
Member

runcom commented Apr 3, 2017

LGTM

@rhatdan
Copy link
Member

rhatdan commented Apr 19, 2017

@nalind Can we merge this now?

@nalind
Copy link
Member Author

nalind commented Apr 19, 2017

Sure, merging.

@nalind nalind merged commit 5f85280 into containers:master Apr 19, 2017
nalind referenced this pull request in nalind/storage Apr 19, 2017
Fix the Lookup methods in container and image stores, which broke when
we merged #6.

Signed-off-by: Nalin Dahyabhai <[email protected]>
nalind referenced this pull request in nalind/storage Apr 19, 2017
Fix canonicalization of layer IDs when computing layer differences,
which we also broke in #6.

Signed-off-by: Nalin Dahyabhai <[email protected]>
nalind referenced this pull request in nalind/storage Apr 19, 2017
Fix canonicalization of layer IDs when computing layer differences,
which we also broke in #6.

Signed-off-by: Nalin Dahyabhai <[email protected]>
@nalind nalind deleted the truncindex branch July 11, 2017 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants