callback

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package callback implements a facilities for listening to asynchronous test responses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(typ string, listener Listener) (err error)

Register register listeners for callback async responses

Types

type Config

type Config struct {
	Type   string `json:"type" yaml:"type"`
	Script string `json:"script" yaml:"script"`
}

Config configuration for receiving async transaction responses

type Handle

type Handle struct {
	UUID     string
	Address  string
	Response <-chan Response
}

Handle is a registered async response handle

type Listener

type Listener interface {
	Listen(ctx context.Context) (handle *Handle, err error)
}

Listener listen for async transaction responses. Listeners must be safe for concurrent usage.

func GetListener

func GetListener(typ string) (listener Listener, err error)

GetListener gets an previously registered handler

type Response

type Response struct {
	Data  []byte
	Error error
}

Response from an async call

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL