Documentation ¶
Overview ¶
Package drpcstream sends protobufs using the dprc wire protocol.
Index ¶
- type Options
- type Stream
- func (s *Stream) Cancel(err error)
- func (s *Stream) Close() (err error)
- func (s *Stream) CloseSend() (err error)
- func (s *Stream) Context() context.Context
- func (s *Stream) Finished() bool
- func (s *Stream) HandlePacket(pkt drpcwire.Packet) (more bool, err error)
- func (s *Stream) MsgRecv(msg drpc.Message) (err error)
- func (s *Stream) MsgSend(msg drpc.Message) (err error)
- func (s *Stream) RawFlush() (err error)
- func (s *Stream) RawRecv() (data []byte, err error)
- func (s *Stream) RawWrite(kind drpcwire.Kind, data []byte) (err error)
- func (s *Stream) SendError(serr error) (err error)
- func (s *Stream) Terminated() <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶ added in v0.0.7
type Options struct { // SplitSize controls the default size we split packets into frames. SplitSize int }
Options controls configuration settings for a stream.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream represents an rpc actively happening on a transport.
func New ¶
New returns a new stream bound to the context with the given stream id and will use the writer to write messages on. It is important use monotonically increasing stream ids within a single transport.
func NewWithOptions ¶ added in v0.0.7
NewWithOptions returns a new stream bound to the context with the given stream id and will use the writer to write messages on. It is important use monotonically increasing stream ids within a single transport. The options are used to control details of how the Stream operates.
func (*Stream) Cancel ¶ added in v0.0.7
Cancel transitions the stream into a state where all writes to the transport will return the provided error, and terminates the stream. It is a no-op if the stream is already terminated.
func (*Stream) Close ¶
Close terminates the stream and sends that the stream has been closed to the remote. It is a no-op if the stream is already terminated.
func (*Stream) CloseSend ¶
CloseSend informs the remote that no more messages will be sent. If the remote has also already issued a CloseSend, the stream is terminated. It is a no-op if the stream already has sent a CloseSend or if it is terminated.
func (*Stream) Context ¶
Context returns the context associated with the stream. It is closed when the Stream will no longer issue any writes or reads.
func (*Stream) Finished ¶ added in v0.0.7
Finished returns true if the stream is fully finished and will no longer issue any writes or reads.
func (*Stream) HandlePacket ¶ added in v0.0.5
HandlePacket advances the stream state machine by inspecting the packet. It returns any major errors that should terminate the transport the stream is operating on as well as a boolean indicating if the stream expects more packets.
func (*Stream) SendError ¶
SendError terminates the stream and sends the error to the remote. It is a no-op if the stream is already terminated.
func (*Stream) Terminated ¶ added in v0.0.5
func (s *Stream) Terminated() <-chan struct{}
Terminated returns a channel when the stream has been terminated.