• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//Generated by gRPC Go plugin
2//If you make any local changes, they will be lost
3//source: monster_test
4
5package Example
6
7import "github.com/google/flatbuffers/go"
8
9import (
10  context "golang.org/x/net/context"
11  grpc "google.golang.org/grpc"
12)
13
14// Client API for MonsterStorage service
15type MonsterStorageClient interface{
16  Store(ctx context.Context, in *flatbuffers.Builder,
17  	opts... grpc.CallOption) (* Stat, error)
18  Retrieve(ctx context.Context, in *flatbuffers.Builder,
19  	opts... grpc.CallOption) (MonsterStorage_RetrieveClient, error)
20}
21
22type monsterStorageClient struct {
23  cc *grpc.ClientConn
24}
25
26func NewMonsterStorageClient(cc *grpc.ClientConn) MonsterStorageClient {
27  return &monsterStorageClient{cc}
28}
29
30func (c *monsterStorageClient) Store(ctx context.Context, in *flatbuffers.Builder,
31	opts... grpc.CallOption) (* Stat, error) {
32  out := new(Stat)
33  err := grpc.Invoke(ctx, "/Example.MonsterStorage/Store", in, out, c.cc, opts...)
34  if err != nil { return nil, err }
35  return out, nil
36}
37
38func (c *monsterStorageClient) Retrieve(ctx context.Context, in *flatbuffers.Builder,
39	opts... grpc.CallOption) (MonsterStorage_RetrieveClient, error) {
40  stream, err := grpc.NewClientStream(ctx, &_MonsterStorage_serviceDesc.Streams[0], c.cc, "/Example.MonsterStorage/Retrieve", opts...)
41  if err != nil { return nil, err }
42  x := &monsterStorageRetrieveClient{stream}
43  if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }
44  if err := x.ClientStream.CloseSend(); err != nil { return nil, err }
45  return x,nil
46}
47
48type MonsterStorage_RetrieveClient interface {
49  Recv() (*Monster, error)
50  grpc.ClientStream
51}
52
53type monsterStorageRetrieveClient struct{
54  grpc.ClientStream
55}
56
57func (x *monsterStorageRetrieveClient) Recv() (*Monster, error) {
58  m := new(Monster)
59  if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }
60  return m, nil
61}
62
63// Server API for MonsterStorage service
64type MonsterStorageServer interface {
65  Store(context.Context, *Monster) (*flatbuffers.Builder, error)
66  Retrieve(*Stat, MonsterStorage_RetrieveServer) error
67}
68
69func RegisterMonsterStorageServer(s *grpc.Server, srv MonsterStorageServer) {
70  s.RegisterService(&_MonsterStorage_serviceDesc, srv)
71}
72
73func _MonsterStorage_Store_Handler(srv interface{}, ctx context.Context,
74	dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
75  in := new(Monster)
76  if err := dec(in); err != nil { return nil, err }
77  if interceptor == nil { return srv.(MonsterStorageServer).Store(ctx, in) }
78  info := &grpc.UnaryServerInfo{
79    Server: srv,
80    FullMethod: "/Example.MonsterStorage/Store",
81  }
82
83  handler := func(ctx context.Context, req interface{}) (interface{}, error) {
84    return srv.(MonsterStorageServer).Store(ctx, req.(* Monster))
85  }
86  return interceptor(ctx, in, info, handler)
87}
88
89
90func _MonsterStorage_Retrieve_Handler(srv interface{}, stream grpc.ServerStream) error {
91  m := new(Stat)
92  if err := stream.RecvMsg(m); err != nil { return err }
93  return srv.(MonsterStorageServer).Retrieve(m, &monsterStorageRetrieveServer{stream})
94}
95
96type MonsterStorage_RetrieveServer interface {
97  Send(* flatbuffers.Builder) error
98  grpc.ServerStream
99}
100
101type monsterStorageRetrieveServer struct {
102  grpc.ServerStream
103}
104
105func (x *monsterStorageRetrieveServer) Send(m *flatbuffers.Builder) error {
106  return x.ServerStream.SendMsg(m)
107}
108
109
110var _MonsterStorage_serviceDesc = grpc.ServiceDesc{
111  ServiceName: "Example.MonsterStorage",
112  HandlerType: (*MonsterStorageServer)(nil),
113  Methods: []grpc.MethodDesc{
114    {
115      MethodName: "Store",
116      Handler: _MonsterStorage_Store_Handler,
117    },
118  },
119  Streams: []grpc.StreamDesc{
120    {
121      StreamName: "Retrieve",
122      Handler: _MonsterStorage_Retrieve_Handler,
123      ServerStreams: true,
124    },
125  },
126}
127
128