blob: 8d9a64378499b2dc7f4adda402a9f25d15f560f0 [file] [log] [blame]
// Code generated by svcdec; DO NOT EDIT.
package logdog
import (
"context"
proto "github.com/golang/protobuf/proto"
)
type DecoratedLogs struct {
// Service is the service to decorate.
Service LogsServer
// 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 *DecoratedLogs) Get(ctx context.Context, req *GetRequest) (rsp *GetResponse, err error) {
if s.Prelude != nil {
var newCtx context.Context
newCtx, err = s.Prelude(ctx, "Get", req)
if err == nil {
ctx = newCtx
}
}
if err == nil {
rsp, err = s.Service.Get(ctx, req)
}
if s.Postlude != nil {
err = s.Postlude(ctx, "Get", rsp, err)
}
return
}
func (s *DecoratedLogs) Tail(ctx context.Context, req *TailRequest) (rsp *GetResponse, err error) {
if s.Prelude != nil {
var newCtx context.Context
newCtx, err = s.Prelude(ctx, "Tail", req)
if err == nil {
ctx = newCtx
}
}
if err == nil {
rsp, err = s.Service.Tail(ctx, req)
}
if s.Postlude != nil {
err = s.Postlude(ctx, "Tail", rsp, err)
}
return
}
func (s *DecoratedLogs) Query(ctx context.Context, req *QueryRequest) (rsp *QueryResponse, err error) {
if s.Prelude != nil {
var newCtx context.Context
newCtx, err = s.Prelude(ctx, "Query", req)
if err == nil {
ctx = newCtx
}
}
if err == nil {
rsp, err = s.Service.Query(ctx, req)
}
if s.Postlude != nil {
err = s.Postlude(ctx, "Query", rsp, err)
}
return
}