Skip to content

List images with multiple since/before filters#44503

Merged
neersighted merged 1 commit intomoby:masterfrom
corhere:image-ls-before-after-filters
Dec 13, 2022
Merged

List images with multiple since/before filters#44503
neersighted merged 1 commit intomoby:masterfrom
corhere:image-ls-before-after-filters

Conversation

@corhere
Copy link
Contributor

@corhere corhere commented Nov 21, 2022

- What I did
The List Images API endpoint has accepted multiple values for the since and before filter predicates, but thanks to Go's randomizing of map iteration order, it would pick an arbitrary image to compare created timestamps against. In other words, the behaviour was undefined. Change these filter predicates to have well-defined semantics: the logical AND of all values for each of the respective predicates. As timestamps are a totally-ordered relation, this is exactly equivalent to applying the newest and oldest creation timestamps for the since and before predicates, respectively.

- How I did it

- How to verify it
A new integration test

- Description for the changelog

  • The List Images API now handles requests specifying multiple since or before filter predicates by listing images which were created after the newest of the since images and before the oldest of the before images. Previously the API would randomly pick one of each of the before and since filter predicates to apply, and ignore the rest.

- A picture of a cute animal (not mandatory but encouraged)

The List Images API endpoint has accepted multiple values for the
`since` and `before` filter predicates, but thanks to Go's randomizing
of map iteration order, it would pick an arbitrary image to compare
created timestamps against. In other words, the behaviour was undefined.
Change these filter predicates to have well-defined semantics: the
logical AND of all values for each of the respective predicates. As
timestamps are a totally-ordered relation, this is exactly equivalent to
applying the newest and oldest creation timestamps for the `since` and
`before` predicates, respectively.

Signed-off-by: Cory Snider <csnider@mirantis.com>
@corhere corhere force-pushed the image-ls-before-after-filters branch from ad2be86 to 0426c76 Compare December 8, 2022 21:37
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah added this to the v-next milestone Dec 8, 2022
@thaJeztah
Copy link
Member

@tianon ptal

Copy link
Member

@neersighted neersighted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM/good to merge IMO given we discussed these semantics in detail last week.

@neersighted neersighted merged commit 186d3ba into moby:master Dec 13, 2022
@corhere corhere deleted the image-ls-before-after-filters branch December 13, 2022 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API area/images Image Distribution impact/changelog kind/bugfix PR's that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants