Help us shape the future of Go! Take the 2026 Go Developer Survey

gosr

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: MIT Imports: 5 Imported by: 0

README

gosr

a simple frame of send and receive on conn for golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call added in v0.0.2

type Call struct {
	ServiceMethod interface{}
	Args          interface{} // The argument to the function (*struct).
	Reply         interface{} // The reply from the function (*struct).
	Error         error       // After completion, the error status.
	Done          chan *Call  // Strobes when call is complete.
	Context       interface{}
	// contains filtered or unexported fields
}

Call represents an active RPC.

type Client

type Client interface {
	Close() error
	Go(serviceMethod, args interface{}, reply interface{}, done chan *Call) *Call
	Call(serviceMethod, args interface{}, reply interface{}) error
	Wait()
}

Client ...

func NewClientWithCodec added in v0.0.2

func NewClientWithCodec(codec ClientCodec) Client

NewClientWithCodec is like NewClient but uses the specified codec to encode requests and decode responses.

type ClientCodec added in v0.0.2

type ClientCodec interface {
	GetSeq(req *Request) (seq interface{})
	WriteRequest(req *Request, args interface{}) error
	ReadResponseHeader(*Response) error
	ReadResponseBody(resp *Response, reply interface{}) error
	Close() error
}

A ClientCodec implements writing of RPC requests and reading of RPC responses for the p side of an RPC session. The p calls WriteRequest to write a request to the connection and calls ReadResponseHeader and ReadResponseBody in pairs to read responses. The p 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. See NewClient's comment for information about concurrent access.

type Error

type Error error

Error ...

var (
	// ErrClosed ...
	ErrClosed Error = fmt.Errorf("[gosr] closed")
)

func Errof

func Errof(format string, args ...interface{}) Error

Errof ...

type Request added in v0.0.2

type Request struct {
	Seq           interface{}
	ServiceMethod interface{}
	Context       interface{}
}

Request ...

type Response added in v0.0.2

type Response struct {
	Seq           interface{}
	ServiceMethod interface{}
	Error         error
	Context       interface{}
}

Response ...

Jump to

Keyboard shortcuts

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