-
Notifications
You must be signed in to change notification settings - Fork 10.1k
PSS: Use interfaces to configure state stores #37899
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
Conversation
…tead of an instance of the `backend.Backend` interface.
…e, instead of directly using methods related to RPCs. This requires changing where we call `SetStateStoreChunkSize`.
To summarize, we don't really need the `SetStateStoreChunkSize` method, and instead methods like `(*GRPCProvider).ConfigureStateStore` in the `plugin6` package can directly inspect the negotiation process that passes through that code and pull out the chunk size. However that means that that code would also need to implement validation. And that's just `(*GRPCProvider).ConfigureStateStore`; what about all the test mocks that are used in different types of test? They would all need to be implemented similarly to GRPCProvider to be good, useful mocks, and then a lot of things that fulfil the provider.Interface interface are coupled to each other. Instead, it's easier to have validation in the `grpcClient` struct's methods in the `remote` package, as that code is common to all scenarios. That code needs a method to 'reach into' the provider.Interface value, so we use the `SetStateStoreChunkSize` method.
97dd6bf to
a38298d
Compare
I'm surprised that removing this doesn't break E2E tests of PSS that use grpcwrap, but I think there's `plugin6` code that runs in that situation, so maybe chunking is handled elsewhere.
| if cs, ok := p.provider.(providers.StateStoreChunkSizeSetter); ok { | ||
| cs.SetStateStoreChunkSize(p.typeName, int(chunkSize)) | ||
| } else { | ||
| // TODO: Remove |
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 feels like leaving this in would be helpful, any objections?
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.
We could also avoid the _, ok notation above and let it panic that way. I think it's merely a question of how likely this is ever to happen and be exposed to the end user.
Personally, I like panic to be a direct side effect of a problem rather than intention where it is possible (i.e. I'd rather let the casting panic) and leaving it to Go to express itself but I do not hold that opinion too strongly. 🤷🏻
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.
That makes sense - I'll push a change for this
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.
No major reservations except for the missing validation method.
| if cs, ok := p.provider.(providers.StateStoreChunkSizeSetter); ok { | ||
| cs.SetStateStoreChunkSize(p.typeName, int(chunkSize)) | ||
| } else { | ||
| // TODO: Remove |
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.
We could also avoid the _, ok notation above and let it panic that way. I think it's merely a question of how likely this is ever to happen and be exposed to the end user.
Personally, I like panic to be a direct side effect of a problem rather than intention where it is possible (i.e. I'd rather let the casting panic) and leaving it to Go to express itself but I do not hold that opinion too strongly. 🤷🏻
…using grpcwrap package This was removed, incorrectly, in #37899
…using grpcwrap package This was removed, incorrectly, in #37899
…using grpcwrap package This was removed, incorrectly, in #37899
I realised that the code for calling RPC methods had leaked through the code further than intended, so this PR updates calling code in
Metamethods and ensures that configuring a state store is only done via thebackend.Backendinterface.Target Release
1.15.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry