Skip to content

Commit 97dd6bf

Browse files
committed
docs: Add godocs comment to StateStoreChunkSizeSetter interface
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.
1 parent ff8ca77 commit 97dd6bf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/providers/provider.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ type Interface interface {
151151
Close() error
152152
}
153153

154+
// StateStoreChunkSizeSetter interface indicates that a struct wants to record
155+
// the negotiated chunk size (from the ConfigureStateStore RPC) internally for
156+
// future use. The future use is likely to be ReadStateBytes/WriteStateBytes RPCs.
157+
//
158+
// We let calling code set the chunk size on that struct from outside, to ensure that
159+
// the value is persisted. The alternative is relying on anything that might fulfil the
160+
// providers.Interface interface (mock providers used in integration tests, grpcwrap
161+
// logic used in E2E tests, GRPCProvider logic) to know it needs to implement
162+
// stateful-ness when processing chunk size negotiation in the ConfigureStateStore RPC.
154163
type StateStoreChunkSizeSetter interface {
155164
SetStateStoreChunkSize(typeName string, size int)
156165
}

0 commit comments

Comments
 (0)