// Code generated by protoc-gen-go-drpc. DO NOT EDIT. // protoc-gen-go-drpc version: v0.0.32 // source: consensus/consensusproto/protos/consensus.proto package consensusproto import ( bytes "bytes" context "context" errors "errors" jsonpb "github.com/gogo/protobuf/jsonpb" proto "github.com/gogo/protobuf/proto" drpc "storj.io/drpc" drpcerr "storj.io/drpc/drpcerr" ) type drpcEncoding_File_consensus_consensusproto_protos_consensus_proto struct{} func (drpcEncoding_File_consensus_consensusproto_protos_consensus_proto) Marshal(msg drpc.Message) ([]byte, error) { return proto.Marshal(msg.(proto.Message)) } func (drpcEncoding_File_consensus_consensusproto_protos_consensus_proto) Unmarshal(buf []byte, msg drpc.Message) error { return proto.Unmarshal(buf, msg.(proto.Message)) } func (drpcEncoding_File_consensus_consensusproto_protos_consensus_proto) JSONMarshal(msg drpc.Message) ([]byte, error) { var buf bytes.Buffer err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message)) if err != nil { return nil, err } return buf.Bytes(), nil } func (drpcEncoding_File_consensus_consensusproto_protos_consensus_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error { return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message)) } type DRPCConsensusClient interface { DRPCConn() drpc.Conn AddLog(ctx context.Context, in *AddLogRequest) (*Ok, error) AddRecord(ctx context.Context, in *AddRecordRequest) (*Ok, error) WatchLog(ctx context.Context, in *WatchLogRequest) (DRPCConsensus_WatchLogClient, error) } type drpcConsensusClient struct { cc drpc.Conn } func NewDRPCConsensusClient(cc drpc.Conn) DRPCConsensusClient { return &drpcConsensusClient{cc} } func (c *drpcConsensusClient) DRPCConn() drpc.Conn { return c.cc } func (c *drpcConsensusClient) AddLog(ctx context.Context, in *AddLogRequest) (*Ok, error) { out := new(Ok) err := c.cc.Invoke(ctx, "/anyConsensus.Consensus/AddLog", drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}, in, out) if err != nil { return nil, err } return out, nil } func (c *drpcConsensusClient) AddRecord(ctx context.Context, in *AddRecordRequest) (*Ok, error) { out := new(Ok) err := c.cc.Invoke(ctx, "/anyConsensus.Consensus/AddRecord", drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}, in, out) if err != nil { return nil, err } return out, nil } func (c *drpcConsensusClient) WatchLog(ctx context.Context, in *WatchLogRequest) (DRPCConsensus_WatchLogClient, error) { stream, err := c.cc.NewStream(ctx, "/anyConsensus.Consensus/WatchLog", drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}) if err != nil { return nil, err } x := &drpcConsensus_WatchLogClient{stream} if err := x.MsgSend(in, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}); err != nil { return nil, err } if err := x.CloseSend(); err != nil { return nil, err } return x, nil } type DRPCConsensus_WatchLogClient interface { drpc.Stream Recv() (*WatchLogEvent, error) } type drpcConsensus_WatchLogClient struct { drpc.Stream } func (x *drpcConsensus_WatchLogClient) Recv() (*WatchLogEvent, error) { m := new(WatchLogEvent) if err := x.MsgRecv(m, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}); err != nil { return nil, err } return m, nil } func (x *drpcConsensus_WatchLogClient) RecvMsg(m *WatchLogEvent) error { return x.MsgRecv(m, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}) } type DRPCConsensusServer interface { AddLog(context.Context, *AddLogRequest) (*Ok, error) AddRecord(context.Context, *AddRecordRequest) (*Ok, error) WatchLog(*WatchLogRequest, DRPCConsensus_WatchLogStream) error } type DRPCConsensusUnimplementedServer struct{} func (s *DRPCConsensusUnimplementedServer) AddLog(context.Context, *AddLogRequest) (*Ok, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } func (s *DRPCConsensusUnimplementedServer) AddRecord(context.Context, *AddRecordRequest) (*Ok, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } func (s *DRPCConsensusUnimplementedServer) WatchLog(*WatchLogRequest, DRPCConsensus_WatchLogStream) error { return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } type DRPCConsensusDescription struct{} func (DRPCConsensusDescription) NumMethods() int { return 3 } func (DRPCConsensusDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { case 0: return "/anyConsensus.Consensus/AddLog", drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCConsensusServer). AddLog( ctx, in1.(*AddLogRequest), ) }, DRPCConsensusServer.AddLog, true case 1: return "/anyConsensus.Consensus/AddRecord", drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCConsensusServer). AddRecord( ctx, in1.(*AddRecordRequest), ) }, DRPCConsensusServer.AddRecord, true case 2: return "/anyConsensus.Consensus/WatchLog", drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return nil, srv.(DRPCConsensusServer). WatchLog( in1.(*WatchLogRequest), &drpcConsensus_WatchLogStream{in2.(drpc.Stream)}, ) }, DRPCConsensusServer.WatchLog, true default: return "", nil, nil, nil, false } } func DRPCRegisterConsensus(mux drpc.Mux, impl DRPCConsensusServer) error { return mux.Register(impl, DRPCConsensusDescription{}) } type DRPCConsensus_AddLogStream interface { drpc.Stream SendAndClose(*Ok) error } type drpcConsensus_AddLogStream struct { drpc.Stream } func (x *drpcConsensus_AddLogStream) SendAndClose(m *Ok) error { if err := x.MsgSend(m, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}); err != nil { return err } return x.CloseSend() } type DRPCConsensus_AddRecordStream interface { drpc.Stream SendAndClose(*Ok) error } type drpcConsensus_AddRecordStream struct { drpc.Stream } func (x *drpcConsensus_AddRecordStream) SendAndClose(m *Ok) error { if err := x.MsgSend(m, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}); err != nil { return err } return x.CloseSend() } type DRPCConsensus_WatchLogStream interface { drpc.Stream Send(*WatchLogEvent) error } type drpcConsensus_WatchLogStream struct { drpc.Stream } func (x *drpcConsensus_WatchLogStream) Send(m *WatchLogEvent) error { return x.MsgSend(m, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}) }