|
- // 使用的语法版本
-
- // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
- // versions:
- // - protoc-gen-go-grpc v1.3.0
- // - protoc v4.22.3
- // source: pkgs/grpc/agent/agent.proto
-
- package agent
-
- import (
- context "context"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
- )
-
- // This is a compile-time assertion to ensure that this generated file
- // is compatible with the grpc package it is being compiled against.
- // Requires gRPC-Go v1.32.0 or later.
- const _ = grpc.SupportPackageIsVersion7
-
- const (
- Agent_SendIPFSFile_FullMethodName = "/Agent/SendIPFSFile"
- Agent_GetIPFSFile_FullMethodName = "/Agent/GetIPFSFile"
- Agent_SendStream_FullMethodName = "/Agent/SendStream"
- Agent_FetchStream_FullMethodName = "/Agent/FetchStream"
- Agent_Ping_FullMethodName = "/Agent/Ping"
- )
-
- // AgentClient is the client API for Agent service.
- //
- // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
- type AgentClient interface {
- SendIPFSFile(ctx context.Context, opts ...grpc.CallOption) (Agent_SendIPFSFileClient, error)
- GetIPFSFile(ctx context.Context, in *GetIPFSFileReq, opts ...grpc.CallOption) (Agent_GetIPFSFileClient, error)
- SendStream(ctx context.Context, opts ...grpc.CallOption) (Agent_SendStreamClient, error)
- FetchStream(ctx context.Context, in *FetchStreamReq, opts ...grpc.CallOption) (Agent_FetchStreamClient, error)
- Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingResp, error)
- }
-
- type agentClient struct {
- cc grpc.ClientConnInterface
- }
-
- func NewAgentClient(cc grpc.ClientConnInterface) AgentClient {
- return &agentClient{cc}
- }
-
- func (c *agentClient) SendIPFSFile(ctx context.Context, opts ...grpc.CallOption) (Agent_SendIPFSFileClient, error) {
- stream, err := c.cc.NewStream(ctx, &Agent_ServiceDesc.Streams[0], Agent_SendIPFSFile_FullMethodName, opts...)
- if err != nil {
- return nil, err
- }
- x := &agentSendIPFSFileClient{stream}
- return x, nil
- }
-
- type Agent_SendIPFSFileClient interface {
- Send(*FileDataPacket) error
- CloseAndRecv() (*SendIPFSFileResp, error)
- grpc.ClientStream
- }
-
- type agentSendIPFSFileClient struct {
- grpc.ClientStream
- }
-
- func (x *agentSendIPFSFileClient) Send(m *FileDataPacket) error {
- return x.ClientStream.SendMsg(m)
- }
-
- func (x *agentSendIPFSFileClient) CloseAndRecv() (*SendIPFSFileResp, error) {
- if err := x.ClientStream.CloseSend(); err != nil {
- return nil, err
- }
- m := new(SendIPFSFileResp)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
- }
-
- func (c *agentClient) GetIPFSFile(ctx context.Context, in *GetIPFSFileReq, opts ...grpc.CallOption) (Agent_GetIPFSFileClient, error) {
- stream, err := c.cc.NewStream(ctx, &Agent_ServiceDesc.Streams[1], Agent_GetIPFSFile_FullMethodName, opts...)
- if err != nil {
- return nil, err
- }
- x := &agentGetIPFSFileClient{stream}
- if err := x.ClientStream.SendMsg(in); err != nil {
- return nil, err
- }
- if err := x.ClientStream.CloseSend(); err != nil {
- return nil, err
- }
- return x, nil
- }
-
- type Agent_GetIPFSFileClient interface {
- Recv() (*FileDataPacket, error)
- grpc.ClientStream
- }
-
- type agentGetIPFSFileClient struct {
- grpc.ClientStream
- }
-
- func (x *agentGetIPFSFileClient) Recv() (*FileDataPacket, error) {
- m := new(FileDataPacket)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
- }
-
- func (c *agentClient) SendStream(ctx context.Context, opts ...grpc.CallOption) (Agent_SendStreamClient, error) {
- stream, err := c.cc.NewStream(ctx, &Agent_ServiceDesc.Streams[2], Agent_SendStream_FullMethodName, opts...)
- if err != nil {
- return nil, err
- }
- x := &agentSendStreamClient{stream}
- return x, nil
- }
-
- type Agent_SendStreamClient interface {
- Send(*StreamDataPacket) error
- CloseAndRecv() (*SendStreamResp, error)
- grpc.ClientStream
- }
-
- type agentSendStreamClient struct {
- grpc.ClientStream
- }
-
- func (x *agentSendStreamClient) Send(m *StreamDataPacket) error {
- return x.ClientStream.SendMsg(m)
- }
-
- func (x *agentSendStreamClient) CloseAndRecv() (*SendStreamResp, error) {
- if err := x.ClientStream.CloseSend(); err != nil {
- return nil, err
- }
- m := new(SendStreamResp)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
- }
-
- func (c *agentClient) FetchStream(ctx context.Context, in *FetchStreamReq, opts ...grpc.CallOption) (Agent_FetchStreamClient, error) {
- stream, err := c.cc.NewStream(ctx, &Agent_ServiceDesc.Streams[3], Agent_FetchStream_FullMethodName, opts...)
- if err != nil {
- return nil, err
- }
- x := &agentFetchStreamClient{stream}
- if err := x.ClientStream.SendMsg(in); err != nil {
- return nil, err
- }
- if err := x.ClientStream.CloseSend(); err != nil {
- return nil, err
- }
- return x, nil
- }
-
- type Agent_FetchStreamClient interface {
- Recv() (*StreamDataPacket, error)
- grpc.ClientStream
- }
-
- type agentFetchStreamClient struct {
- grpc.ClientStream
- }
-
- func (x *agentFetchStreamClient) Recv() (*StreamDataPacket, error) {
- m := new(StreamDataPacket)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
- }
-
- func (c *agentClient) Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingResp, error) {
- out := new(PingResp)
- err := c.cc.Invoke(ctx, Agent_Ping_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
- }
-
- // AgentServer is the server API for Agent service.
- // All implementations must embed UnimplementedAgentServer
- // for forward compatibility
- type AgentServer interface {
- SendIPFSFile(Agent_SendIPFSFileServer) error
- GetIPFSFile(*GetIPFSFileReq, Agent_GetIPFSFileServer) error
- SendStream(Agent_SendStreamServer) error
- FetchStream(*FetchStreamReq, Agent_FetchStreamServer) error
- Ping(context.Context, *PingReq) (*PingResp, error)
- mustEmbedUnimplementedAgentServer()
- }
-
- // UnimplementedAgentServer must be embedded to have forward compatible implementations.
- type UnimplementedAgentServer struct {
- }
-
- func (UnimplementedAgentServer) SendIPFSFile(Agent_SendIPFSFileServer) error {
- return status.Errorf(codes.Unimplemented, "method SendIPFSFile not implemented")
- }
- func (UnimplementedAgentServer) GetIPFSFile(*GetIPFSFileReq, Agent_GetIPFSFileServer) error {
- return status.Errorf(codes.Unimplemented, "method GetIPFSFile not implemented")
- }
- func (UnimplementedAgentServer) SendStream(Agent_SendStreamServer) error {
- return status.Errorf(codes.Unimplemented, "method SendStream not implemented")
- }
- func (UnimplementedAgentServer) FetchStream(*FetchStreamReq, Agent_FetchStreamServer) error {
- return status.Errorf(codes.Unimplemented, "method FetchStream not implemented")
- }
- func (UnimplementedAgentServer) Ping(context.Context, *PingReq) (*PingResp, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
- }
- func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {}
-
- // UnsafeAgentServer may be embedded to opt out of forward compatibility for this service.
- // Use of this interface is not recommended, as added methods to AgentServer will
- // result in compilation errors.
- type UnsafeAgentServer interface {
- mustEmbedUnimplementedAgentServer()
- }
-
- func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) {
- s.RegisterService(&Agent_ServiceDesc, srv)
- }
-
- func _Agent_SendIPFSFile_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(AgentServer).SendIPFSFile(&agentSendIPFSFileServer{stream})
- }
-
- type Agent_SendIPFSFileServer interface {
- SendAndClose(*SendIPFSFileResp) error
- Recv() (*FileDataPacket, error)
- grpc.ServerStream
- }
-
- type agentSendIPFSFileServer struct {
- grpc.ServerStream
- }
-
- func (x *agentSendIPFSFileServer) SendAndClose(m *SendIPFSFileResp) error {
- return x.ServerStream.SendMsg(m)
- }
-
- func (x *agentSendIPFSFileServer) Recv() (*FileDataPacket, error) {
- m := new(FileDataPacket)
- if err := x.ServerStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
- }
-
- func _Agent_GetIPFSFile_Handler(srv interface{}, stream grpc.ServerStream) error {
- m := new(GetIPFSFileReq)
- if err := stream.RecvMsg(m); err != nil {
- return err
- }
- return srv.(AgentServer).GetIPFSFile(m, &agentGetIPFSFileServer{stream})
- }
-
- type Agent_GetIPFSFileServer interface {
- Send(*FileDataPacket) error
- grpc.ServerStream
- }
-
- type agentGetIPFSFileServer struct {
- grpc.ServerStream
- }
-
- func (x *agentGetIPFSFileServer) Send(m *FileDataPacket) error {
- return x.ServerStream.SendMsg(m)
- }
-
- func _Agent_SendStream_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(AgentServer).SendStream(&agentSendStreamServer{stream})
- }
-
- type Agent_SendStreamServer interface {
- SendAndClose(*SendStreamResp) error
- Recv() (*StreamDataPacket, error)
- grpc.ServerStream
- }
-
- type agentSendStreamServer struct {
- grpc.ServerStream
- }
-
- func (x *agentSendStreamServer) SendAndClose(m *SendStreamResp) error {
- return x.ServerStream.SendMsg(m)
- }
-
- func (x *agentSendStreamServer) Recv() (*StreamDataPacket, error) {
- m := new(StreamDataPacket)
- if err := x.ServerStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
- }
-
- func _Agent_FetchStream_Handler(srv interface{}, stream grpc.ServerStream) error {
- m := new(FetchStreamReq)
- if err := stream.RecvMsg(m); err != nil {
- return err
- }
- return srv.(AgentServer).FetchStream(m, &agentFetchStreamServer{stream})
- }
-
- type Agent_FetchStreamServer interface {
- Send(*StreamDataPacket) error
- grpc.ServerStream
- }
-
- type agentFetchStreamServer struct {
- grpc.ServerStream
- }
-
- func (x *agentFetchStreamServer) Send(m *StreamDataPacket) error {
- return x.ServerStream.SendMsg(m)
- }
-
- func _Agent_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(PingReq)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AgentServer).Ping(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: Agent_Ping_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AgentServer).Ping(ctx, req.(*PingReq))
- }
- return interceptor(ctx, in, info, handler)
- }
-
- // Agent_ServiceDesc is the grpc.ServiceDesc for Agent service.
- // It's only intended for direct use with grpc.RegisterService,
- // and not to be introspected or modified (even as a copy)
- var Agent_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "Agent",
- HandlerType: (*AgentServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "Ping",
- Handler: _Agent_Ping_Handler,
- },
- },
- Streams: []grpc.StreamDesc{
- {
- StreamName: "SendIPFSFile",
- Handler: _Agent_SendIPFSFile_Handler,
- ClientStreams: true,
- },
- {
- StreamName: "GetIPFSFile",
- Handler: _Agent_GetIPFSFile_Handler,
- ServerStreams: true,
- },
- {
- StreamName: "SendStream",
- Handler: _Agent_SendStream_Handler,
- ClientStreams: true,
- },
- {
- StreamName: "FetchStream",
- Handler: _Agent_FetchStream_Handler,
- ServerStreams: true,
- },
- },
- Metadata: "pkgs/grpc/agent/agent.proto",
- }
|