-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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 code for creating Cacher. #16584
Refactor code for creating Cacher. #16584
Conversation
Labelling this PR as size/M |
GCE e2e test build/test passed for commit 24101ce27033d7a007ea09cbf87eac87c904296e. |
@k8s-bot unit test this please |
1 similar comment
@k8s-bot unit test this please |
@lavalamp - PTAL |
NewListFunc: func() runtime.Object { return &api.PodList{} }, | ||
} | ||
storageInterface = storage.NewCacher(config) | ||
storageInterface = storage.NewCacher(1000, s, nil, &api.Pod{}, prefix, true, newListFunc) |
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 was actually hoping to construct the cacher outside and pass it in-- if that's too hard, then I'll take this, though.
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.
It's different for every resource, so yeah - that would be difficult.
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.
(Discussed in person: I suggested passing a construction function in instead of the boolean)
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.
Done.
24101ce
to
ed0abe5
Compare
@lavalamp - PTAL [Any better suggestions for names are appreciated] |
Labelling this PR as size/L |
@@ -111,10 +111,56 @@ type Cacher struct { | |||
ListFromCache bool | |||
} | |||
|
|||
type DecorateStorage func( | |||
Interface, int, Versioner, runtime.Object, string, bool, | |||
func() runtime.Object) Interface |
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 name the parameters? + add godoc.
I might call this a storage factory...
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.
Done.
ed0abe5
to
8f385c5
Compare
@lavalamp - PTAL |
GCE e2e test build/test passed for commit ed0abe5bdf87cdccafcea8d19416ee06c9b824a2. |
GCE e2e test build/test passed for commit 8f385c5. |
LGTM, thanks for bearing with me :) |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 8f385c5. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
Requested in #16496