Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterNodeServiceServer(s grpc.ServiceRegistrar, srv NodeServiceServer)
- type Envelope
- func (*Envelope) Descriptor() ([]byte, []int)deprecated
- func (x *Envelope) GetCorrelationId() string
- func (x *Envelope) GetFrom() string
- func (x *Envelope) GetId() string
- func (x *Envelope) GetMeta() map[string]string
- func (x *Envelope) GetPayload() []byte
- func (x *Envelope) GetTimestamp() int64
- func (x *Envelope) GetTo() string
- func (x *Envelope) GetType() int32
- func (*Envelope) ProtoMessage()
- func (x *Envelope) ProtoReflect() protoreflect.Message
- func (x *Envelope) Reset()
- func (x *Envelope) String() string
- type NodeServiceClient
- type NodeServiceServer
- type NodeService_ConnectClient
- type NodeService_ConnectServer
- type UnimplementedNodeServiceServer
- type UnsafeNodeServiceServer
Constants ¶
const (
NodeService_Connect_FullMethodName = "/protocol.NodeService/Connect"
)
Variables ¶
var File_node_proto protoreflect.FileDescriptor
var NodeService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "protocol.NodeService", HandlerType: (*NodeServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Connect", Handler: _NodeService_Connect_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "node.proto", }
NodeService_ServiceDesc is the grpc.ServiceDesc for NodeService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterNodeServiceServer ¶
func RegisterNodeServiceServer(s grpc.ServiceRegistrar, srv NodeServiceServer)
Types ¶
type Envelope ¶
type Envelope struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 消息ID
Type int32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"` // 消息类型
Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` // 消息内容
From string `protobuf:"bytes,4,opt,name=from,proto3" json:"from,omitempty"` // 发送方
To string `protobuf:"bytes,5,opt,name=to,proto3" json:"to,omitempty"` // 接收方
CorrelationId string `protobuf:"bytes,6,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"` // 关联ID(用于请求-响应匹配)
Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 时间戳
Meta map[string]string `` // 元数据
/* 135-byte string literal not displayed */
// contains filtered or unexported fields
}
Envelope 消息信封
func (*Envelope) Descriptor
deprecated
func (*Envelope) GetCorrelationId ¶
func (*Envelope) GetPayload ¶
func (*Envelope) GetTimestamp ¶
func (*Envelope) ProtoMessage ¶
func (*Envelope) ProtoMessage()
func (*Envelope) ProtoReflect ¶
func (x *Envelope) ProtoReflect() protoreflect.Message
type NodeServiceClient ¶
type NodeServiceClient interface {
// Connect 建立双向流连接
Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Envelope, Envelope], error)
}
NodeServiceClient is the client API for NodeService 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.
NodeService 节点通信服务
func NewNodeServiceClient ¶
func NewNodeServiceClient(cc grpc.ClientConnInterface) NodeServiceClient
type NodeServiceServer ¶
type NodeServiceServer interface {
// Connect 建立双向流连接
Connect(grpc.BidiStreamingServer[Envelope, Envelope]) error
// contains filtered or unexported methods
}
NodeServiceServer is the server API for NodeService service. All implementations must embed UnimplementedNodeServiceServer for forward compatibility.
NodeService 节点通信服务
type NodeService_ConnectClient ¶
type NodeService_ConnectClient = grpc.BidiStreamingClient[Envelope, Envelope]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NodeService_ConnectServer ¶
type NodeService_ConnectServer = grpc.BidiStreamingServer[Envelope, Envelope]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type UnimplementedNodeServiceServer ¶
type UnimplementedNodeServiceServer struct{}
UnimplementedNodeServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedNodeServiceServer) Connect ¶
func (UnimplementedNodeServiceServer) Connect(grpc.BidiStreamingServer[Envelope, Envelope]) error
type UnsafeNodeServiceServer ¶
type UnsafeNodeServiceServer interface {
// contains filtered or unexported methods
}
UnsafeNodeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NodeServiceServer will result in compilation errors.