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 ( 8 context "context" 9 flatbuffers "github.com/google/flatbuffers/go" 10 grpc "google.golang.org/grpc" 11 "google.golang.org/grpc/codes" 12 "google.golang.org/grpc/status" 13) 14 15// Client API for MonsterStorage service 16type MonsterStorageClient interface { 17 Store(ctx context.Context, in *flatbuffers.Builder, 18 opts ...grpc.CallOption) (*Stat, error) 19 Retrieve(ctx context.Context, in *flatbuffers.Builder, 20 opts ...grpc.CallOption) (MonsterStorage_RetrieveClient, error) 21 GetMaxHitPoint(ctx context.Context, 22 opts ...grpc.CallOption) (MonsterStorage_GetMaxHitPointClient, error) 23 GetMinMaxHitPoints(ctx context.Context, 24 opts ...grpc.CallOption) (MonsterStorage_GetMinMaxHitPointsClient, error) 25} 26 27type monsterStorageClient struct { 28 cc grpc.ClientConnInterface 29} 30 31func NewMonsterStorageClient(cc grpc.ClientConnInterface) MonsterStorageClient { 32 return &monsterStorageClient{cc} 33} 34 35func (c *monsterStorageClient) Store(ctx context.Context, in *flatbuffers.Builder, 36 opts ...grpc.CallOption) (*Stat, error) { 37 out := new(Stat) 38 err := c.cc.Invoke(ctx, "/MyGame.Example.MonsterStorage/Store", in, out, opts...) 39 if err != nil { 40 return nil, err 41 } 42 return out, nil 43} 44 45func (c *monsterStorageClient) Retrieve(ctx context.Context, in *flatbuffers.Builder, 46 opts ...grpc.CallOption) (MonsterStorage_RetrieveClient, error) { 47 stream, err := c.cc.NewStream(ctx, &_MonsterStorage_serviceDesc.Streams[0], "/MyGame.Example.MonsterStorage/Retrieve", opts...) 48 if err != nil { 49 return nil, err 50 } 51 x := &monsterStorageRetrieveClient{stream} 52 if err := x.ClientStream.SendMsg(in); err != nil { 53 return nil, err 54 } 55 if err := x.ClientStream.CloseSend(); err != nil { 56 return nil, err 57 } 58 return x, nil 59} 60 61type MonsterStorage_RetrieveClient interface { 62 Recv() (*Monster, error) 63 grpc.ClientStream 64} 65 66type monsterStorageRetrieveClient struct { 67 grpc.ClientStream 68} 69 70func (x *monsterStorageRetrieveClient) Recv() (*Monster, error) { 71 m := new(Monster) 72 if err := x.ClientStream.RecvMsg(m); err != nil { 73 return nil, err 74 } 75 return m, nil 76} 77 78func (c *monsterStorageClient) GetMaxHitPoint(ctx context.Context, 79 opts ...grpc.CallOption) (MonsterStorage_GetMaxHitPointClient, error) { 80 stream, err := c.cc.NewStream(ctx, &_MonsterStorage_serviceDesc.Streams[1], "/MyGame.Example.MonsterStorage/GetMaxHitPoint", opts...) 81 if err != nil { 82 return nil, err 83 } 84 x := &monsterStorageGetMaxHitPointClient{stream} 85 return x, nil 86} 87 88type MonsterStorage_GetMaxHitPointClient interface { 89 Send(*flatbuffers.Builder) error 90 CloseAndRecv() (*Stat, error) 91 grpc.ClientStream 92} 93 94type monsterStorageGetMaxHitPointClient struct { 95 grpc.ClientStream 96} 97 98func (x *monsterStorageGetMaxHitPointClient) Send(m *flatbuffers.Builder) error { 99 return x.ClientStream.SendMsg(m) 100} 101 102func (x *monsterStorageGetMaxHitPointClient) CloseAndRecv() (*Stat, error) { 103 if err := x.ClientStream.CloseSend(); err != nil { 104 return nil, err 105 } 106 m := new(Stat) 107 if err := x.ClientStream.RecvMsg(m); err != nil { 108 return nil, err 109 } 110 return m, nil 111} 112 113func (c *monsterStorageClient) GetMinMaxHitPoints(ctx context.Context, 114 opts ...grpc.CallOption) (MonsterStorage_GetMinMaxHitPointsClient, error) { 115 stream, err := c.cc.NewStream(ctx, &_MonsterStorage_serviceDesc.Streams[2], "/MyGame.Example.MonsterStorage/GetMinMaxHitPoints", opts...) 116 if err != nil { 117 return nil, err 118 } 119 x := &monsterStorageGetMinMaxHitPointsClient{stream} 120 return x, nil 121} 122 123type MonsterStorage_GetMinMaxHitPointsClient interface { 124 Send(*flatbuffers.Builder) error 125 Recv() (*Stat, error) 126 grpc.ClientStream 127} 128 129type monsterStorageGetMinMaxHitPointsClient struct { 130 grpc.ClientStream 131} 132 133func (x *monsterStorageGetMinMaxHitPointsClient) Send(m *flatbuffers.Builder) error { 134 return x.ClientStream.SendMsg(m) 135} 136 137func (x *monsterStorageGetMinMaxHitPointsClient) Recv() (*Stat, error) { 138 m := new(Stat) 139 if err := x.ClientStream.RecvMsg(m); err != nil { 140 return nil, err 141 } 142 return m, nil 143} 144 145// Server API for MonsterStorage service 146type MonsterStorageServer interface { 147 Store(context.Context, *Monster) (*flatbuffers.Builder, error) 148 Retrieve(*Stat, MonsterStorage_RetrieveServer) error 149 GetMaxHitPoint(MonsterStorage_GetMaxHitPointServer) error 150 GetMinMaxHitPoints(MonsterStorage_GetMinMaxHitPointsServer) error 151 mustEmbedUnimplementedMonsterStorageServer() 152} 153 154type UnimplementedMonsterStorageServer struct { 155} 156 157func (UnimplementedMonsterStorageServer) Store(context.Context, *Monster) (*flatbuffers.Builder, error) { 158 return nil, status.Errorf(codes.Unimplemented, "method Store not implemented") 159} 160 161func (UnimplementedMonsterStorageServer) Retrieve(*Stat, MonsterStorage_RetrieveServer) error { 162 return status.Errorf(codes.Unimplemented, "method Retrieve not implemented") 163} 164 165func (UnimplementedMonsterStorageServer) GetMaxHitPoint(MonsterStorage_GetMaxHitPointServer) error { 166 return status.Errorf(codes.Unimplemented, "method GetMaxHitPoint not implemented") 167} 168 169func (UnimplementedMonsterStorageServer) GetMinMaxHitPoints(MonsterStorage_GetMinMaxHitPointsServer) error { 170 return status.Errorf(codes.Unimplemented, "method GetMinMaxHitPoints not implemented") 171} 172 173func (UnimplementedMonsterStorageServer) mustEmbedUnimplementedMonsterStorageServer() {} 174 175type UnsafeMonsterStorageServer interface { 176 mustEmbedUnimplementedMonsterStorageServer() 177} 178 179func RegisterMonsterStorageServer(s grpc.ServiceRegistrar, srv MonsterStorageServer) { 180 s.RegisterService(&_MonsterStorage_serviceDesc, srv) 181} 182 183func _MonsterStorage_Store_Handler(srv interface{}, ctx context.Context, 184 dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 185 in := new(Monster) 186 if err := dec(in); err != nil { 187 return nil, err 188 } 189 if interceptor == nil { 190 return srv.(MonsterStorageServer).Store(ctx, in) 191 } 192 info := &grpc.UnaryServerInfo{ 193 Server: srv, 194 FullMethod: "/MyGame.Example.MonsterStorage/Store", 195 } 196 197 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 198 return srv.(MonsterStorageServer).Store(ctx, req.(*Monster)) 199 } 200 return interceptor(ctx, in, info, handler) 201} 202func _MonsterStorage_Retrieve_Handler(srv interface{}, stream grpc.ServerStream) error { 203 m := new(Stat) 204 if err := stream.RecvMsg(m); err != nil { 205 return err 206 } 207 return srv.(MonsterStorageServer).Retrieve(m, &monsterStorageRetrieveServer{stream}) 208} 209 210type MonsterStorage_RetrieveServer interface { 211 Send(*flatbuffers.Builder) error 212 grpc.ServerStream 213} 214 215type monsterStorageRetrieveServer struct { 216 grpc.ServerStream 217} 218 219func (x *monsterStorageRetrieveServer) Send(m *flatbuffers.Builder) error { 220 return x.ServerStream.SendMsg(m) 221} 222 223func _MonsterStorage_GetMaxHitPoint_Handler(srv interface{}, stream grpc.ServerStream) error { 224 return srv.(MonsterStorageServer).GetMaxHitPoint(&monsterStorageGetMaxHitPointServer{stream}) 225} 226 227type MonsterStorage_GetMaxHitPointServer interface { 228 Recv() (*Monster, error) 229 SendAndClose(*flatbuffers.Builder) error 230 grpc.ServerStream 231} 232 233type monsterStorageGetMaxHitPointServer struct { 234 grpc.ServerStream 235} 236 237func (x *monsterStorageGetMaxHitPointServer) Recv() (*Monster, error) { 238 m := new(Monster) 239 if err := x.ServerStream.RecvMsg(m); err != nil { 240 return nil, err 241 } 242 return m, nil 243} 244 245func (x *monsterStorageGetMaxHitPointServer) SendAndClose(m *flatbuffers.Builder) error { 246 return x.ServerStream.SendMsg(m) 247} 248 249func _MonsterStorage_GetMinMaxHitPoints_Handler(srv interface{}, stream grpc.ServerStream) error { 250 return srv.(MonsterStorageServer).GetMinMaxHitPoints(&monsterStorageGetMinMaxHitPointsServer{stream}) 251} 252 253type MonsterStorage_GetMinMaxHitPointsServer interface { 254 Send(*flatbuffers.Builder) error 255 Recv() (*Monster, error) 256 grpc.ServerStream 257} 258 259type monsterStorageGetMinMaxHitPointsServer struct { 260 grpc.ServerStream 261} 262 263func (x *monsterStorageGetMinMaxHitPointsServer) Send(m *flatbuffers.Builder) error { 264 return x.ServerStream.SendMsg(m) 265} 266 267func (x *monsterStorageGetMinMaxHitPointsServer) Recv() (*Monster, error) { 268 m := new(Monster) 269 if err := x.ServerStream.RecvMsg(m); err != nil { 270 return nil, err 271 } 272 return m, nil 273} 274 275var _MonsterStorage_serviceDesc = grpc.ServiceDesc{ 276 ServiceName: "MyGame.Example.MonsterStorage", 277 HandlerType: (*MonsterStorageServer)(nil), 278 Methods: []grpc.MethodDesc{ 279 { 280 MethodName: "Store", 281 Handler: _MonsterStorage_Store_Handler, 282 }, 283 }, 284 Streams: []grpc.StreamDesc{ 285 { 286 StreamName: "Retrieve", 287 Handler: _MonsterStorage_Retrieve_Handler, 288 ServerStreams: true, 289 }, 290 { 291 StreamName: "GetMaxHitPoint", 292 Handler: _MonsterStorage_GetMaxHitPoint_Handler, 293 ClientStreams: true, 294 }, 295 { 296 StreamName: "GetMinMaxHitPoints", 297 Handler: _MonsterStorage_GetMinMaxHitPoints_Handler, 298 ServerStreams: true, 299 ClientStreams: true, 300 }, 301 }, 302} 303