Documentation ¶
Index ¶
- Variables
- func AttachRPCToStream(rpc RPC, s io.ReadWriteCloser, stateCb func(state StreamState)) error
- type Data
- func (m *Data) CloneMessageVT() proto.Message
- func (m *Data) CloneVT() *Data
- func (*Data) Descriptor() ([]byte, []int)deprecated
- func (this *Data) EqualMessageVT(thatMsg proto.Message) bool
- func (this *Data) EqualVT(that *Data) bool
- func (x *Data) GetData() []byte
- func (x *Data) GetState() StreamState
- func (m *Data) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Data) MarshalToVT(dAtA []byte) (int, error)
- func (m *Data) MarshalVT() (dAtA []byte, err error)
- func (*Data) ProtoMessage()
- func (x *Data) ProtoReflect() protoreflect.Message
- func (x *Data) Reset()
- func (m *Data) SizeVT() (n int)
- func (x *Data) String() string
- func (m *Data) UnmarshalVT(dAtA []byte) error
- type NetConn
- func (n *NetConn) Close() error
- func (n *NetConn) LocalAddr() net.Addr
- func (n *NetConn) Read(b []byte) (int, error)
- func (n *NetConn) RemoteAddr() net.Addr
- func (n *NetConn) SetDeadline(t time.Time) error
- func (n *NetConn) SetReadDeadline(t time.Time) error
- func (n *NetConn) SetWriteDeadline(t time.Time) error
- func (n *NetConn) Write(b []byte) (nw int, err error)
- type RPC
- type StreamState
- func (StreamState) Descriptor() protoreflect.EnumDescriptor
- func (x StreamState) Enum() *StreamState
- func (StreamState) EnumDescriptor() ([]byte, []int)deprecated
- func (x StreamState) Number() protoreflect.EnumNumber
- func (x StreamState) String() string
- func (StreamState) Type() protoreflect.EnumType
Constants ¶
This section is empty.
Variables ¶
var ( StreamState_name = map[int32]string{ 0: "StreamState_NONE", 1: "StreamState_ESTABLISHING", 2: "StreamState_ESTABLISHED", } StreamState_value = map[string]int32{ "StreamState_NONE": 0, "StreamState_ESTABLISHING": 1, "StreamState_ESTABLISHED": 2, } )
Enum value maps for StreamState.
var ( ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") )
var File_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto protoreflect.FileDescriptor
Functions ¶
func AttachRPCToStream ¶
func AttachRPCToStream( rpc RPC, s io.ReadWriteCloser, stateCb func(state StreamState), ) error
AttachRPCToStream attaches a RPC to a stream.
Types ¶
type Data ¶
type Data struct { // State indicates stream state in-band. // Data is packet data from the remote. Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // State indicates the stream state. State StreamState `protobuf:"varint,2,opt,name=state,proto3,enum=stream.api.rpc.StreamState" json:"state,omitempty"` // contains filtered or unexported fields }
Data is a data packet.
func (*Data) CloneMessageVT ¶ added in v0.15.6
func (*Data) Descriptor
deprecated
func (*Data) EqualMessageVT ¶ added in v0.15.6
func (*Data) GetState ¶
func (x *Data) GetState() StreamState
func (*Data) MarshalToSizedBufferVT ¶ added in v0.2.0
func (*Data) ProtoMessage ¶
func (*Data) ProtoMessage()
func (*Data) ProtoReflect ¶ added in v0.2.0
func (x *Data) ProtoReflect() protoreflect.Message
func (*Data) UnmarshalVT ¶ added in v0.2.0
type NetConn ¶
type NetConn struct {
// contains filtered or unexported fields
}
NetConn wraps an RPC into a net.Conn compat interface.
func NewNetConn ¶
NewNetConn constructs a new NetConn.
func (*NetConn) Close ¶
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*NetConn) Read ¶
Read reads data from the connection. Read can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*NetConn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*NetConn) SetDeadline ¶
SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
A zero value for t means I/O operations will not time out. Deadlines are stubbed here.
func (*NetConn) SetReadDeadline ¶
SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call. A zero value for t means Read will not time out.
func (*NetConn) SetWriteDeadline ¶
SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.
type RPC ¶
type RPC interface { // Context returns the context. Context() context.Context // Send sends a packet. Send(*Data) error // Recv receives a packet. Recv() (*Data, error) }
RPC matches the request/response interface.
type StreamState ¶
type StreamState int32
StreamState is state for the stream related calls.
const ( // StreamState_NONE indicates nothing about the state StreamState_StreamState_NONE StreamState = 0 // StreamState_ESTABLISHING indicates the stream is connecting. StreamState_StreamState_ESTABLISHING StreamState = 1 // StreamState_ESTABLISHED indicates the stream is established. StreamState_StreamState_ESTABLISHED StreamState = 2 )
func (StreamState) Descriptor ¶ added in v0.2.0
func (StreamState) Descriptor() protoreflect.EnumDescriptor
func (StreamState) Enum ¶ added in v0.2.0
func (x StreamState) Enum() *StreamState
func (StreamState) EnumDescriptor
deprecated
func (StreamState) EnumDescriptor() ([]byte, []int)
Deprecated: Use StreamState.Descriptor instead.
func (StreamState) Number ¶ added in v0.2.0
func (x StreamState) Number() protoreflect.EnumNumber
func (StreamState) String ¶
func (x StreamState) String() string
func (StreamState) Type ¶ added in v0.2.0
func (StreamState) Type() protoreflect.EnumType