Skip to content
This repository was archived by the owner on Nov 19, 2026. It is now read-only.

Make {container, layer, image} store APIs private - #1345

Merged
rhatdan merged 5 commits into
containers:mainfrom
mtrmac:private-apis
Oct 13, 2022
Merged

rhatdan merged 5 commits into
containers:mainfrom
mtrmac:private-apis

Conversation

@mtrmac

@mtrmac mtrmac commented Sep 14, 2022 •

Copy link
Copy Markdown
Collaborator

c/storage currently exports ContainerStore,ImageStore,LayerStore, and several component interfaces, publicly.

Meanwhile there are no public ways to obtain implementations of these interfaces (and no non-public callers in Podman or CRI-O that I can find); and the public interfaces at least look like an impediment to changing the C/I/L store interfaces (e.g. to change locking).

To clarify that, make the used C/I/L store implementations private (and keep the public interfaces in deprecated.go purely for formal API compatibility).

Then, as a proof of concept, remove unused RecursiveLock (compare #1344), LoadLocked, and Lookup methods.

@nalind RFC. I might well be missing something about external users of these interfaces.
Cc: @vrothberg for the RecursiveLock method removal, along with #1344.

See individual commit messages for details.

@mtrmac

mtrmac commented Sep 14, 2022 •

Copy link
Copy Markdown
Collaborator Author

(This could go further, making all the methods in the interfaces also package-private, but that would, right now, be a lot of noise that detracts from the core of this PR. That can happen over time, as methods are added/modified.)

@mtrmac
mtrmac force-pushed the private-apis branch 2 times, most recently from 1083e15 to a8fdb56 Compare September 14, 2022 22:04
@mtrmac

mtrmac commented Sep 15, 2022

Copy link
Copy Markdown
Collaborator Author

This could go further, making all the methods in the interfaces also package-private,

Actually #1346 would end up doing that, if we accept the idea of lock ownership tokens.

@rhatdan

rhatdan commented Oct 1, 2022

Copy link
Copy Markdown
Member

LGTM

@rhatdan

rhatdan commented Oct 1, 2022

Copy link
Copy Markdown
Member

@rhatdan

rhatdan commented Oct 7, 2022

Copy link
Copy Markdown
Member

@mtrmac needs a rebase. Then I think we should get this in.

@rhatdan

rhatdan commented Oct 9, 2022

Copy link
Copy Markdown
Member

@flouthoc flouthoc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

... to reduce duplication of read implementations of Store.

This can almost certainly be simplified further; this is enough
for the purposes of this PR, where we want to decrease the
number of callers that need to be updated.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
…e private

It is not directly reachable by any public API, and there are no known
external users.

So, make it obviously private to make it easier to change the returned
interface in the future.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
…vate

There is no public way to obtain implementations of these interfaces; so
replace the public interfaces with private ones, to make it clear that we
_can_ modify them.

For formal API compatibility, preserve the old interface definitions
as copies.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
@rhatdan
rhatdan merged commit 12491a6 into containers:main Oct 13, 2022
@mtrmac
mtrmac deleted the private-apis branch October 13, 2022 19:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants