229 lines
6.9 KiB
Go
229 lines
6.9 KiB
Go
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
|
// protoc-gen-go-drpc version: v0.0.32
|
|
// source: 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_consensusproto_protos_consensus_proto struct{}
|
|
|
|
func (drpcEncoding_File_consensusproto_protos_consensus_proto) Marshal(msg drpc.Message) ([]byte, error) {
|
|
return proto.Marshal(msg.(proto.Message))
|
|
}
|
|
|
|
func (drpcEncoding_File_consensusproto_protos_consensus_proto) Unmarshal(buf []byte, msg drpc.Message) error {
|
|
return proto.Unmarshal(buf, msg.(proto.Message))
|
|
}
|
|
|
|
func (drpcEncoding_File_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_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) (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_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_consensusproto_protos_consensus_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcConsensusClient) WatchLog(ctx context.Context) (DRPCConsensus_WatchLogClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, "/anyConsensus.Consensus/WatchLog", drpcEncoding_File_consensusproto_protos_consensus_proto{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &drpcConsensus_WatchLogClient{stream}
|
|
return x, nil
|
|
}
|
|
|
|
type DRPCConsensus_WatchLogClient interface {
|
|
drpc.Stream
|
|
Send(*WatchLogRequest) error
|
|
Recv() (*WatchLogEvent, error)
|
|
}
|
|
|
|
type drpcConsensus_WatchLogClient struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcConsensus_WatchLogClient) Send(m *WatchLogRequest) error {
|
|
return x.MsgSend(m, drpcEncoding_File_consensusproto_protos_consensus_proto{})
|
|
}
|
|
|
|
func (x *drpcConsensus_WatchLogClient) Recv() (*WatchLogEvent, error) {
|
|
m := new(WatchLogEvent)
|
|
if err := x.MsgRecv(m, drpcEncoding_File_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_consensusproto_protos_consensus_proto{})
|
|
}
|
|
|
|
type DRPCConsensusServer interface {
|
|
AddLog(context.Context, *AddLogRequest) (*Ok, error)
|
|
AddRecord(context.Context, *AddRecordRequest) (*Ok, error)
|
|
WatchLog(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(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_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_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_consensusproto_protos_consensus_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return nil, srv.(DRPCConsensusServer).
|
|
WatchLog(
|
|
&drpcConsensus_WatchLogStream{in1.(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_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_consensusproto_protos_consensus_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCConsensus_WatchLogStream interface {
|
|
drpc.Stream
|
|
Send(*WatchLogEvent) error
|
|
Recv() (*WatchLogRequest, error)
|
|
}
|
|
|
|
type drpcConsensus_WatchLogStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcConsensus_WatchLogStream) Send(m *WatchLogEvent) error {
|
|
return x.MsgSend(m, drpcEncoding_File_consensusproto_protos_consensus_proto{})
|
|
}
|
|
|
|
func (x *drpcConsensus_WatchLogStream) Recv() (*WatchLogRequest, error) {
|
|
m := new(WatchLogRequest)
|
|
if err := x.MsgRecv(m, drpcEncoding_File_consensusproto_protos_consensus_proto{}); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (x *drpcConsensus_WatchLogStream) RecvMsg(m *WatchLogRequest) error {
|
|
return x.MsgRecv(m, drpcEncoding_File_consensusproto_protos_consensus_proto{})
|
|
}
|