Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)
- type Envelope
- func (*Envelope) Descriptor() ([]byte, []int)deprecated
- func (x *Envelope) GetBody() []byte
- func (x *Envelope) GetBodyType() string
- func (x *Envelope) GetFromId() uint64
- func (x *Envelope) GetFromIncarnation() uint64
- func (x *Envelope) GetHello() *Hello
- func (x *Envelope) GetKind() Kind
- func (x *Envelope) GetMetadata() map[string]string
- func (x *Envelope) GetReason() string
- func (x *Envelope) GetRef() uint64
- func (x *Envelope) GetStatus() Status
- func (x *Envelope) GetTimeoutNanos() int64
- func (x *Envelope) GetToId() uint64
- func (x *Envelope) GetToIncarnation() uint64
- func (x *Envelope) GetToName() string
- func (x *Envelope) GetWatch() bool
- func (x *Envelope) GetWatchedId() uint64
- func (*Envelope) ProtoMessage()
- func (x *Envelope) ProtoReflect() protoreflect.Message
- func (x *Envelope) Reset()
- func (x *Envelope) String() string
- type Frame
- type Hello
- func (*Hello) Descriptor() ([]byte, []int)deprecated
- func (x *Hello) GetIncarnation() uint64
- func (x *Hello) GetNode() string
- func (x *Hello) GetSession() uint64
- func (x *Hello) GetVersion() uint32
- func (*Hello) ProtoMessage()
- func (x *Hello) ProtoReflect() protoreflect.Message
- func (x *Hello) Reset()
- func (x *Hello) String() string
- type Kind
- type NodeClient
- type NodeServer
- type Node_LinkClient
- type Node_LinkServer
- type PID
- type Status
- type UnimplementedNodeServer
- type UnsafeNodeServer
Constants ¶
const (
Node_Link_FullMethodName = "/grpcproc.v1.Node/Link"
)
Variables ¶
var ( Kind_name = map[int32]string{ 0: "KIND_UNSPECIFIED", 1: "KIND_HELLO", 2: "KIND_SEND", 3: "KIND_CALL", 4: "KIND_REPLY", 5: "KIND_MONITOR", 6: "KIND_DEMONITOR", 7: "KIND_DOWN", 8: "KIND_EXIT", } Kind_value = map[string]int32{ "KIND_UNSPECIFIED": 0, "KIND_HELLO": 1, "KIND_SEND": 2, "KIND_CALL": 3, "KIND_REPLY": 4, "KIND_MONITOR": 5, "KIND_DEMONITOR": 6, "KIND_DOWN": 7, "KIND_EXIT": 8, } )
Enum value maps for Kind.
var ( Status_name = map[int32]string{ 0: "STATUS_UNSPECIFIED", 1: "STATUS_OK", 2: "STATUS_ERROR", 3: "STATUS_NOPROC", 4: "STATUS_TYPE", } Status_value = map[string]int32{ "STATUS_UNSPECIFIED": 0, "STATUS_OK": 1, "STATUS_ERROR": 2, "STATUS_NOPROC": 3, "STATUS_TYPE": 4, } )
Enum value maps for Status.
var File_grpcproc_v1_grpcproc_proto protoreflect.FileDescriptor
var Node_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpcproc.v1.Node", HandlerType: (*NodeServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Link", Handler: _Node_Link_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "grpcproc/v1/grpcproc.proto", }
Node_ServiceDesc is the grpc.ServiceDesc for Node service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterNodeServer ¶
func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)
Types ¶
type Envelope ¶
type Envelope struct {
Kind Kind `protobuf:"varint,1,opt,name=kind,proto3,enum=grpcproc.v1.Kind" json:"kind,omitempty"`
// The process on the sending node; id 0 is the node itself.
FromIncarnation uint64 `protobuf:"varint,2,opt,name=from_incarnation,json=fromIncarnation,proto3" json:"from_incarnation,omitempty"`
FromId uint64 `protobuf:"varint,3,opt,name=from_id,json=fromId,proto3" json:"from_id,omitempty"`
// The process on the receiving node, unless to_name addresses it by name.
ToIncarnation uint64 `protobuf:"varint,4,opt,name=to_incarnation,json=toIncarnation,proto3" json:"to_incarnation,omitempty"`
ToId uint64 `protobuf:"varint,5,opt,name=to_id,json=toId,proto3" json:"to_id,omitempty"`
ToName string `protobuf:"bytes,6,opt,name=to_name,json=toName,proto3" json:"to_name,omitempty"`
// A call's id, echoed by its reply, or a monitor's id, echoed by its down.
Ref uint64 `protobuf:"varint,7,opt,name=ref,proto3" json:"ref,omitempty"`
// A reply's status.
Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=grpcproc.v1.Status" json:"status,omitempty"`
// A reply's error, or the reason of a down or an exit.
Reason string `protobuf:"bytes,9,opt,name=reason,proto3" json:"reason,omitempty"`
// The body of a send, a call or a reply: its message type's full name and
// its encoding.
BodyType string `protobuf:"bytes,10,opt,name=body_type,json=bodyType,proto3" json:"body_type,omitempty"`
Body []byte `protobuf:"bytes,11,opt,name=body,proto3" json:"body,omitempty"`
Hello *Hello `protobuf:"bytes,12,opt,name=hello,proto3" json:"hello,omitempty"`
// A call's time left, in nanoseconds, when it was written: its caller
// waits that long for the reply. 0 for a caller with no deadline. A time
// left rather than a deadline, so that clocks need not agree.
TimeoutNanos int64 `protobuf:"varint,13,opt,name=timeout_nanos,json=timeoutNanos,proto3" json:"timeout_nanos,omitempty"`
// Propagated context: trace headers, tenant. Never interpreted by
// grpcproc itself.
Metadata map[string]string `` /* 144-byte string literal not displayed */
// A call's: its caller watches, monitors or is linked to, the process the
// callee places the watch on, under the call's ref. The callee places it
// before it answers: on a process it spawns, before that process runs, or
// on one that runs. A peer that does not know it places none.
Watch bool `protobuf:"varint,16,opt,name=watch,proto3" json:"watch,omitempty"`
// A reply's: the process of the replying node the call's watch was placed
// on. 0 when none was.
WatchedId uint64 `protobuf:"varint,17,opt,name=watched_id,json=watchedId,proto3" json:"watched_id,omitempty"`
// contains filtered or unexported fields
}
Envelope is one interaction between two processes. Its processes are named by incarnation and id alone: the sender is on the node that opened the link, the target on the node that accepted it, so neither node name travels with each envelope. It is one flat message so that decoding one allocates little.
func (*Envelope) Descriptor
deprecated
func (*Envelope) GetBodyType ¶
func (*Envelope) GetFromIncarnation ¶
func (*Envelope) GetMetadata ¶
func (*Envelope) GetTimeoutNanos ¶ added in v0.1.0
func (*Envelope) GetToIncarnation ¶
func (*Envelope) GetWatchedId ¶ added in v0.3.0
func (*Envelope) ProtoMessage ¶
func (*Envelope) ProtoMessage()
func (*Envelope) ProtoReflect ¶
func (x *Envelope) ProtoReflect() protoreflect.Message
type Frame ¶
type Frame struct {
Envelopes []*Envelope `protobuf:"bytes,1,rep,name=envelopes,proto3" json:"envelopes,omitempty"`
// contains filtered or unexported fields
}
Frame is what a link writes at once: every envelope queued since its last write, in order. Under load many envelopes share one gRPC message.
func (*Frame) Descriptor
deprecated
func (*Frame) GetEnvelopes ¶
func (*Frame) ProtoMessage ¶
func (*Frame) ProtoMessage()
func (*Frame) ProtoReflect ¶
func (x *Frame) ProtoReflect() protoreflect.Message
type Hello ¶
type Hello struct {
Node string `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
Incarnation uint64 `protobuf:"varint,2,opt,name=incarnation,proto3" json:"incarnation,omitempty"`
Version uint32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
// How many sessions the server's links with the client's node have had
// end, as the server counts them, the client's count taken if larger. A
// client that counts fewer learns that the server ended its session with
// it; one that counts more dialed in a session that has ended since.
Session uint64 `protobuf:"varint,4,opt,name=session,proto3" json:"session,omitempty"`
// contains filtered or unexported fields
}
Hello is the first envelope on a stream, sent by the server. It names the node the client actually reached.
func (*Hello) Descriptor
deprecated
func (*Hello) GetIncarnation ¶
func (*Hello) GetSession ¶ added in v0.6.0
func (*Hello) GetVersion ¶
func (*Hello) ProtoMessage ¶
func (*Hello) ProtoMessage()
func (*Hello) ProtoReflect ¶
func (x *Hello) ProtoReflect() protoreflect.Message
type Kind ¶
type Kind int32
const ( Kind_KIND_UNSPECIFIED Kind = 0 // The first envelope on a stream, sent by the server. Kind_KIND_HELLO Kind = 1 // An asynchronous message. Kind_KIND_SEND Kind = 2 // A request that expects a KIND_REPLY with the same ref. Kind_KIND_CALL Kind = 3 Kind_KIND_REPLY Kind = 4 // Asks the target's node to send KIND_DOWN when the target exits. Kind_KIND_MONITOR Kind = 5 Kind_KIND_DEMONITOR Kind = 6 // Tells the target that the sender exited. Kind_KIND_DOWN Kind = 7 // Asks the target to terminate. Kind_KIND_EXIT Kind = 8 )
func (Kind) Descriptor ¶
func (Kind) Descriptor() protoreflect.EnumDescriptor
func (Kind) EnumDescriptor
deprecated
func (Kind) Number ¶
func (x Kind) Number() protoreflect.EnumNumber
func (Kind) Type ¶
func (Kind) Type() protoreflect.EnumType
type NodeClient ¶
type NodeClient interface {
// Link is opened by the sending node. The client sends its identity in the
// request metadata (grpcproc-node, grpcproc-incarnation, grpcproc-version); the
// server answers with one Frame holding a Hello and then only reads.
// Application envelopes flow client -> server only.
Link(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Frame, Frame], error)
}
NodeClient is the client API for Node 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.
Node is registered by a node on the application's gRPC server.
func NewNodeClient ¶
func NewNodeClient(cc grpc.ClientConnInterface) NodeClient
type NodeServer ¶
type NodeServer interface {
// Link is opened by the sending node. The client sends its identity in the
// request metadata (grpcproc-node, grpcproc-incarnation, grpcproc-version); the
// server answers with one Frame holding a Hello and then only reads.
// Application envelopes flow client -> server only.
Link(grpc.BidiStreamingServer[Frame, Frame]) error
// contains filtered or unexported methods
}
NodeServer is the server API for Node service. All implementations must embed UnimplementedNodeServer for forward compatibility.
Node is registered by a node on the application's gRPC server.
type Node_LinkClient ¶
type Node_LinkClient = grpc.BidiStreamingClient[Frame, Frame]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Node_LinkServer ¶
type Node_LinkServer = grpc.BidiStreamingServer[Frame, Frame]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type PID ¶
type PID struct {
Node string `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
// Incarnation changes every time a node starts, so a PID from before a
// restart never reaches a process created after it.
Incarnation uint64 `protobuf:"varint,2,opt,name=incarnation,proto3" json:"incarnation,omitempty"`
Id uint64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"`
// contains filtered or unexported fields
}
PID identifies a process anywhere in the cluster.
func (*PID) Descriptor
deprecated
func (*PID) GetIncarnation ¶
func (*PID) ProtoMessage ¶
func (*PID) ProtoMessage()
func (*PID) ProtoReflect ¶
func (x *PID) ProtoReflect() protoreflect.Message
type Status ¶
type Status int32
const ( Status_STATUS_UNSPECIFIED Status = 0 Status_STATUS_OK Status = 1 // The handler returned an error; reason carries its text. Status_STATUS_ERROR Status = 2 // No such process, or it exited before answering; or, with reason // "mailbox full", its mailbox had no room, and the call was never handled. Status_STATUS_NOPROC Status = 3 // The process exists but does not accept this message type. Status_STATUS_TYPE Status = 4 )
func (Status) Descriptor ¶
func (Status) Descriptor() protoreflect.EnumDescriptor
func (Status) EnumDescriptor
deprecated
func (Status) Number ¶
func (x Status) Number() protoreflect.EnumNumber
func (Status) Type ¶
func (Status) Type() protoreflect.EnumType
type UnimplementedNodeServer ¶
type UnimplementedNodeServer struct{}
UnimplementedNodeServer 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 (UnimplementedNodeServer) Link ¶
func (UnimplementedNodeServer) Link(grpc.BidiStreamingServer[Frame, Frame]) error
type UnsafeNodeServer ¶
type UnsafeNodeServer interface {
// contains filtered or unexported methods
}
UnsafeNodeServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NodeServer will result in compilation errors.