codec

package module
v0.0.0-...-49676af Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2016 License: ISC Imports: 8 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientCodec

func NewClientCodec(rwc io.ReadWriteCloser) rpc.ClientCodec

NewClientCodec returns a new rpc.Client.

A ClientCodec implements writing of RPC requests and reading of RPC responses for the client side of an RPC session. The client calls WriteRequest to write a request to the connection and calls ReadResponseHeader and ReadResponseBody in pairs to read responses. The client calls Close when finished with the connection. ReadResponseBody may be called with a nil argument to force the body of the response to be read and then discarded.

func NewServerCodec

func NewServerCodec(rwc io.ReadWriteCloser) rpc.ServerCodec

NewServerCodec returns a new rpc.ServerCodec.

A ServerCodec implements reading of RPC requests and writing of RPC responses for the server side of an RPC session. The server calls ReadRequestHeader and ReadRequestBody in pairs to read requests from the connection, and it calls WriteResponse to write a response back. The server calls Close when finished with the connection. ReadRequestBody may be called with a nil argument to force the body of the request to be read and discarded.

Types

type DecodeReader

type DecodeReader interface {
	io.ByteReader
	io.Reader
}

type Decoder

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

A Decoder manages the receipt of type and data information read from the remote side of a connection.

func NewDecoder

func NewDecoder(r DecodeReader) *Decoder

NewDecoder returns a new decoder that reads from the io.Reader.

func (*Decoder) Decode

func (d *Decoder) Decode(m proto.Message) (err error)

Decode reads the next value from the input stream and stores it in the data represented by the empty interface value. If m is nil, the value will be discarded. Otherwise, the value underlying m must be a pointer to the correct type for the next data item received.

type Encoder

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

An Encoder manages the transmission of type and data information to the other side of a connection.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new encoder that will transmit on the io.Writer.

func (*Encoder) Encode

func (e *Encoder) Encode(m proto.Message) (err error)

Encode transmits the data item represented by the empty interface value, guaranteeing that all necessary type information has been transmitted first.

Directories

Path Synopsis
Package internal is a generated protocol buffer package.
Package internal is a generated protocol buffer package.
Package wirepb is a generated protocol buffer package.
Package wirepb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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