Skip to content

Commit

Permalink
Remove deprecated sa.GetOrderAuthorizations. (letsencrypt#3470)
Browse files Browse the repository at this point in the history
It has been replaced by `sa.GetValidOrderAuthorizations`, the same RPC
with a clearer name.

Resolves letsencrypt#3424
  • Loading branch information
cpu authored and Roland Bracewell Shoemaker committed Feb 21, 2018
1 parent 4f2e5f1 commit 04b2b17
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 238 deletions.
1 change: 0 additions & 1 deletion core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ type StorageGetter interface {
PreviousCertificateExists(ctx context.Context, req *sapb.PreviousCertificateExistsRequest) (exists *sapb.Exists, err error)
GetOrder(ctx context.Context, req *sapb.OrderRequest) (*corepb.Order, error)
GetOrderForNames(ctx context.Context, req *sapb.GetOrderForNamesRequest) (*corepb.Order, error)
GetOrderAuthorizations(ctx context.Context, req *sapb.GetOrderAuthorizationsRequest) (map[string]*Authorization, error)
GetValidOrderAuthorizations(ctx context.Context, req *sapb.GetValidOrderAuthorizationsRequest) (map[string]*Authorization, error)
CountInvalidAuthorizations(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (count *sapb.Count, err error)
GetAuthorizations(ctx context.Context, req *sapb.GetAuthorizationsRequest) (*sapb.Authorizations, error)
Expand Down
25 changes: 0 additions & 25 deletions grpc/sa-wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,18 +549,6 @@ func (sas StorageAuthorityClientWrapper) GetOrderForNames(
return resp, nil
}

func (sas StorageAuthorityClientWrapper) GetOrderAuthorizations(
ctx context.Context,
request *sapb.GetOrderAuthorizationsRequest) (map[string]*core.Authorization, error) {
// Call the wrapper function for the renamed version of this RPC
return sas.GetValidOrderAuthorizations(
ctx,
&sapb.GetValidOrderAuthorizationsRequest{
Id: request.Id,
AcctID: request.AcctID,
})
}

func (sas StorageAuthorityClientWrapper) GetValidOrderAuthorizations(
ctx context.Context,
request *sapb.GetValidOrderAuthorizationsRequest) (map[string]*core.Authorization, error) {
Expand Down Expand Up @@ -1142,19 +1130,6 @@ func (sas StorageAuthorityServerWrapper) GetOrderForNames(
return sas.inner.GetOrderForNames(ctx, request)
}

func (sas StorageAuthorityServerWrapper) GetOrderAuthorizations(
ctx context.Context,
request *sapb.GetOrderAuthorizationsRequest) (*sapb.Authorizations, error) {

// Call the wrapper for the renamed version of this RPC
return sas.GetValidOrderAuthorizations(
ctx,
&sapb.GetValidOrderAuthorizationsRequest{
Id: request.Id,
AcctID: request.AcctID,
})
}

func (sas StorageAuthorityServerWrapper) GetValidOrderAuthorizations(
ctx context.Context,
request *sapb.GetValidOrderAuthorizationsRequest) (*sapb.Authorizations, error) {
Expand Down
4 changes: 0 additions & 4 deletions mocks/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,6 @@ func (sa *StorageAuthority) GetOrderForNames(_ context.Context, _ *sapb.GetOrder
return nil, nil
}

func (sa *StorageAuthority) GetOrderAuthorizations(_ context.Context, _ *sapb.GetOrderAuthorizationsRequest) (map[string]*core.Authorization, error) {
return nil, nil
}

func (sa *StorageAuthority) GetValidOrderAuthorizations(_ context.Context, _ *sapb.GetValidOrderAuthorizationsRequest) (map[string]*core.Authorization, error) {
return nil, 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 @@ -170,10 +170,6 @@ func (sa *mockInvalidAuthorizationsAuthority) AddPendingAuthorizations(ctx conte
return nil, nil
}

func (sa *mockInvalidAuthorizationsAuthority) GetOrderAuthorizations(_ context.Context, _ *sapb.GetOrderAuthorizationsRequest, opts ...grpc.CallOption) (*sapb.Authorizations, error) {
return nil, nil
}

func (sa *mockInvalidAuthorizationsAuthority) GetValidOrderAuthorizations(_ context.Context, _ *sapb.GetValidOrderAuthorizationsRequest, opts ...grpc.CallOption) (*sapb.Authorizations, error) {
return nil, nil
}
Expand Down
295 changes: 117 additions & 178 deletions sa/proto/sa.pb.go

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions sa/proto/sa.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ service StorageAuthority {
rpc SetOrderError(core.Order) returns (core.Empty) {}
rpc FinalizeOrder(core.Order) returns (core.Empty) {}
rpc GetOrder(OrderRequest) returns (core.Order) {}
rpc GetOrderAuthorizations(GetOrderAuthorizationsRequest) returns (Authorizations) {}
rpc GetValidOrderAuthorizations(GetValidOrderAuthorizationsRequest) returns (Authorizations) {}
rpc GetOrderForNames(GetOrderForNamesRequest) returns (core.Order) {}
rpc GetAuthorizations(GetAuthorizationsRequest) returns (Authorizations) {}
Expand Down Expand Up @@ -200,11 +199,6 @@ message OrderRequest {
optional int64 id = 1;
}

message GetOrderAuthorizationsRequest {
optional int64 id = 1;
optional int64 acctID = 2;
}

message GetValidOrderAuthorizationsRequest {
optional int64 id = 1;
optional int64 acctID = 2;
Expand Down
22 changes: 2 additions & 20 deletions sa/sa.go
Original file line number Diff line number Diff line change
Expand Up @@ -1676,12 +1676,12 @@ func (ssa *SQLStorageAuthority) statusForOrder(ctx context.Context, order *corep
return "", err
}

// If GetOrderAuthorizations returned a different number of authorization
// If getAllOrderAuthorizations returned a different number of authorization
// objects than the order's slice of authorization IDs something has gone
// wrong worth raising an internal error about.
if len(authzs) != len(order.Authorizations) {
return "", berrors.InternalServerError(
"GetOrderAuthorizations returned the wrong number of authorizations "+
"getAllOrderAuthorizations returned the wrong number of authorizations "+
"(%d vs expected %d) for order %d",
len(authzs), len(order.Authorizations), *order.Id)
}
Expand Down Expand Up @@ -1806,24 +1806,6 @@ func (ssa *SQLStorageAuthority) getAllOrderAuthorizations(
return byName, nil
}

// GetOrderAuthorizations has been renamed to GetValidOrderAuthorizations. To
// satisfy deployability requirements we leave the old function in place,
// redirecting to the new. Once Boulder has been updated in staging and
// production we can remove this legacy implementation in favour of just
// GetValidOrderAuthorizations.
func (ssa *SQLStorageAuthority) GetOrderAuthorizations(
ctx context.Context,
req *sapb.GetOrderAuthorizationsRequest) (map[string]*core.Authorization, error) {

// Call the renamed version of this function
return ssa.GetValidOrderAuthorizations(
ctx,
&sapb.GetValidOrderAuthorizationsRequest{
Id: req.Id,
AcctID: req.AcctID,
})
}

// GetValidOrderAuthorizations is used to find the valid, unexpired authorizations
// associated with a specific order and account ID.
func (ssa *SQLStorageAuthority) GetValidOrderAuthorizations(
Expand Down

0 comments on commit 04b2b17

Please sign in to comment.