Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Dispatcher
- type Edge
- type ErrorResponse
- type GetResponse
- type JSONRPC
- type JSONRPCStore
- type NodeFilterManager
- func (f *NodeFilterManager) Close()
- func (f *NodeFilterManager) Exists(id string) bool
- func (f *NodeFilterManager) GetFilterChanges(id string) (interface{}, error)
- func (f *NodeFilterManager) NewNodeFilter(nodeQuery *NodeQuery, ws wsConn) string
- func (f *NodeFilterManager) RemoveFilterByWs(ws wsConn)
- func (f *NodeFilterManager) Run()
- func (f *NodeFilterManager) Uninstall(id string) bool
- type NodeQuery
- type ObjectError
- type Request
- type Response
- type SuccessResponse
Constants ¶
const (
// The index in heap which is indicating the element is not in the heap
NoIndexInHeap = -1
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher handles all json rpc requests by delegating the execution flow to the corresponding service
func (*Dispatcher) HandleWs ¶
func (d *Dispatcher) HandleWs(reqBody []byte, conn wsConn) ([]byte, error)
func (*Dispatcher) RemoveFilterByWs ¶
func (d *Dispatcher) RemoveFilterByWs(conn wsConn)
type Edge ¶
type Edge struct {
// contains filtered or unexported fields
}
Edge is the edge jsonrpc endpoint
func (*Edge) GetFilterChanges ¶
GetFilterChanges is a polling method for a filter, which returns an array of logs which occurred since last poll.
func (*Edge) SendRawTelegram ¶
SendRawTelegram sends a raw telegram
func (*Edge) UninstallFilter ¶
UninstallFilter uninstalls a filter with given ID
type ErrorResponse ¶
type ErrorResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Error *ObjectError `json:"error"`
}
ErrorResponse is a jsonrpc error response
func (*ErrorResponse) Bytes ¶
func (e *ErrorResponse) Bytes() ([]byte, error)
Bytes return the serialized response
func (*ErrorResponse) Data ¶
func (e *ErrorResponse) Data() json.RawMessage
Data returns ObjectError
func (*ErrorResponse) GetID ¶
func (e *ErrorResponse) GetID() interface{}
GetID returns error response id
type GetResponse ¶
type JSONRPC ¶
type JSONRPC struct {
// contains filtered or unexported fields
}
JSONRPC is an API consensus
type JSONRPCStore ¶
type JSONRPCStore interface {
// contains filtered or unexported methods
}
JSONRPCStore defines all the methods required by all the JSON RPC endpoints
type NodeFilterManager ¶
NodeFilterManager manages all running node filters
func NewNodeFilterManager ¶
func NewNodeFilterManager(logger hclog.Logger, store nodeFilterManagerStore) *NodeFilterManager
func (*NodeFilterManager) Close ¶
func (f *NodeFilterManager) Close()
Close closed closeCh so that terminate worker
func (*NodeFilterManager) Exists ¶
func (f *NodeFilterManager) Exists(id string) bool
Exists checks the filter with given ID exists
func (*NodeFilterManager) GetFilterChanges ¶
func (f *NodeFilterManager) GetFilterChanges(id string) (interface{}, error)
GetFilterChanges returns the updates of the filter with given ID in string, and refreshes the timeout on the filter
func (*NodeFilterManager) NewNodeFilter ¶
func (f *NodeFilterManager) NewNodeFilter(nodeQuery *NodeQuery, ws wsConn) string
NewRtcFilter adds new RtcFilter
func (*NodeFilterManager) RemoveFilterByWs ¶
func (f *NodeFilterManager) RemoveFilterByWs(ws wsConn)
RemoveFilterByWs removes the filter with given WS [Thread safe]
func (*NodeFilterManager) Run ¶
func (f *NodeFilterManager) Run()
Run starts worker process to handle events
func (*NodeFilterManager) Uninstall ¶
func (f *NodeFilterManager) Uninstall(id string) bool
Uninstall removes the filter with given ID from list
type NodeQuery ¶
type NodeQuery struct {
Name string `json:"name"`
Tag string `json:"tag"`
Id string `json:"id"`
Version string `json:"version"`
}
NodeQuery is a query to filter node
func (*NodeQuery) Match ¶
func (q *NodeQuery) Match(rm *application.Application) bool
type ObjectError ¶
type ObjectError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
ObjectError is a jsonrpc error
type Request ¶
type Request struct {
ID interface{} `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Request is a jsonrpc request
type Response ¶
type Response interface {
GetID() interface{}
Data() json.RawMessage
Bytes() ([]byte, error)
}
Response is a jsonrpc response interface
func NewRPCErrorResponse ¶
NewRPCErrorResponse is used to create a custom error response
type SuccessResponse ¶
type SuccessResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id"`
Result json.RawMessage `json:"result"`
Error *ObjectError `json:"error,omitempty"`
}
SuccessResponse is a jsonrpc success response
func (*SuccessResponse) Bytes ¶
func (s *SuccessResponse) Bytes() ([]byte, error)
Bytes return the serialized response
func (*SuccessResponse) Data ¶
func (s *SuccessResponse) Data() json.RawMessage
Data returns the result
func (*SuccessResponse) GetID ¶
func (s *SuccessResponse) GetID() interface{}
GetID returns success response id