semirpc

package
v0.0.0-...-3d20607 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EClosed = errors.New("Connection Closed")
View Source
var EPipelineStall = errors.New("Pipeline-Stall")

Functions

This section is empty.

Types

type ARClient

type ARClient struct {
	Addr   string
	Dial   Dialer
	MkResp func() Response
	// contains filtered or unexported fields
}

Auto-Reconnect-Client

func (*ARClient) Close

func (c *ARClient) Close() (err error)

func (*ARClient) Do

func (c *ARClient) Do(req Request, resp Response) error

func (*ARClient) DoAsyncSupport

func (c *ARClient) DoAsyncSupport(req Request, resp Response, errch chan error)

func (*ARClient) DoTimeout

func (c *ARClient) DoTimeout(req Request, resp Response, timeout <-chan time.Time) error

type Client

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

func NewClient

func NewClient(client ClientCodec, respmk func() Response) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Do

func (c *Client) Do(req Request, resp Response) error

func (*Client) DoAsyncSupport

func (c *Client) DoAsyncSupport(req Request, resp Response, errch chan error)

func (*Client) DoTimeout

func (c *Client) DoTimeout(req Request, resp Response, timeout <-chan time.Time) error

type ClientCodec

type ClientCodec interface {
	Close() error

	// Threadsafe
	Send(id uint64, r Request) error

	// Not threadsafe
	RecvId() (uint64, error)
	Recv(r Response) error
}

type Dialer

type Dialer func(addr string) (ClientCodec, error)

type ErrorHandler

type ErrorHandler func(e ServerError, req Request, resp Response)

type Request

type Request interface {
	ReadReq(r *bufio.Reader) error
	WriteReq(w *bufio.Writer) error
}

type Response

type Response interface {
	ReadResp(r *bufio.Reader) error
	WriteResp(w *bufio.Writer) error
}

type Server

type Server struct {
	Handle      ServerHandler
	Error       ErrorHandler
	Allocator   func() (req Request, resp Response)
	Concurrency int
	QueueMulti  int
	// contains filtered or unexported fields
}

func (*Server) Serve

func (s *Server) Serve(sc ServerCodec) error

type ServerCodec

type ServerCodec interface {
	Close() error

	// Threadsafe
	Send(id uint64, r Response) error

	// Not threadsafe
	RecvId() (uint64, error)
	Recv(r Request) error
}

type ServerError

type ServerError int
const (
	SE_None ServerError = iota
	SE_QueueOverflow
)

func (ServerError) Error

func (s ServerError) Error() string

type ServerHandler

type ServerHandler func(req Request, resp Response)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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