Skip to content

Commit

Permalink
SA: Remove CountCertificatesByExactNames RPC (letsencrypt#4318)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandshoemaker authored and Daniel McCarney committed Jul 2, 2019
1 parent 796a7aa commit cba4ada
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 199 deletions.
1 change: 0 additions & 1 deletion core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ type StorageGetter interface {
GetCertificate(ctx context.Context, serial string) (Certificate, error)
GetCertificateStatus(ctx context.Context, serial string) (CertificateStatus, error)
CountCertificatesByNames(ctx context.Context, domains []string, earliest, latest time.Time) (countByDomain []*sapb.CountByNames_MapElement, err error)
CountCertificatesByExactNames(ctx context.Context, domains []string, earliest, latest time.Time) (countByDomain []*sapb.CountByNames_MapElement, err error)
CountRegistrationsByIP(ctx context.Context, ip net.IP, earliest, latest time.Time) (int, error)
CountRegistrationsByIPRange(ctx context.Context, ip net.IP, earliest, latest time.Time) (int, error)
CountPendingAuthorizations(ctx context.Context, regID int64) (int, error)
Expand Down
35 changes: 0 additions & 35 deletions grpc/sa-wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,28 +156,6 @@ func (sac StorageAuthorityClientWrapper) CountCertificatesByNames(ctx context.Co
return response.CountByNames, nil
}

func (sac StorageAuthorityClientWrapper) CountCertificatesByExactNames(ctx context.Context, domains []string, earliest, latest time.Time) ([]*sapb.CountByNames_MapElement, error) {
earliestNano := earliest.UnixNano()
latestNano := latest.UnixNano()

response, err := sac.inner.CountCertificatesByExactNames(ctx, &sapb.CountCertificatesByNamesRequest{
Names: domains,
Range: &sapb.Range{
Earliest: &earliestNano,
Latest: &latestNano,
},
})
if err != nil {
return nil, err
}

if response == nil || response.CountByNames == nil {
return nil, errIncompleteResponse
}

return response.CountByNames, nil
}

func (sac StorageAuthorityClientWrapper) CountRegistrationsByIP(ctx context.Context, ip net.IP, earliest, latest time.Time) (int, error) {
earliestNano := earliest.UnixNano()
latestNano := latest.UnixNano()
Expand Down Expand Up @@ -768,19 +746,6 @@ func (sas StorageAuthorityServerWrapper) CountCertificatesByNames(ctx context.Co
return &sapb.CountByNames{CountByNames: byNames}, nil
}

func (sas StorageAuthorityServerWrapper) CountCertificatesByExactNames(ctx context.Context, request *sapb.CountCertificatesByNamesRequest) (*sapb.CountByNames, error) {
if request == nil || request.Range == nil || request.Range.Earliest == nil || request.Range.Latest == nil || request.Names == nil {
return nil, errIncompleteRequest
}

byNames, err := sas.inner.CountCertificatesByExactNames(ctx, request.Names, time.Unix(0, *request.Range.Earliest), time.Unix(0, *request.Range.Latest))
if err != nil {
return nil, err
}

return &sapb.CountByNames{CountByNames: byNames}, nil
}

func (sas StorageAuthorityServerWrapper) CountRegistrationsByIP(ctx context.Context, request *sapb.CountRegistrationsByIPRequest) (*sapb.Count, error) {
if request == nil || request.Ip == nil || request.Range == nil || request.Range.Earliest == nil || request.Range.Latest == nil {
return nil, errIncompleteRequest
Expand Down
5 changes: 0 additions & 5 deletions mocks/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,6 @@ func (sa *StorageAuthority) CountCertificatesByNames(_ context.Context, _ []stri
return
}

// CountCertificatesByExactNames is a mock
func (sa *StorageAuthority) CountCertificatesByExactNames(_ context.Context, _ []string, _, _ time.Time) (ret []*sapb.CountByNames_MapElement, err error) {
return
}

// CountRegistrationsByIP is a mock
func (sa *StorageAuthority) CountRegistrationsByIP(_ context.Context, _ net.IP, _, _ time.Time) (int, error) {
return 0, nil
Expand Down
4 changes: 0 additions & 4 deletions ra/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ func (sa *mockInvalidAuthorizationsAuthority) CountCertificatesByNames(ctx conte
return nil, nil
}

func (sa *mockInvalidAuthorizationsAuthority) CountCertificatesByExactNames(ctx context.Context, in *sapb.CountCertificatesByNamesRequest, opts ...grpc.CallOption) (*sapb.CountByNames, error) {
return nil, nil
}

func (sa *mockInvalidAuthorizationsAuthority) CountRegistrationsByIP(ctx context.Context, in *sapb.CountRegistrationsByIPRequest, opts ...grpc.CallOption) (*sapb.Count, error) {
return nil, nil
}
Expand Down
Loading

0 comments on commit cba4ada

Please sign in to comment.