-
Notifications
You must be signed in to change notification settings - Fork 0
/
sinkserver_dec.go
41 lines (36 loc) · 1.37 KB
/
sinkserver_dec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Code generated by svcdec; DO NOT EDIT.
package sinkpb
import (
"context"
proto "github.com/golang/protobuf/proto"
)
type DecoratedSink struct {
// Service is the service to decorate.
Service SinkServer
// Prelude is called for each method before forwarding the call to Service.
// If Prelude returns an error, then the call is skipped and the error is
// processed via the Postlude (if one is defined), or it is returned directly.
Prelude func(ctx context.Context, methodName string, req proto.Message) (context.Context, error)
// Postlude is called for each method after Service has processed the call, or
// after the Prelude has returned an error. This takes the the Service's
// response proto (which may be nil) and/or any error. The decorated
// service will return the response (possibly mutated) and error that Postlude
// returns.
Postlude func(ctx context.Context, methodName string, rsp proto.Message, err error) error
}
func (s *DecoratedSink) ReportTestResults(ctx context.Context, req *ReportTestResultsRequest) (rsp *ReportTestResultsResponse, err error) {
if s.Prelude != nil {
var newCtx context.Context
newCtx, err = s.Prelude(ctx, "ReportTestResults", req)
if err == nil {
ctx = newCtx
}
}
if err == nil {
rsp, err = s.Service.ReportTestResults(ctx, req)
}
if s.Postlude != nil {
err = s.Postlude(ctx, "ReportTestResults", rsp, err)
}
return
}