-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
dns_cloning_grpc.pb.go
58 lines (46 loc) · 1.94 KB
/
dns_cloning_grpc.pb.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Code generated by protoc-gen-grpc-inmem. DO NOT EDIT.
package pbdns
import (
"context"
grpc "google.golang.org/grpc"
"google.golang.org/protobuf/proto"
)
// compile-time check to ensure that the generator is implementing all
// of the grpc client interfaces methods.
var _ DNSServiceClient = CloningDNSServiceClient{}
// IsCloningDNSServiceClient is an interface that can be used to detect
// that a DNSServiceClient is using the in-memory transport and has already
// been wrapped with a with a CloningDNSServiceClient.
type IsCloningDNSServiceClient interface {
IsCloningDNSServiceClient() bool
}
// CloningDNSServiceClient implements the DNSServiceClient interface by wrapping
// another implementation and copying all protobuf messages that pass through the client.
// This is mainly useful to wrap the an in-process client to insulate users of that
// client from having to care about potential immutability of data they receive or having
// the server implementation mutate their internal memory.
type CloningDNSServiceClient struct {
DNSServiceClient
}
func NewCloningDNSServiceClient(client DNSServiceClient) DNSServiceClient {
if cloner, ok := client.(IsCloningDNSServiceClient); ok && cloner.IsCloningDNSServiceClient() {
// prevent a double clone if the underlying client is already the cloning client.
return client
}
return CloningDNSServiceClient{
DNSServiceClient: client,
}
}
// IsCloningDNSServiceClient implements the IsCloningDNSServiceClient interface. This
// is only used to detect wrapped clients that would be double cloning data and prevent that.
func (c CloningDNSServiceClient) IsCloningDNSServiceClient() bool {
return true
}
func (c CloningDNSServiceClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
in = proto.Clone(in).(*QueryRequest)
out, err := c.DNSServiceClient.Query(ctx, in)
if err != nil {
return nil, err
}
return proto.Clone(out).(*QueryResponse), nil
}