-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
sa: add GetRevokedCertsByShard #7946
base: main
Are you sure you want to change the base?
Conversation
Which queries for revoked certificates by explicit shard only. Also, remove explicit shard support from GetRevokedCerts.
a087fb6
to
909464d
Compare
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.
LGTM except for a mocks improvement.
@@ -271,6 +271,16 @@ func (sa *StorageAuthority) GetRevokedCerts(ctx context.Context, _ *sapb.GetRevo | |||
return &ServerStreamClient[corepb.CRLEntry]{}, nil | |||
} | |||
|
|||
// GetRevokedCertsByShard is a mock | |||
func (sa *StorageAuthorityReadOnly) GetRevokedCertsByShard(ctx context.Context, _ *sapb.GetRevokedCertsByShardRequest, _ ...grpc.CallOption) (sapb.StorageAuthorityReadOnly_GetRevokedCertsClient, error) { |
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.
Thanks to my upstream grpc stream generics work, you shouldn't need to create two different versions of this method that differ only in their receiver and return type! Instead a single mock with this signature from the autogenerated code should work:
func (sa *StorageAuthorityReadOnly) GetRevokedCertsByShard(ctx context.Context, _ *sapb.GetRevokedCertsByShardRequest, _ ...grpc.CallOption) (sapb.StorageAuthorityReadOnly_GetRevokedCertsClient, error) { | |
func (sa *StorageAuthorityReadOnly) GetRevokedCertsByShard(ctx context.Context, _ *sapb.GetRevokedCertsByShardRequest, _ ...grpc.CallOption) (grpc.ServerStreamingClient[corepb.CRLEntry], error) { |
And once you're using that generic return type, both methods can be collapsed into a single method with a StorageAuthorityReadOnly
receiver because the mock StorageAuthority
embeds the former.
The SA had some logic (not yet in use) to return revoked certificates either by temporal sharding (if
req.ShardIdx
is zero) or by explicit sharding (ifreq.ShardIdx
is nonzero).This PR splits the function into two. The existing
GetRevokedCerts
always does temporal sharding. The newGetRevokedCertsByShard
always does explicit sharding. Eventually onlyGetRevokedCertsByShard
will be necessary. This change was discussed in #7094 (comment) and is a precursor to having the crl-updater call both methods, so we can merge the results when generating CRLs.