GRPC Unwrap: Make sa.SetOrderProcessing passthrough (#5604)
* Make sa.SetOrderProcessing GRPC wrapper passthrough. Also, change the
server method to accept an `*sapb.OrderRequest{}` (essentially just an
order ID) as the parameter instead of a whole order.
Part of: #5533
This commit is contained in:
parent
1bf857ac09
commit
e8e907b443
|
|
@ -129,7 +129,7 @@ type StorageAdder interface {
|
|||
AddSerial(ctx context.Context, req *sapb.AddSerialRequest) (*emptypb.Empty, error)
|
||||
DeactivateRegistration(ctx context.Context, req *sapb.RegistrationID) (*emptypb.Empty, error)
|
||||
NewOrder(ctx context.Context, order *corepb.Order) (*corepb.Order, error)
|
||||
SetOrderProcessing(ctx context.Context, order *corepb.Order) error
|
||||
SetOrderProcessing(ctx context.Context, req *sapb.OrderRequest) (*emptypb.Empty, error)
|
||||
FinalizeOrder(ctx context.Context, order *corepb.Order) error
|
||||
SetOrderError(ctx context.Context, order *corepb.Order) error
|
||||
RevokeCertificate(ctx context.Context, req *sapb.RevokeCertificateRequest) (*emptypb.Empty, error)
|
||||
|
|
|
|||
|
|
@ -108,11 +108,8 @@ func (sas StorageAuthorityClientWrapper) NewOrder(ctx context.Context, request *
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
func (sac StorageAuthorityClientWrapper) SetOrderProcessing(ctx context.Context, order *corepb.Order) error {
|
||||
if _, err := sac.inner.SetOrderProcessing(ctx, order); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
func (sac StorageAuthorityClientWrapper) SetOrderProcessing(ctx context.Context, req *sapb.OrderRequest) (*emptypb.Empty, error) {
|
||||
return sac.inner.SetOrderProcessing(ctx, req)
|
||||
}
|
||||
|
||||
func (sac StorageAuthorityClientWrapper) SetOrderError(ctx context.Context, order *corepb.Order) error {
|
||||
|
|
@ -279,16 +276,8 @@ func (sas StorageAuthorityServerWrapper) NewOrder(ctx context.Context, request *
|
|||
return sas.inner.NewOrder(ctx, request)
|
||||
}
|
||||
|
||||
func (sas StorageAuthorityServerWrapper) SetOrderProcessing(ctx context.Context, order *corepb.Order) (*emptypb.Empty, error) {
|
||||
if order == nil || !orderValid(order) {
|
||||
return nil, errIncompleteRequest
|
||||
}
|
||||
|
||||
if err := sas.inner.SetOrderProcessing(ctx, order); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &emptypb.Empty{}, nil
|
||||
func (sas StorageAuthorityServerWrapper) SetOrderProcessing(ctx context.Context, req *sapb.OrderRequest) (*emptypb.Empty, error) {
|
||||
return sas.inner.SetOrderProcessing(ctx, req)
|
||||
}
|
||||
|
||||
func (sas StorageAuthorityServerWrapper) SetOrderError(ctx context.Context, order *corepb.Order) (*emptypb.Empty, error) {
|
||||
|
|
|
|||
|
|
@ -407,8 +407,8 @@ func (sa *StorageAuthority) NewOrder(_ context.Context, order *corepb.Order) (*c
|
|||
}
|
||||
|
||||
// SetOrderProcessing is a mock
|
||||
func (sa *StorageAuthority) SetOrderProcessing(_ context.Context, order *corepb.Order) error {
|
||||
return nil
|
||||
func (sa *StorageAuthority) SetOrderProcessing(_ context.Context, req *sapb.OrderRequest) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// SetOrderError is a mock
|
||||
|
|
|
|||
3
ra/ra.go
3
ra/ra.go
|
|
@ -1032,7 +1032,8 @@ func (ra *RegistrationAuthorityImpl) FinalizeOrder(ctx context.Context, req *rap
|
|||
// Otherwise the order will be "stuck" in processing state. It can not be
|
||||
// finalized because it isn't pending, but we aren't going to process it
|
||||
// further because we already did and encountered an error.
|
||||
if err := ra.SA.SetOrderProcessing(ctx, order); err != nil {
|
||||
_, err = ra.SA.SetOrderProcessing(ctx, &sapb.OrderRequest{Id: order.Id})
|
||||
if err != nil {
|
||||
// Fail the order with a server internal error - we weren't able to set the
|
||||
// status to processing and that's unexpected & weird.
|
||||
ra.failOrder(ctx, order, probs.ServerInternal("Error setting order processing"))
|
||||
|
|
|
|||
|
|
@ -2284,7 +2284,7 @@ var file_sa_proto_rawDesc = []byte{
|
|||
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x42, 0x79, 0x22,
|
||||
0x2d, 0x0a, 0x11, 0x4b, 0x65, 0x79, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x48, 0x61, 0x73, 0x68, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x48, 0x61, 0x73, 0x68, 0x32, 0xd9,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x48, 0x61, 0x73, 0x68, 0x32, 0xde,
|
||||
0x13, 0x0a, 0x10, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x2e, 0x73, 0x61, 0x2e, 0x52, 0x65, 0x67, 0x69,
|
||||
|
|
@ -2400,52 +2400,53 @@ var file_sa_proto_rawDesc = []byte{
|
|||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00,
|
||||
0x12, 0x26, 0x0a, 0x08, 0x4e, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x63,
|
||||
0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, 0x0b, 0x2e, 0x63, 0x6f, 0x72, 0x65,
|
||||
0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4f,
|
||||
0x72, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x12, 0x0b,
|
||||
0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
|
||||
0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0b, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72,
|
||||
0x64, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a,
|
||||
0x0d, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x0b,
|
||||
0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
|
||||
0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x12, 0x10, 0x2e, 0x73, 0x61, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72,
|
||||
0x22, 0x00, 0x12, 0x3e, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x46, 0x6f,
|
||||
0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x73, 0x61, 0x2e, 0x47, 0x65, 0x74, 0x4f,
|
||||
0x72, 0x64, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72,
|
||||
0x22, 0x00, 0x12, 0x4b, 0x0a, 0x11, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x43, 0x65, 0x72, 0x74,
|
||||
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x73, 0x61, 0x2e, 0x52, 0x65, 0x76,
|
||||
0x6f, 0x6b, 0x65, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12,
|
||||
0x52, 0x0a, 0x12, 0x4e, 0x65, 0x77, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x32, 0x12, 0x23, 0x2e, 0x73, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65,
|
||||
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x61, 0x2e,
|
||||
0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x49, 0x44,
|
||||
0x73, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x16, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x41,
|
||||
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x12, 0x20, 0x2e,
|
||||
0x73, 0x61, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f,
|
||||
0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x18, 0x44, 0x65, 0x61,
|
||||
0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x32, 0x12, 0x14, 0x2e, 0x73, 0x61, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f,
|
||||
0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x32, 0x1a, 0x16, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
|
||||
0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x42, 0x6c, 0x6f, 0x63,
|
||||
0x6b, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x2e, 0x73, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x42,
|
||||
0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4f,
|
||||
0x72, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x12, 0x10,
|
||||
0x2e, 0x73, 0x61, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69,
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x65, 0x74, 0x73, 0x65, 0x6e, 0x63,
|
||||
0x72, 0x79, 0x70, 0x74, 0x2f, 0x62, 0x6f, 0x75, 0x6c, 0x64, 0x65, 0x72, 0x2f, 0x73, 0x61, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0d, 0x53, 0x65,
|
||||
0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0b, 0x2e, 0x63, 0x6f,
|
||||
0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||||
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
|
||||
0x22, 0x00, 0x12, 0x36, 0x0a, 0x0d, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x4f, 0x72,
|
||||
0x64, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72,
|
||||
0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x08, 0x47, 0x65,
|
||||
0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x10, 0x2e, 0x73, 0x61, 0x2e, 0x4f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e,
|
||||
0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x72,
|
||||
0x64, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x73, 0x61,
|
||||
0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e,
|
||||
0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x11, 0x52, 0x65, 0x76, 0x6f, 0x6b,
|
||||
0x65, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x2e, 0x73,
|
||||
0x61, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
|
||||
0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70,
|
||||
0x74, 0x79, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x12, 0x4e, 0x65, 0x77, 0x41, 0x75, 0x74, 0x68, 0x6f,
|
||||
0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0x12, 0x23, 0x2e, 0x73, 0x61, 0x2e,
|
||||
0x41, 0x64, 0x64, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x15, 0x2e, 0x73, 0x61, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x32, 0x49, 0x44, 0x73, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x16, 0x46, 0x69, 0x6e, 0x61,
|
||||
0x6c, 0x69, 0x7a, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x32, 0x12, 0x20, 0x2e, 0x73, 0x61, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65,
|
||||
0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x4a,
|
||||
0x0a, 0x18, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68,
|
||||
0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x12, 0x14, 0x2e, 0x73, 0x61, 0x2e,
|
||||
0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x32,
|
||||
0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0d, 0x41, 0x64,
|
||||
0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x2e, 0x73, 0x61,
|
||||
0x2e, 0x41, 0x64, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42,
|
||||
0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x65,
|
||||
0x74, 0x73, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x2f, 0x62, 0x6f, 0x75, 0x6c, 0x64, 0x65,
|
||||
0x72, 0x2f, 0x73, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -2548,7 +2549,7 @@ var file_sa_proto_depIdxs = []int32{
|
|||
18, // 36: sa.StorageAuthority.AddSerial:input_type -> sa.AddSerialRequest
|
||||
0, // 37: sa.StorageAuthority.DeactivateRegistration:input_type -> sa.RegistrationID
|
||||
41, // 38: sa.StorageAuthority.NewOrder:input_type -> core.Order
|
||||
41, // 39: sa.StorageAuthority.SetOrderProcessing:input_type -> core.Order
|
||||
21, // 39: sa.StorageAuthority.SetOrderProcessing:input_type -> sa.OrderRequest
|
||||
41, // 40: sa.StorageAuthority.SetOrderError:input_type -> core.Order
|
||||
41, // 41: sa.StorageAuthority.FinalizeOrder:input_type -> core.Order
|
||||
21, // 42: sa.StorageAuthority.GetOrder:input_type -> sa.OrderRequest
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ service StorageAuthority {
|
|||
rpc AddSerial(AddSerialRequest) returns (google.protobuf.Empty) {}
|
||||
rpc DeactivateRegistration(RegistrationID) returns (google.protobuf.Empty) {}
|
||||
rpc NewOrder(core.Order) returns (core.Order) {}
|
||||
rpc SetOrderProcessing(core.Order) returns (google.protobuf.Empty) {}
|
||||
rpc SetOrderProcessing(OrderRequest) returns (google.protobuf.Empty) {}
|
||||
rpc SetOrderError(core.Order) returns (google.protobuf.Empty) {}
|
||||
rpc FinalizeOrder(core.Order) returns (google.protobuf.Empty) {}
|
||||
rpc GetOrder(OrderRequest) returns (core.Order) {}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ type StorageAuthorityClient interface {
|
|||
AddSerial(ctx context.Context, in *AddSerialRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
DeactivateRegistration(ctx context.Context, in *RegistrationID, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
NewOrder(ctx context.Context, in *proto.Order, opts ...grpc.CallOption) (*proto.Order, error)
|
||||
SetOrderProcessing(ctx context.Context, in *proto.Order, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
SetOrderProcessing(ctx context.Context, in *OrderRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
SetOrderError(ctx context.Context, in *proto.Order, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
FinalizeOrder(ctx context.Context, in *proto.Order, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
GetOrder(ctx context.Context, in *OrderRequest, opts ...grpc.CallOption) (*proto.Order, error)
|
||||
|
|
@ -314,7 +314,7 @@ func (c *storageAuthorityClient) NewOrder(ctx context.Context, in *proto.Order,
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *storageAuthorityClient) SetOrderProcessing(ctx context.Context, in *proto.Order, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
func (c *storageAuthorityClient) SetOrderProcessing(ctx context.Context, in *OrderRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, "/sa.StorageAuthority/SetOrderProcessing", in, out, opts...)
|
||||
if err != nil {
|
||||
|
|
@ -439,7 +439,7 @@ type StorageAuthorityServer interface {
|
|||
AddSerial(context.Context, *AddSerialRequest) (*emptypb.Empty, error)
|
||||
DeactivateRegistration(context.Context, *RegistrationID) (*emptypb.Empty, error)
|
||||
NewOrder(context.Context, *proto.Order) (*proto.Order, error)
|
||||
SetOrderProcessing(context.Context, *proto.Order) (*emptypb.Empty, error)
|
||||
SetOrderProcessing(context.Context, *OrderRequest) (*emptypb.Empty, error)
|
||||
SetOrderError(context.Context, *proto.Order) (*emptypb.Empty, error)
|
||||
FinalizeOrder(context.Context, *proto.Order) (*emptypb.Empty, error)
|
||||
GetOrder(context.Context, *OrderRequest) (*proto.Order, error)
|
||||
|
|
@ -537,7 +537,7 @@ func (UnimplementedStorageAuthorityServer) DeactivateRegistration(context.Contex
|
|||
func (UnimplementedStorageAuthorityServer) NewOrder(context.Context, *proto.Order) (*proto.Order, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NewOrder not implemented")
|
||||
}
|
||||
func (UnimplementedStorageAuthorityServer) SetOrderProcessing(context.Context, *proto.Order) (*emptypb.Empty, error) {
|
||||
func (UnimplementedStorageAuthorityServer) SetOrderProcessing(context.Context, *OrderRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetOrderProcessing not implemented")
|
||||
}
|
||||
func (UnimplementedStorageAuthorityServer) SetOrderError(context.Context, *proto.Order) (*emptypb.Empty, error) {
|
||||
|
|
@ -1067,7 +1067,7 @@ func _StorageAuthority_NewOrder_Handler(srv interface{}, ctx context.Context, de
|
|||
}
|
||||
|
||||
func _StorageAuthority_SetOrderProcessing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(proto.Order)
|
||||
in := new(OrderRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -1079,7 +1079,7 @@ func _StorageAuthority_SetOrderProcessing_Handler(srv interface{}, ctx context.C
|
|||
FullMethod: "/sa.StorageAuthority/SetOrderProcessing",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StorageAuthorityServer).SetOrderProcessing(ctx, req.(*proto.Order))
|
||||
return srv.(StorageAuthorityServer).SetOrderProcessing(ctx, req.(*OrderRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
|
|
|||
16
sa/sa.go
16
sa/sa.go
|
|
@ -991,10 +991,13 @@ func (ssa *SQLStorageAuthority) NewOrder(ctx context.Context, req *corepb.Order)
|
|||
return res, nil
|
||||
}
|
||||
|
||||
// SetOrderProcessing updates a provided *corepb.Order in pending status to be
|
||||
// in processing status by updating the `beganProcessing` field of the
|
||||
// corresponding Order table row in the DB.
|
||||
func (ssa *SQLStorageAuthority) SetOrderProcessing(ctx context.Context, req *corepb.Order) error {
|
||||
// SetOrderProcessing updates an order from pending status to processing
|
||||
// status by updating the `beganProcessing` field of the corresponding
|
||||
// Order table row in the DB.
|
||||
func (ssa *SQLStorageAuthority) SetOrderProcessing(ctx context.Context, req *sapb.OrderRequest) (*emptypb.Empty, error) {
|
||||
if req.Id == 0 {
|
||||
return nil, errIncompleteRequest
|
||||
}
|
||||
_, overallError := db.WithTransaction(ctx, ssa.dbMap, func(txWithCtx db.Executor) (interface{}, error) {
|
||||
result, err := txWithCtx.Exec(`
|
||||
UPDATE orders
|
||||
|
|
@ -1015,7 +1018,10 @@ func (ssa *SQLStorageAuthority) SetOrderProcessing(ctx context.Context, req *cor
|
|||
|
||||
return nil, nil
|
||||
})
|
||||
return overallError
|
||||
if overallError != nil {
|
||||
return nil, overallError
|
||||
}
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// SetOrderError updates a provided Order's error field.
|
||||
|
|
|
|||
|
|
@ -1076,7 +1076,7 @@ func TestSetOrderProcessing(t *testing.T) {
|
|||
test.AssertNotError(t, err, "NewOrder failed")
|
||||
|
||||
// Set the order to be processing
|
||||
err = sa.SetOrderProcessing(context.Background(), order)
|
||||
_, err = sa.SetOrderProcessing(context.Background(), &sapb.OrderRequest{Id: order.Id})
|
||||
test.AssertNotError(t, err, "SetOrderProcessing failed")
|
||||
|
||||
// Read the order by ID from the DB to check the status was correctly updated
|
||||
|
|
@ -1089,7 +1089,7 @@ func TestSetOrderProcessing(t *testing.T) {
|
|||
test.AssertEquals(t, updatedOrder.BeganProcessing, true)
|
||||
|
||||
// Try to set the same order to be processing again. We should get an error.
|
||||
err = sa.SetOrderProcessing(context.Background(), order)
|
||||
_, err = sa.SetOrderProcessing(context.Background(), &sapb.OrderRequest{Id: order.Id})
|
||||
test.AssertError(t, err, "Set the same order processing twice. This should have been an error.")
|
||||
test.AssertErrorIs(t, err, berrors.OrderNotReady)
|
||||
}
|
||||
|
|
@ -1124,7 +1124,7 @@ func TestFinalizeOrder(t *testing.T) {
|
|||
test.AssertNotError(t, err, "NewOrder failed")
|
||||
|
||||
// Set the order to processing so it can be finalized
|
||||
err = sa.SetOrderProcessing(ctx, order)
|
||||
_, err = sa.SetOrderProcessing(ctx, &sapb.OrderRequest{Id: order.Id})
|
||||
test.AssertNotError(t, err, "SetOrderProcessing failed")
|
||||
|
||||
// Finalize the order with a certificate serial
|
||||
|
|
@ -1491,7 +1491,7 @@ func TestGetOrderForNames(t *testing.T) {
|
|||
test.AssertEquals(t, result.Id, order.Id)
|
||||
|
||||
// Set the order processing so it can be finalized
|
||||
err = sa.SetOrderProcessing(ctx, order)
|
||||
_, err = sa.SetOrderProcessing(ctx, &sapb.OrderRequest{Id: order.Id})
|
||||
test.AssertNotError(t, err, "sa.SetOrderProcessing failed")
|
||||
|
||||
// Finalize the order
|
||||
|
|
@ -1624,7 +1624,7 @@ func TestStatusForOrder(t *testing.T) {
|
|||
test.AssertNotError(t, err, "NewOrder errored unexpectedly")
|
||||
// If requested, set the order to processing
|
||||
if tc.SetProcessing {
|
||||
err := sa.SetOrderProcessing(ctx, newOrder)
|
||||
_, err := sa.SetOrderProcessing(ctx, &sapb.OrderRequest{Id: newOrder.Id})
|
||||
test.AssertNotError(t, err, "Error setting order to processing status")
|
||||
}
|
||||
// If requested, finalize the order
|
||||
|
|
|
|||
Loading…
Reference in New Issue