stream_api_rpc

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
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 (m *Data) CloneMessageVT() proto.Message

func (*Data) CloneVT added in v0.8.3

func (m *Data) CloneVT() *Data

func (*Data) Descriptor deprecated

func (*Data) Descriptor() ([]byte, []int)

Deprecated: Use Data.ProtoReflect.Descriptor instead.

func (*Data) EqualMessageVT added in v0.15.6

func (this *Data) EqualMessageVT(thatMsg proto.Message) bool

func (*Data) EqualVT added in v0.3.0

func (this *Data) EqualVT(that *Data) bool

func (*Data) GetData

func (x *Data) GetData() []byte

func (*Data) GetState

func (x *Data) GetState() StreamState

func (*Data) MarshalToSizedBufferVT added in v0.2.0

func (m *Data) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Data) MarshalToVT added in v0.2.0

func (m *Data) MarshalToVT(dAtA []byte) (int, error)

func (*Data) MarshalVT added in v0.2.0

func (m *Data) MarshalVT() (dAtA []byte, err error)

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) ProtoReflect added in v0.2.0

func (x *Data) ProtoReflect() protoreflect.Message

func (*Data) Reset

func (x *Data) Reset()

func (*Data) SizeVT added in v0.2.0

func (m *Data) SizeVT() (n int)

func (*Data) String

func (x *Data) String() string

func (*Data) UnmarshalVT added in v0.2.0

func (m *Data) UnmarshalVT(dAtA []byte) error

type NetConn

type NetConn struct {
	// contains filtered or unexported fields
}

NetConn wraps an RPC into a net.Conn compat interface.

func NewNetConn

func NewNetConn(localPeerID, remotePeerID peer.ID, rpc RPC) *NetConn

NewNetConn constructs a new NetConn.

func (*NetConn) Close

func (n *NetConn) Close() error

Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.

func (*NetConn) LocalAddr

func (n *NetConn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*NetConn) Read

func (n *NetConn) Read(b []byte) (int, error)

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

func (n *NetConn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*NetConn) SetDeadline

func (n *NetConn) SetDeadline(t time.Time) error

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

func (n *NetConn) SetReadDeadline(t time.Time) error

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

func (n *NetConn) SetWriteDeadline(t time.Time) error

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.

func (*NetConn) Write

func (n *NetConn) Write(b []byte) (nw int, err error)

Write writes data to the connection. Write can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetWriteDeadline.

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) 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL