Documentation ¶
Index ¶
- Variables
- func BatchRequest(size int) []jsonrpc.Request
- func CheckTableExistence(dbName, tableName string, db *sql.DB) error
- func ErrorResponse(id interface{}) jsonrpc.Response
- func MockBindings(logger logrus.FieldLogger, maxAttemptsUntilConfirmed int) *binding.Callbacks
- func MockBurnParamSubmitTxV0BTC() v0.ParamsSubmitTx
- func MockEngineState() map[string]engine.XState
- func MockParamSubmitTxV0BCH() v0.ParamsSubmitTx
- func MockParamSubmitTxV0BTC() v0.ParamsSubmitTx
- func MockParamSubmitTxV0ZEC() v0.ParamsSubmitTx
- func MockParamsSubmitGatewayFil() resolver.ParamsSubmitGateway
- func MockQueryBlockStateResponse() jsonrpc.ResponseQueryBlockState
- func MockQueryTxResponse() jsonrpc.ResponseQueryTx
- func MockSystemState() engine.SystemState
- func NewInspector(cap int) (phi.Task, <-chan phi.Message)
- func NewMockCacher() phi.Task
- func NewMockDispatcher(fail bool) phi.Task
- func NumOfDataEntries(db *sql.DB, name string) (int, error)
- func RandomMethod() string
- func RandomRequest(method string) jsonrpc.Request
- func RandomResponse(good bool, result []byte) jsonrpc.Response
- func RandomSubmitTxParams() jsonrpc.ParamsSubmitTx
- func SendRequestAsync(req jsonrpc.Request, to string) (chan *jsonrpc.Response, error)
- func SimpleHandler(alwaysSuccess bool, requests chan jsonrpc.Request) http.HandlerFunc
- func TimeoutHandler(timeout time.Duration) http.HandlerFunc
- func UpdateTxCreatedTime(db *sql.DB, name string, txHash id.Hash, createdTime int64) error
- func ValidRequest(method string) (id interface{}, params interface{})
- type ChanWriter
- type Inspector
- type MockCacher
- type MockDarknode
- type MockDispatcher
- type MockSender
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BatchRequest ¶
func CheckTableExistence ¶
CheckTableExistence checks the underlying `db` object if there exists a table with given name.
func ErrorResponse ¶
ErrorResponse constructs a basic valid `jsonrpc.Response` that contains a simple error message.
func MockBindings ¶
func MockBindings(logger logrus.FieldLogger, maxAttemptsUntilConfirmed int) *binding.Callbacks
func MockBurnParamSubmitTxV0BTC ¶
func MockBurnParamSubmitTxV0BTC() v0.ParamsSubmitTx
func MockEngineState ¶
func MockParamSubmitTxV0BCH ¶
func MockParamSubmitTxV0BCH() v0.ParamsSubmitTx
func MockParamSubmitTxV0BTC ¶
func MockParamSubmitTxV0BTC() v0.ParamsSubmitTx
func MockParamSubmitTxV0ZEC ¶
func MockParamSubmitTxV0ZEC() v0.ParamsSubmitTx
func MockParamsSubmitGatewayFil ¶
func MockParamsSubmitGatewayFil() resolver.ParamsSubmitGateway
func MockQueryBlockStateResponse ¶
func MockQueryBlockStateResponse() jsonrpc.ResponseQueryBlockState
func MockQueryTxResponse ¶
func MockQueryTxResponse() jsonrpc.ResponseQueryTx
func MockSystemState ¶
func MockSystemState() engine.SystemState
func NewInspector ¶
NewInspector constructs a new `Inspector` task.
func NewMockCacher ¶
func NewMockDispatcher ¶
func NumOfDataEntries ¶
NumOfDataEntries returns the number of data entries in the queried table.
func RandomMethod ¶
func RandomMethod() string
func RandomRequest ¶
func RandomSubmitTxParams ¶
func RandomSubmitTxParams() jsonrpc.ParamsSubmitTx
func SendRequestAsync ¶
SendRequestAsync send the request to the target address. It returns a chan of jsonrpc.Response without any blocking, actual response(or error) will be sent to the channel while received.
func SimpleHandler ¶
func SimpleHandler(alwaysSuccess bool, requests chan jsonrpc.Request) http.HandlerFunc
func TimeoutHandler ¶
func TimeoutHandler(timeout time.Duration) http.HandlerFunc
TimeoutHandler returns a simple `http.HandlerFunc` which sleeps a certain amount of time before responding.
func UpdateTxCreatedTime ¶
UpdateTxCreatedTime of given tx hash.
func ValidRequest ¶
func ValidRequest(method string) (id interface{}, params interface{})
ValidRequest constructs a basic but valid `jsonrpc.Request` of the given method.
Types ¶
type ChanWriter ¶
type ChanWriter struct {
// contains filtered or unexported fields
}
ChanWriter is a io.Writer which writes all messages to an output channel.
func NewChanWriter ¶
func NewChanWriter() (ChanWriter, chan string)
NewChanWriter returns a new ChanWriter and the output channel.
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
An Inspector is a mock task that will simply write all of its received messages out on to a channel for inspection.
type MockCacher ¶
type MockCacher struct { }
type MockDarknode ¶
type MockDarknode struct { Me wire.Address Store store.MultiAddrStore }
func NewMockDarknode ¶
func NewMockDarknode(serverURL string, store store.MultiAddrStore) *MockDarknode
type MockDispatcher ¶
type MockDispatcher struct {
Fail bool
}
type MockSender ¶
func NewMockSender ¶
func NewMockSender() *MockSender