Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRequestTimeout is returned when request timeout-ed. ErrRequestTimeout = errors.New("timeout-ed request") // ErrMethodExists is returned when method is already registered. ErrMethodExists = errors.New("method exists already") // ErrInvalidRequestChan is returned method is bound to nil chan. ErrInvalidRequestChan = errors.New("invalid request channel") // DefaultTimeout is used when 0 timeout is set on calling a method. DefaultTimeout = 5 * time.Second )
Functions ¶
This section is empty.
Types ¶
type ErrMethodNotExists ¶
type ErrMethodNotExists struct {
// contains filtered or unexported fields
}
ErrMethodNotExists is returned when calling an unregistered method.
func (*ErrMethodNotExists) Error ¶ added in v0.4.0
func (e *ErrMethodNotExists) Error() string
Error obeys the error interface.
type RPCBus ¶
type RPCBus struct {
// contains filtered or unexported fields
}
RPCBus is a request–response mechanism for internal communication between node components/subsystems. Under the hood this is long-polling method based on "chan chan" technique.
func (*RPCBus) Call ¶
Call runs a long-polling technique to request from the method Consumer to run the corresponding procedure and return a result or timeout.
func (*RPCBus) Deregister ¶ added in v0.4.0
Deregister removes a handler channel from a method.
type Request ¶
type Request struct { Params interface{} RespChan chan Response }
Request is the request object forwarded to the RPC endpoint.
func EmptyRequest ¶ added in v0.3.0
func EmptyRequest() Request
EmptyRequest returns a Request instance with no parameters.
func NewRequest ¶
func NewRequest(p interface{}) Request
NewRequest builds a new request with params. It creates the response channel under the hood.