Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { CallRPC(ctx context.Context, result interface{}, method string, params ...interface{}) error SyncRequest(ctx context.Context, rpcReq *RPCRequest) (rpcRes *RPCResponse, err error) }
Backend performs communication with a backend
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
func (*RPCClient) SyncRequest ¶
func (rc *RPCClient) SyncRequest(ctx context.Context, rpcReq *RPCRequest) (rpcRes *RPCResponse, err error)
SyncRequest sends an individual RPC request to the backend (always over HTTP currently), and waits synchronously for the response, or an error.
In all return paths *including error paths* the RPCResponse is populated so the caller has an RPC structure to send back to the front-end caller.
type RPCRequest ¶
type RPCResponse ¶
type RPCResponse struct { JSONRpc string `json:"jsonrpc"` ID *fftypes.JSONAny `json:"id"` Result *fftypes.JSONAny `json:"result,omitempty"` Error *RPCError `json:"error,omitempty"` }
func RPCErrorResponse ¶
func RPCErrorResponse(err error, id *fftypes.JSONAny, code RPCCode) *RPCResponse
func (*RPCResponse) Message ¶
func (r *RPCResponse) Message() string
Click to show internal directories.
Click to hide internal directories.