Documentation ¶
Index ¶
- Variables
- func Bool2int(b bool) int
- type ChainBridge
- func (c *ChainBridge) Command(command string, payload []byte) (CommandResponse, error)
- func (c *ChainBridge) DataUnmarshal(response CommandResponse, v interface{}) error
- func (c *ChainBridge) GetDataBool(response CommandResponse) (bool, error)
- func (c *ChainBridge) GetDataBytes(response CommandResponse) ([]byte, error)
- func (c *ChainBridge) GetDataUInt(response CommandResponse) (uint64, error)
- func (c *ChainBridge) SetErrorHandler(handler func(error))
- func (c *ChainBridge) SetLogHandler(handler func(string))
- func (c *ChainBridge) Start() error
- func (c *ChainBridge) Stop() error
- type CommandRequest
- type CommandResponse
- type Node
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoData is the error returned when attempting to convert data from a command response with no data // Use this to test if requested appchain state is undefined ErrNoData = errors.New("ChainBridge: no data") // command response errors returned by the appchain Err_nodes_alreadyRegistered = "Node already registered" )
View Source
var ( Cmd_nodes_getNode = "nodes getNode %s" Cmd_nodes_register = "nodes register %s %d %d" Cmd_pki_getDocucment = "pki getDocument %d" Cmd_pki_getGenesisEpoch = "pki getGenesisEpoch" Cmd_pki_getMixDescriptor = "pki getMixDescriptor %d %s" Cmd_pki_getMixDescriptorByIndex = "pki getMixDescriptorByIndex %d %d" Cmd_pki_getMixDescriptorCounter = "pki getMixDescriptorCounter %d" Cmd_pki_setDocument = "pki setDocument %d" Cmd_pki_setMixDescriptor = "pki setMixDescriptor %d %s" )
appchain-agent commands; cuz compile errors are better than runtime errors
Functions ¶
Types ¶
type ChainBridge ¶
type ChainBridge struct {
// contains filtered or unexported fields
}
func NewChainBridge ¶
func NewChainBridge(socketFileOrCommandName string, commandArgs ...string) *ChainBridge
Initialize a ChainBridge instance. Accepts either: - a socket path or - a command with its arguments to launch the process.
func (*ChainBridge) Command ¶
func (c *ChainBridge) Command(command string, payload []byte) (CommandResponse, error)
func (*ChainBridge) DataUnmarshal ¶
func (c *ChainBridge) DataUnmarshal(response CommandResponse, v interface{}) error
func (*ChainBridge) GetDataBool ¶
func (c *ChainBridge) GetDataBool(response CommandResponse) (bool, error)
func (*ChainBridge) GetDataBytes ¶
func (c *ChainBridge) GetDataBytes(response CommandResponse) ([]byte, error)
func (*ChainBridge) GetDataUInt ¶
func (c *ChainBridge) GetDataUInt(response CommandResponse) (uint64, error)
func (*ChainBridge) SetErrorHandler ¶
func (c *ChainBridge) SetErrorHandler(handler func(error))
Set a custom error handler to be called when an error occurs.
func (*ChainBridge) SetLogHandler ¶
func (c *ChainBridge) SetLogHandler(handler func(string))
Set a custom log handler to be called for non-error logs.
func (*ChainBridge) Start ¶
func (c *ChainBridge) Start() error
Start the ChainBridge either by: - connecting to the existing socket path or - executing the provided command, then connecting to the socket path printed in its stdout.
func (*ChainBridge) Stop ¶
func (c *ChainBridge) Stop() error
type CommandRequest ¶
type CommandResponse ¶
Click to show internal directories.
Click to hide internal directories.