Documentation ¶
Index ¶
- Variables
- func CloseVMAPI()
- func GetVMAPI() *interfaces.ApplyClient
- func InitVMAPI()
- func IsInApply() bool
- func N2S(value uint64) string
- func NewProtocol(addr string) (thrift.TProtocol, thrift.TProtocol, error)
- func NewVMAPIClient(addr string) (*interfaces.ApplyClient, error)
- func SetApplyRequestServerAddress(addr string)
- func SetApplyRequestServerPort(port string)
- func SetDebuggerServerAddress(addr string)
- func SetDebuggerServerPort(port string)
- func SetInApply(inApply bool)
- func SetVMAPIServerAddress(addr string)
- func SetVMAPIServerPort(port string)
- type ActionArguments
- type ActionSender
- func (sender *ActionSender) AddAction(account string, action string, args string, permissions string)
- func (sender *ActionSender) AddActionEx(account string, action string, rawArgs []byte, permissions string)
- func (sender *ActionSender) AddActionWithSigner(account string, action string, jsonArgs string, signer string)
- func (sender *ActionSender) AddActionWithSignerEx(account string, action string, rawArgs []byte, signer string)
- func (sender *ActionSender) Send() (*JsonValue, error)
- type ApplyRequestHandler
- type ApplyRequestServer
- type AssertError
- type ChainTester
- func (p *ChainTester) Call(ctx context.Context, method string, args, result thrift.TStruct) (thrift.ResponseMeta, error)
- func (p *ChainTester) CreateAccount(creator string, account string, owner_key string, active_key string, ...) (*JsonValue, error)
- func (p *ChainTester) CreateKey(keyType ...string) (*JsonValue, error)
- func (p *ChainTester) DeployContract(account string, wasmFile string, abiFile string) (err error)
- func (p *ChainTester) EnableDebugContract(contract string, enable bool) error
- func (p *ChainTester) FreeChain() (int32, error)
- func (p *ChainTester) GetAccount(account string) (*JsonValue, error)
- func (tester *ChainTester) GetBalance(account string, extras ...string) uint64
- func (p *ChainTester) GetInfo() (*JsonValue, error)
- func (p *ChainTester) GetTableRows(_json bool, code string, scope string, table string, lower_bound string, ...) (*JsonValue, error)
- func (p *ChainTester) GetTableRowsEx(_json bool, code string, scope string, table string, lower_bound string, ...) (*JsonValue, error)
- func (p *ChainTester) PackAbi(abi string) ([]byte, error)
- func (p *ChainTester) ProduceBlock(next_block_skip_time ...int64) error
- func (p *ChainTester) PushAction(account string, action string, arguments interface{}, permissions string) (*JsonValue, error)
- func (p *ChainTester) PushActions(actions []*interfaces.Action) (*JsonValue, error)
- func (p *ChainTester) SetNativeApply(contract string, apply func(uint64, uint64, uint64))
- type DebuggerConfig
- type IPCClient
- func (p *IPCClient) Call(ctx context.Context, method string, args, result thrift.TStruct) (thrift.ResponseMeta, error)
- func (p *IPCClient) Recv(ctx context.Context, iprot thrift.TProtocol, seqId int32, method string, ...) error
- func (p *IPCClient) Send(ctx context.Context, oprot thrift.TProtocol, seqId int32, method string, ...) error
- type JsonValue
- func (b *JsonValue) Get(keys ...interface{}) (interface{}, error)
- func (b *JsonValue) GetString(keys ...interface{}) (string, error)
- func (b *JsonValue) GetStringValue() (string, bool)
- func (b *JsonValue) GetTime(keys ...interface{}) (*time.Time, error)
- func (b *JsonValue) GetValue() interface{}
- func (b JsonValue) MarshalJSON() ([]byte, error)
- func (b *JsonValue) SetValue(value interface{}) error
- func (b *JsonValue) ToString() string
- func (b *JsonValue) UnmarshalJSON(data []byte) error
- type SimpleIPCServer
- func NewSimpleIPCServer2(processor thrift.TProcessor, serverTransport thrift.TServerTransport) *SimpleIPCServer
- func NewSimpleIPCServer4(processor thrift.TProcessor, serverTransport thrift.TServerTransport, ...) *SimpleIPCServer
- func NewSimpleIPCServer6(processor thrift.TProcessor, serverTransport thrift.TServerTransport, ...) *SimpleIPCServer
- func NewSimpleIPCServerFactory2(processorFactory thrift.TProcessorFactory, ...) *SimpleIPCServer
- func NewSimpleIPCServerFactory4(processorFactory thrift.TProcessorFactory, ...) *SimpleIPCServer
- func NewSimpleIPCServerFactory6(processorFactory thrift.TProcessorFactory, ...) *SimpleIPCServer
- func (p *SimpleIPCServer) AcceptLoop() error
- func (p *SimpleIPCServer) AcceptOnce() (int32, error)
- func (p *SimpleIPCServer) EndProcessRequests()
- func (p *SimpleIPCServer) InputProtocolFactory() thrift.TProtocolFactory
- func (p *SimpleIPCServer) InputTransportFactory() thrift.TTransportFactory
- func (p *SimpleIPCServer) Listen() error
- func (p *SimpleIPCServer) OutputProtocolFactory() thrift.TProtocolFactory
- func (p *SimpleIPCServer) OutputTransportFactory() thrift.TTransportFactory
- func (p *SimpleIPCServer) ProcessRequests() (int32, error)
- func (p *SimpleIPCServer) ProcessorFactory() thrift.TProcessorFactory
- func (p *SimpleIPCServer) Serve() error
- func (p *SimpleIPCServer) ServerTransport() thrift.TServerTransport
- func (p *SimpleIPCServer) SetForwardHeaders(headers []string)
- func (p *SimpleIPCServer) SetLogger(logger thrift.Logger)
- func (p *SimpleIPCServer) Stop() error
- type TransactionError
Constants ¶
This section is empty.
Variables ¶
var DEBUG = true
var ErrAbandonRequest = errors.New("request abandoned")
ErrAbandonRequest is a special error server handler implementations can return to indicate that the request has been abandoned.
SimpleIPCServer will check for this error, and close the client connection instead of writing the response/error back to the client.
It shall only be used when the server handler implementation know that the client already abandoned the request (by checking that the passed in context is already canceled, for example).
var ServerConnectivityCheckInterval = time.Millisecond * 5
ServerConnectivityCheckInterval defines the ticker interval used by connectivity check in thrift compiled TProcessorFunc implementations.
It's defined as a variable instead of constant, so that thrift server implementations can change its value to control the behavior.
If it's changed to <=0, the feature will be disabled.
Functions ¶
func CloseVMAPI ¶
func CloseVMAPI()
func GetVMAPI ¶
func GetVMAPI() *interfaces.ApplyClient
func NewVMAPIClient ¶
func NewVMAPIClient(addr string) (*interfaces.ApplyClient, error)
func SetApplyRequestServerAddress ¶
func SetApplyRequestServerAddress(addr string)
func SetApplyRequestServerPort ¶
func SetApplyRequestServerPort(port string)
func SetDebuggerServerAddress ¶
func SetDebuggerServerAddress(addr string)
func SetDebuggerServerPort ¶
func SetDebuggerServerPort(port string)
func SetInApply ¶
func SetInApply(inApply bool)
func SetVMAPIServerAddress ¶
func SetVMAPIServerAddress(addr string)
func SetVMAPIServerPort ¶
func SetVMAPIServerPort(port string)
Types ¶
type ActionArguments ¶
type ActionArguments interfaces.ActionArguments
type ActionSender ¶
type ActionSender struct {
// contains filtered or unexported fields
}
func NewActionSender ¶
func NewActionSender(tester *ChainTester) *ActionSender
func (*ActionSender) AddAction ¶
func (sender *ActionSender) AddAction(account string, action string, args string, permissions string)
func (*ActionSender) AddActionEx ¶
func (sender *ActionSender) AddActionEx(account string, action string, rawArgs []byte, permissions string)
func (*ActionSender) AddActionWithSigner ¶
func (sender *ActionSender) AddActionWithSigner(account string, action string, jsonArgs string, signer string)
func (*ActionSender) AddActionWithSignerEx ¶
func (sender *ActionSender) AddActionWithSignerEx(account string, action string, rawArgs []byte, signer string)
func (*ActionSender) Send ¶
func (sender *ActionSender) Send() (*JsonValue, error)
type ApplyRequestHandler ¶
type ApplyRequestHandler struct { }
func NewApplyRequestHandler ¶
func NewApplyRequestHandler() *ApplyRequestHandler
func (*ApplyRequestHandler) ApplyRequest ¶
func (p *ApplyRequestHandler) ApplyRequest(ctx context.Context, receiver *interfaces.Uint64, firstReceiver *interfaces.Uint64, action *interfaces.Uint64, chainTesterId int32) (_r int32, _err error)
type ApplyRequestServer ¶
type ApplyRequestServer struct {
// contains filtered or unexported fields
}
func GetApplyRequestServer ¶
func GetApplyRequestServer() *ApplyRequestServer
func NewApplyRequestServer ¶
func NewApplyRequestServer() *ApplyRequestServer
func (*ApplyRequestServer) AcceptOnce ¶
func (server *ApplyRequestServer) AcceptOnce() (int32, error)
func (*ApplyRequestServer) Serve ¶
func (server *ApplyRequestServer) Serve() (int32, error)
func (*ApplyRequestServer) Stop ¶
func (server *ApplyRequestServer) Stop() error
type AssertError ¶
type AssertError struct {
Err error
}
func NewAssertError ¶
func NewAssertError(err error) *AssertError
func (*AssertError) Error ¶
func (err *AssertError) Error() string
type ChainTester ¶
type ChainTester struct { interfaces.IPCChainTesterClient // contains filtered or unexported fields }
func NewChainTester ¶
func NewChainTester() *ChainTester
func (*ChainTester) Call ¶
func (p *ChainTester) Call(ctx context.Context, method string, args, result thrift.TStruct) (thrift.ResponseMeta, error)
func (*ChainTester) CreateAccount ¶
func (*ChainTester) CreateKey ¶
func (p *ChainTester) CreateKey(keyType ...string) (*JsonValue, error)
func (*ChainTester) DeployContract ¶
func (p *ChainTester) DeployContract(account string, wasmFile string, abiFile string) (err error)
func (*ChainTester) EnableDebugContract ¶
func (p *ChainTester) EnableDebugContract(contract string, enable bool) error
func (*ChainTester) FreeChain ¶
func (p *ChainTester) FreeChain() (int32, error)
func (*ChainTester) GetAccount ¶
func (p *ChainTester) GetAccount(account string) (*JsonValue, error)
func (*ChainTester) GetBalance ¶
func (tester *ChainTester) GetBalance(account string, extras ...string) uint64
func (*ChainTester) GetInfo ¶
func (p *ChainTester) GetInfo() (*JsonValue, error)
func (*ChainTester) GetTableRows ¶
func (*ChainTester) GetTableRowsEx ¶
func (*ChainTester) ProduceBlock ¶
func (p *ChainTester) ProduceBlock(next_block_skip_time ...int64) error
func (*ChainTester) PushAction ¶
func (*ChainTester) PushActions ¶
func (p *ChainTester) PushActions(actions []*interfaces.Action) (*JsonValue, error)
func (*ChainTester) SetNativeApply ¶
func (p *ChainTester) SetNativeApply(contract string, apply func(uint64, uint64, uint64))
type DebuggerConfig ¶
type DebuggerConfig struct { DebuggerServerAddress string DebuggerServerPort string VMAPIServerAddress string VMAPIServerPort string ApplyRequestServerAddress string ApplyRequestServerPort string }
func GetDebuggerConfig ¶
func GetDebuggerConfig() *DebuggerConfig
type IPCClient ¶
type IPCClient struct {
// contains filtered or unexported fields
}
func GetIPCClient ¶
func GetIPCClient() *IPCClient
func NewIPCClient ¶
IPCClient implements TClient, and uses the standard message format for Thrift. It is not safe for concurrent use.
type JsonValue ¶
type JsonValue struct {
// contains filtered or unexported fields
}
func NewJsonValue ¶
func (*JsonValue) GetStringValue ¶
func (JsonValue) MarshalJSON ¶
func (*JsonValue) UnmarshalJSON ¶
type SimpleIPCServer ¶
type SimpleIPCServer struct {
// contains filtered or unexported fields
}
* This is not a typical SimpleIPCServer as it is not blocked after accept a socket. * It is more like a TThreadedServer that can handle different connections in different goroutines. * This will work if golang user implements a conn-pool like thing in client side.
func NewSimpleIPCServer2 ¶
func NewSimpleIPCServer2(processor thrift.TProcessor, serverTransport thrift.TServerTransport) *SimpleIPCServer
func NewSimpleIPCServer4 ¶
func NewSimpleIPCServer4(processor thrift.TProcessor, serverTransport thrift.TServerTransport, transportFactory thrift.TTransportFactory, protocolFactory thrift.TProtocolFactory) *SimpleIPCServer
func NewSimpleIPCServer6 ¶
func NewSimpleIPCServer6(processor thrift.TProcessor, serverTransport thrift.TServerTransport, inputTransportFactory thrift.TTransportFactory, outputTransportFactory thrift.TTransportFactory, inputProtocolFactory thrift.TProtocolFactory, outputProtocolFactory thrift.TProtocolFactory) *SimpleIPCServer
func NewSimpleIPCServerFactory2 ¶
func NewSimpleIPCServerFactory2(processorFactory thrift.TProcessorFactory, serverTransport thrift.TServerTransport) *SimpleIPCServer
func NewSimpleIPCServerFactory4 ¶
func NewSimpleIPCServerFactory4(processorFactory thrift.TProcessorFactory, serverTransport thrift.TServerTransport, transportFactory thrift.TTransportFactory, protocolFactory thrift.TProtocolFactory) *SimpleIPCServer
func NewSimpleIPCServerFactory6 ¶
func NewSimpleIPCServerFactory6(processorFactory thrift.TProcessorFactory, serverTransport thrift.TServerTransport, inputTransportFactory thrift.TTransportFactory, outputTransportFactory thrift.TTransportFactory, inputProtocolFactory thrift.TProtocolFactory, outputProtocolFactory thrift.TProtocolFactory) *SimpleIPCServer
func (*SimpleIPCServer) AcceptLoop ¶
func (p *SimpleIPCServer) AcceptLoop() error
func (*SimpleIPCServer) AcceptOnce ¶
func (p *SimpleIPCServer) AcceptOnce() (int32, error)
func (*SimpleIPCServer) EndProcessRequests ¶
func (p *SimpleIPCServer) EndProcessRequests()
func (*SimpleIPCServer) InputProtocolFactory ¶
func (p *SimpleIPCServer) InputProtocolFactory() thrift.TProtocolFactory
func (*SimpleIPCServer) InputTransportFactory ¶
func (p *SimpleIPCServer) InputTransportFactory() thrift.TTransportFactory
func (*SimpleIPCServer) Listen ¶
func (p *SimpleIPCServer) Listen() error
func (*SimpleIPCServer) OutputProtocolFactory ¶
func (p *SimpleIPCServer) OutputProtocolFactory() thrift.TProtocolFactory
func (*SimpleIPCServer) OutputTransportFactory ¶
func (p *SimpleIPCServer) OutputTransportFactory() thrift.TTransportFactory
func (*SimpleIPCServer) ProcessRequests ¶
func (p *SimpleIPCServer) ProcessRequests() (int32, error)
func (*SimpleIPCServer) ProcessorFactory ¶
func (p *SimpleIPCServer) ProcessorFactory() thrift.TProcessorFactory
func (*SimpleIPCServer) Serve ¶
func (p *SimpleIPCServer) Serve() error
func (*SimpleIPCServer) ServerTransport ¶
func (p *SimpleIPCServer) ServerTransport() thrift.TServerTransport
func (*SimpleIPCServer) SetForwardHeaders ¶
func (p *SimpleIPCServer) SetForwardHeaders(headers []string)
SetForwardHeaders sets the list of header keys that will be auto forwarded while using THeaderProtocol.
"forward" means that when the server is also a client to other upstream thrift servers, the context object user gets in the processor functions will have both read and write headers set, with write headers being forwarded. Users can always override the write headers by calling SetWriteHeaderList before calling thrift client functions.
func (*SimpleIPCServer) SetLogger ¶
func (p *SimpleIPCServer) SetLogger(logger thrift.Logger)
SetLogger sets the logger used by this SimpleIPCServer.
If no logger was set before Serve is called, a default logger using standard log library will be used.
func (*SimpleIPCServer) Stop ¶
func (p *SimpleIPCServer) Stop() error
type TransactionError ¶
type TransactionError struct {
Err []byte
}
func NewTransactionError ¶
func NewTransactionError(value []byte) *TransactionError
func (*TransactionError) Error ¶
func (t *TransactionError) Error() string
func (*TransactionError) Json ¶
func (t *TransactionError) Json() *JsonValue