Documentation
¶
Index ¶
- Variables
- func ContextRequestTimeout(ctx context.Context) (time.Duration, bool)
- type Callback
- type Client
- func (c *Client) Call(result interface{}, method string, notifyAll bool, ...) error
- func (c *Client) CallContext(ctx context.Context, result interface{}, method string, notifyAll bool, ...) error
- func (c *Client) Close()
- func (c *Client) Notify(ctx context.Context, method string, notifyAll bool, ...) error
- func (c *Client) Ping(message string) error
- type JsonRPCMessage
- func (msg *JsonRPCMessage) ErrorResponse(err error) *JsonRPCMessage
- func (msg *JsonRPCMessage) HasValidID() bool
- func (msg *JsonRPCMessage) HasValidVersion() bool
- func (msg *JsonRPCMessage) IsCall() bool
- func (msg *JsonRPCMessage) IsNotification() bool
- func (msg *JsonRPCMessage) IsResponse() bool
- func (msg *JsonRPCMessage) MethodName() string
- func (msg *JsonRPCMessage) Namespace() string
- func (msg *JsonRPCMessage) Response(result interface{}) *JsonRPCMessage
- func (msg *JsonRPCMessage) String() string
- type Module
- type ModuleCommChannels
- type ModuleRegistry
- func (r *ModuleRegistry) ModuleNames() []string
- func (r *ModuleRegistry) Modules() []Module
- func (r *ModuleRegistry) RegisterName(name string, rcvr Service) error
- func (r *ModuleRegistry) StartModuleServices() (started []string, err error)
- func (r *ModuleRegistry) StopModuleServices() (stopped []string, err error)
- type Service
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadResult = errors.New("bad result in JSON-RPC response") ErrClientQuit = errors.New("client is closed") ErrNoResult = errors.New("JSON-RPC response has no result") )
var ParkedCallbacks map[string]bool = map[string]bool{ "start": true, "stop": true, "connectCore": true, "configure": true, "cliCommand": true, }
Should not be accessible over communication channels
Functions ¶
Types ¶
type Callback ¶
type Callback struct {
// contains filtered or unexported fields
}
callback is a method callback which was registered in the core
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Call ¶
func (c *Client) Call(result interface{}, method string, notifyAll bool, notificationExclusion []string, args ...interface{}) error
Call performs a JSON-RPC call with the given arguments and unmarshals into result if no error occurred.
The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.
func (*Client) CallContext ¶
func (c *Client) CallContext(ctx context.Context, result interface{}, method string, notifyAll bool, notificationExclusion []string, args ...interface{}) error
CallContext performs a JSON-RPC call with the given arguments. If the context is canceled before the call has successfully returned, CallContext returns immediately.
The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.
func (*Client) Close ¶
func (c *Client) Close()
Close closes the client, aborting any in-flight requests.
type JsonRPCMessage ¶
type JsonRPCMessage struct {
Version string `json:"jsonrpc,omitempty"`
ID json.RawMessage `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Error *jsonError `json:"error,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
NotifyAll bool `json:"notifyAll"`
NotifyExclusion []string `json:"notifyExclusion,omitempty"`
Origin string `json:"origin,omitempty"`
}
func ErrorMessage ¶
func ErrorMessage(err error) *JsonRPCMessage
func (*JsonRPCMessage) ErrorResponse ¶
func (msg *JsonRPCMessage) ErrorResponse(err error) *JsonRPCMessage
func (*JsonRPCMessage) HasValidID ¶
func (msg *JsonRPCMessage) HasValidID() bool
func (*JsonRPCMessage) HasValidVersion ¶
func (msg *JsonRPCMessage) HasValidVersion() bool
func (*JsonRPCMessage) IsCall ¶
func (msg *JsonRPCMessage) IsCall() bool
func (*JsonRPCMessage) IsNotification ¶
func (msg *JsonRPCMessage) IsNotification() bool
func (*JsonRPCMessage) IsResponse ¶
func (msg *JsonRPCMessage) IsResponse() bool
func (*JsonRPCMessage) MethodName ¶
func (msg *JsonRPCMessage) MethodName() string
func (*JsonRPCMessage) Namespace ¶
func (msg *JsonRPCMessage) Namespace() string
func (*JsonRPCMessage) Response ¶
func (msg *JsonRPCMessage) Response(result interface{}) *JsonRPCMessage
func (*JsonRPCMessage) String ¶
func (msg *JsonRPCMessage) String() string
type ModuleCommChannels ¶
type ModuleCommChannels struct {
Incoming chan JsonRPCMessage
Outgoing chan JsonRPCMessage
}
type ModuleRegistry ¶
type ModuleRegistry struct {
// contains filtered or unexported fields
}
func (*ModuleRegistry) ModuleNames ¶
func (r *ModuleRegistry) ModuleNames() []string
func (*ModuleRegistry) Modules ¶
func (r *ModuleRegistry) Modules() []Module
func (*ModuleRegistry) RegisterName ¶
func (r *ModuleRegistry) RegisterName(name string, rcvr Service) error
func (*ModuleRegistry) StartModuleServices ¶
func (r *ModuleRegistry) StartModuleServices() (started []string, err error)
func (*ModuleRegistry) StopModuleServices ¶
func (r *ModuleRegistry) StopModuleServices() (stopped []string, err error)
type Service ¶
type Service interface {
// Any attached service must implement these method.
Name() string
Start() error
Stop() error
ConnectCore(coreClient *Client, pingId string) error
Configure(moduleFlags common.ModuleFlags) error
CliCommand() *cli.Command // Returns the cli command for the service in order for MEV Plus to parse the flags
}
Service represents a service that meets the requirements of the MEV Plus application