Documentation ¶
Index ¶
- Variables
- func RegisterGrpcTransportServer(s grpc.ServiceRegistrar, srv GrpcTransportServer)
- type ByeBye
- type GrpcMessage
- func (*GrpcMessage) Descriptor() ([]byte, []int)deprecated
- func (x *GrpcMessage) GetPbMsg() *messagepb.Message
- func (x *GrpcMessage) GetRawMsg() *RawMessage
- func (x *GrpcMessage) GetSender() []byte
- func (m *GrpcMessage) GetType() isGrpcMessage_Type
- func (*GrpcMessage) ProtoMessage()
- func (x *GrpcMessage) ProtoReflect() protoreflect.Message
- func (x *GrpcMessage) Reset()
- func (x *GrpcMessage) String() string
- type GrpcMessage_PbMsg
- type GrpcMessage_RawMsg
- type GrpcTransportClient
- type GrpcTransportServer
- type GrpcTransport_ListenClient
- type GrpcTransport_ListenServer
- type Params
- type RawMessage
- type Transport
- func (tr *Transport) ApplyEvents(ctx context.Context, eventList *stdtypes.EventList) error
- func (tr *Transport) ApplyPbEvent(ctx context.Context, evt *eventpb.Event) error
- func (tr *Transport) CloseOldConnections(newMembership *trantorpbtypes.Membership)
- func (tr *Transport) Connect(membership *trantorpbtypes.Membership)
- func (tr *Transport) EventsOut() <-chan *stdtypes.EventList
- func (tr *Transport) ImplementsModule()
- func (tr *Transport) Listen(srv GrpcTransport_ListenServer) error
- func (tr *Transport) Send(dest stdtypes.NodeID, msg *messagepb.Message) error
- func (tr *Transport) SendPbMessage(destNode stdtypes.NodeID, msg *messagepb.Message) error
- func (tr *Transport) SendRawMessage(destNode stdtypes.NodeID, destModule stdtypes.ModuleID, ...) error
- func (tr *Transport) ServerError() error
- func (tr *Transport) Start() error
- func (tr *Transport) Stop()
- func (tr *Transport) WaitFor(n int) error
- type TransportMessage
- type UnimplementedGrpcTransportServer
- type UnsafeGrpcTransportServer
Constants ¶
This section is empty.
Variables ¶
var File_net_grpc_grpctransport_proto protoreflect.FileDescriptor
var GrpcTransport_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpctransport.GrpcTransport", HandlerType: (*GrpcTransportServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Listen", Handler: _GrpcTransport_Listen_Handler, ClientStreams: true, }, }, Metadata: "net/grpc/grpctransport.proto", }
GrpcTransport_ServiceDesc is the grpc.ServiceDesc for GrpcTransport service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterGrpcTransportServer ¶
func RegisterGrpcTransportServer(s grpc.ServiceRegistrar, srv GrpcTransportServer)
Types ¶
type ByeBye ¶
type ByeBye struct {
// contains filtered or unexported fields
}
func (*ByeBye) Descriptor
deprecated
func (*ByeBye) ProtoMessage ¶
func (*ByeBye) ProtoMessage()
func (*ByeBye) ProtoReflect ¶
func (x *ByeBye) ProtoReflect() protoreflect.Message
type GrpcMessage ¶
type GrpcMessage struct { Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // Types that are assignable to Type: // *GrpcMessage_PbMsg // *GrpcMessage_RawMsg Type isGrpcMessage_Type `protobuf_oneof:"type"` // contains filtered or unexported fields }
func (*GrpcMessage) Descriptor
deprecated
func (*GrpcMessage) Descriptor() ([]byte, []int)
Deprecated: Use GrpcMessage.ProtoReflect.Descriptor instead.
func (*GrpcMessage) GetPbMsg ¶
func (x *GrpcMessage) GetPbMsg() *messagepb.Message
func (*GrpcMessage) GetRawMsg ¶
func (x *GrpcMessage) GetRawMsg() *RawMessage
func (*GrpcMessage) GetSender ¶
func (x *GrpcMessage) GetSender() []byte
func (*GrpcMessage) GetType ¶
func (m *GrpcMessage) GetType() isGrpcMessage_Type
func (*GrpcMessage) ProtoMessage ¶
func (*GrpcMessage) ProtoMessage()
func (*GrpcMessage) ProtoReflect ¶
func (x *GrpcMessage) ProtoReflect() protoreflect.Message
func (*GrpcMessage) Reset ¶
func (x *GrpcMessage) Reset()
func (*GrpcMessage) String ¶
func (x *GrpcMessage) String() string
type GrpcMessage_PbMsg ¶
type GrpcMessage_RawMsg ¶
type GrpcMessage_RawMsg struct {
RawMsg *RawMessage `protobuf:"bytes,3,opt,name=raw_msg,json=rawMsg,proto3,oneof"`
}
type GrpcTransportClient ¶
type GrpcTransportClient interface {
Listen(ctx context.Context, opts ...grpc.CallOption) (GrpcTransport_ListenClient, error)
}
GrpcTransportClient is the client API for GrpcTransport 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.
func NewGrpcTransportClient ¶
func NewGrpcTransportClient(cc grpc.ClientConnInterface) GrpcTransportClient
type GrpcTransportServer ¶
type GrpcTransportServer interface { Listen(GrpcTransport_ListenServer) error // contains filtered or unexported methods }
GrpcTransportServer is the server API for GrpcTransport service. All implementations must embed UnimplementedGrpcTransportServer for forward compatibility
type GrpcTransport_ListenClient ¶
type GrpcTransport_ListenClient interface { Send(*GrpcMessage) error CloseAndRecv() (*ByeBye, error) grpc.ClientStream }
type GrpcTransport_ListenServer ¶
type GrpcTransport_ListenServer interface { SendAndClose(*ByeBye) error Recv() (*GrpcMessage, error) grpc.ServerStream }
type Params ¶
type Params struct { ConnectionBufferSize int `json:",string"` ReconnectionPeriod time.Duration `json:",string"` MinComplainPeriod time.Duration `json:",string"` }
func DefaultParams ¶
func DefaultParams() Params
type RawMessage ¶
type RawMessage struct { DestModule string `protobuf:"bytes,1,opt,name=dest_module,json=destModule,proto3" json:"dest_module,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*RawMessage) Descriptor
deprecated
func (*RawMessage) Descriptor() ([]byte, []int)
Deprecated: Use RawMessage.ProtoReflect.Descriptor instead.
func (*RawMessage) GetData ¶
func (x *RawMessage) GetData() []byte
func (*RawMessage) GetDestModule ¶
func (x *RawMessage) GetDestModule() string
func (*RawMessage) ProtoMessage ¶
func (*RawMessage) ProtoMessage()
func (*RawMessage) ProtoReflect ¶
func (x *RawMessage) ProtoReflect() protoreflect.Message
func (*RawMessage) Reset ¶
func (x *RawMessage) Reset()
func (*RawMessage) String ¶
func (x *RawMessage) String() string
type Transport ¶
type Transport struct { UnimplementedGrpcTransportServer // contains filtered or unexported fields }
func NewTransport ¶
func (*Transport) ApplyEvents ¶
func (*Transport) ApplyPbEvent ¶
func (*Transport) CloseOldConnections ¶
func (tr *Transport) CloseOldConnections(newMembership *trantorpbtypes.Membership)
func (*Transport) Connect ¶
func (tr *Transport) Connect(membership *trantorpbtypes.Membership)
func (*Transport) ImplementsModule ¶
func (tr *Transport) ImplementsModule()
func (*Transport) Listen ¶
func (tr *Transport) Listen(srv GrpcTransport_ListenServer) error
Listen implements the gRPC Listen service (multi-request-single-response). It receives messages from the gRPC client running on the other node and writes them to a channel that the user can access through ReceiveChan(). This function is called by the gRPC system on every new connection from another node's Net module's gRPC client.
func (*Transport) Send ¶
Send sends a protobuf type message msg to the node with ID dest. Concurrent calls to Send are not (yet? TODO) supported. This is just a wrapper around SendPbMessage. TODO: generalize interface to take a stdtypes.Message instead.
func (*Transport) SendPbMessage ¶
SendPbMessage sends a protobuf type message msg to the node with ID dest. Concurrent calls to Send are not (yet? TODO) supported.
func (*Transport) SendRawMessage ¶
func (*Transport) ServerError ¶
ServerError returns the error returned by the gRPC server's Serve() call. ServerError() must not be called before the GrpcTransport is stopped and its Stop() method has returned.
func (*Transport) Start ¶
Start starts the networking module by initializing and starting the internal gRPC server, listening on the port determined by the membership and own ID. Before ths method is called, no other GrpcTransports can connect to this one.
type TransportMessage ¶
type UnimplementedGrpcTransportServer ¶
type UnimplementedGrpcTransportServer struct { }
UnimplementedGrpcTransportServer must be embedded to have forward compatible implementations.
func (UnimplementedGrpcTransportServer) Listen ¶
func (UnimplementedGrpcTransportServer) Listen(GrpcTransport_ListenServer) error
type UnsafeGrpcTransportServer ¶
type UnsafeGrpcTransportServer interface {
// contains filtered or unexported methods
}
UnsafeGrpcTransportServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GrpcTransportServer will result in compilation errors.