-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor(cache): make RefOption types public #4184
base: master
Are you sure you want to change the base?
Conversation
Previously, RefOption usage was a mix of public and private types behind an empty interface. It was not possible to implement the `Accessor` interface as many RefOptions types were private. Now, using a private interface the list of options types is fixed. The options are now public so `Accessors` can be implemented. Signed-off-by: Chris Goller <[email protected]>
|
||
func CachePolicyDefault(m *cacheMetadata) error { | ||
return m.SetCachePolicyDefault() | ||
func CachePolicyDefault() RefOption { |
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.
I noticed CachePolicyDefault
was unused. I could totally remove it if you would like
@@ -1449,7 +1449,20 @@ func IsNotFound(err error) bool { | |||
return errors.Is(err, errNotFound) | |||
} | |||
|
|||
type RefOption interface{} | |||
type RefOption interface { | |||
opt() |
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.
As mentioned above, I can for sure remove this opt()
function.
Why do you need to do that? At first thought, that doesn't seem like a good point for custom implementations as |
Howdy howdy! I'm looking to use the rest of BuildKit with a custom cache implementation that doesn't use bolt or local storage. |
For that one, I think you should look more into |
Hi there thanks for the pointers. I looked at implementing those interfaces but there are other important code paths that use the cache.Manager that are not wrapped by the interfaces you mentioned. One example that uses cache.Manager is the This patch would allow one to create a different cache.Manager without need of private types. Also, it checks the RefOption type at compile time rather than runtime now. |
Howdy! I'm trying to extend buildkit by adding a specialized
cache.Manager
.I'm unable to implement
cache.Accessor
as theRefOption
types are a mixof public and private types behind an empty interface.
This updates the options to now be public so
Accessors
can be implemented.I've also updated the
RefOption
type itself to have a private function. This helps to keep the list of options types fixed. I can totally remove this if you would like.