new_message
This commit is contained in:
parent
e2426d2944
commit
c4b87dcf14
30
README.md
30
README.md
|
@ -13,6 +13,8 @@ For more information on TMSP, motivations, and tutorials, please visit [our blog
|
||||||
* `TxBytes ([]byte)`
|
* `TxBytes ([]byte)`
|
||||||
* __Returns__:
|
* __Returns__:
|
||||||
* `RetCode (int8)`
|
* `RetCode (int8)`
|
||||||
|
* `RetData ([]KVPair)`
|
||||||
|
* `Error (string)`
|
||||||
* __Usage__:<br/>
|
* __Usage__:<br/>
|
||||||
Append and run a transaction. The transaction may or may not be final.
|
Append and run a transaction. The transaction may or may not be final.
|
||||||
|
|
||||||
|
@ -21,32 +23,17 @@ For more information on TMSP, motivations, and tutorials, please visit [our blog
|
||||||
* `TxBytes ([]byte)`
|
* `TxBytes ([]byte)`
|
||||||
* __Returns__:
|
* __Returns__:
|
||||||
* `RetCode (int8)`
|
* `RetCode (int8)`
|
||||||
|
* `RetData ([]KVPair)`
|
||||||
|
* `Error (string)`
|
||||||
* __Usage__:<br/>
|
* __Usage__:<br/>
|
||||||
Validate a transaction. This message should not mutate the state.
|
Validate a transaction. This message should not mutate the state.
|
||||||
|
|
||||||
#### GetHash
|
#### GetHash
|
||||||
* __Returns__:
|
* __Returns__:
|
||||||
* `RetCode (int8)`
|
|
||||||
* `Hash ([]byte)`
|
* `Hash ([]byte)`
|
||||||
* __Usage__:<br/>
|
* __Usage__:<br/>
|
||||||
Return a Merkle root hash of the application state
|
Return a Merkle root hash of the application state
|
||||||
|
|
||||||
#### AddListener
|
|
||||||
* __Arguments__:
|
|
||||||
* `EventKey (string)`
|
|
||||||
* __Returns__:
|
|
||||||
* `RetCode (int8)`
|
|
||||||
* __Usage__:<br/>
|
|
||||||
Add event listener callback for events with given key.
|
|
||||||
|
|
||||||
#### RemoveListener
|
|
||||||
* __Arguments__:
|
|
||||||
* `EventKey (string)`
|
|
||||||
* __Returns__:
|
|
||||||
* `RetCode (int8)`
|
|
||||||
* __Usage__:<br/>
|
|
||||||
Remove event listener callback for events with given key.
|
|
||||||
|
|
||||||
#### Flush
|
#### Flush
|
||||||
* __Usage__:<br/>
|
* __Usage__:<br/>
|
||||||
Flush the response queue. Applications that implement `types.Application` need not implement this message -- it's handled by the project.
|
Flush the response queue. Applications that implement `types.Application` need not implement this message -- it's handled by the project.
|
||||||
|
@ -62,13 +49,20 @@ For more information on TMSP, motivations, and tutorials, please visit [our blog
|
||||||
* `Key (string)`
|
* `Key (string)`
|
||||||
* `Value (string)`
|
* `Value (string)`
|
||||||
* __Returns__:
|
* __Returns__:
|
||||||
* `RetCode (int8)`
|
* `Error (string)`
|
||||||
* __Usage__:<br/>
|
* __Usage__:<br/>
|
||||||
Set application options. E.g. Key="mode", Value="mempool" for a mempool connection, or Key="mode", Value="consensus" for a consensus connection.
|
Set application options. E.g. Key="mode", Value="mempool" for a mempool connection, or Key="mode", Value="consensus" for a consensus connection.
|
||||||
Other options are application specific.
|
Other options are application specific.
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### Jan 23th, 2016
|
||||||
|
|
||||||
|
* Added CheckTx/Query TMSP message types
|
||||||
|
* Added RetData/Error fields to AppendTx/CheckTx/SetOption
|
||||||
|
* Removed Listener messages
|
||||||
|
* Removed RetCode from ResponseSetOption and ResponseGetHash
|
||||||
|
|
||||||
### Jan 12th, 2016
|
### Jan 12th, 2016
|
||||||
|
|
||||||
* Added "RetCodeBadNonce = 0x06" return code
|
* Added "RetCodeBadNonce = 0x06" return code
|
||||||
|
|
|
@ -16,21 +16,15 @@ const (
|
||||||
ResponseTypeSetOption = byte(0x14)
|
ResponseTypeSetOption = byte(0x14)
|
||||||
// reserved for GetOption = byte(0x15)
|
// reserved for GetOption = byte(0x15)
|
||||||
|
|
||||||
RequestTypeAppendTx = byte(0x21)
|
RequestTypeAppendTx = byte(0x21)
|
||||||
RequestTypeCheckTx = byte(0x22)
|
RequestTypeCheckTx = byte(0x22)
|
||||||
RequestTypeGetHash = byte(0x23)
|
RequestTypeGetHash = byte(0x23)
|
||||||
RequestTypeAddListener = byte(0x24)
|
RequestTypeQuery = byte(0x24)
|
||||||
RequestTypeRemListener = byte(0x25)
|
|
||||||
// reserved for ResponseTypeEvent 0x26
|
|
||||||
RequestTypeQuery = byte(0x27)
|
|
||||||
|
|
||||||
ResponseTypeAppendTx = byte(0x31)
|
ResponseTypeAppendTx = byte(0x31)
|
||||||
ResponseTypeCheckTx = byte(0x32)
|
ResponseTypeCheckTx = byte(0x32)
|
||||||
ResponseTypeGetHash = byte(0x33)
|
ResponseTypeGetHash = byte(0x33)
|
||||||
ResponseTypeAddListener = byte(0x34)
|
ResponseTypeQuery = byte(0x34)
|
||||||
ResponseTypeRemListener = byte(0x35)
|
|
||||||
ResponseTypeEvent = byte(0x36)
|
|
||||||
ResponseTypeQuery = byte(0x37)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
@ -61,14 +55,6 @@ type RequestCheckTx struct {
|
||||||
type RequestGetHash struct {
|
type RequestGetHash struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RequestAddListener struct {
|
|
||||||
EventKey string
|
|
||||||
}
|
|
||||||
|
|
||||||
type RequestRemListener struct {
|
|
||||||
EventKey string
|
|
||||||
}
|
|
||||||
|
|
||||||
type RequestQuery struct {
|
type RequestQuery struct {
|
||||||
QueryBytes []byte
|
QueryBytes []byte
|
||||||
}
|
}
|
||||||
|
@ -77,16 +63,14 @@ type Request interface {
|
||||||
AssertRequestType()
|
AssertRequestType()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_ RequestEcho) AssertRequestType() {}
|
func (_ RequestEcho) AssertRequestType() {}
|
||||||
func (_ RequestFlush) AssertRequestType() {}
|
func (_ RequestFlush) AssertRequestType() {}
|
||||||
func (_ RequestInfo) AssertRequestType() {}
|
func (_ RequestInfo) AssertRequestType() {}
|
||||||
func (_ RequestSetOption) AssertRequestType() {}
|
func (_ RequestSetOption) AssertRequestType() {}
|
||||||
func (_ RequestAppendTx) AssertRequestType() {}
|
func (_ RequestAppendTx) AssertRequestType() {}
|
||||||
func (_ RequestCheckTx) AssertRequestType() {}
|
func (_ RequestCheckTx) AssertRequestType() {}
|
||||||
func (_ RequestGetHash) AssertRequestType() {}
|
func (_ RequestGetHash) AssertRequestType() {}
|
||||||
func (_ RequestAddListener) AssertRequestType() {}
|
func (_ RequestQuery) AssertRequestType() {}
|
||||||
func (_ RequestRemListener) AssertRequestType() {}
|
|
||||||
func (_ RequestQuery) AssertRequestType() {}
|
|
||||||
|
|
||||||
var _ = wire.RegisterInterface(
|
var _ = wire.RegisterInterface(
|
||||||
struct{ Request }{},
|
struct{ Request }{},
|
||||||
|
@ -97,13 +81,20 @@ var _ = wire.RegisterInterface(
|
||||||
wire.ConcreteType{RequestAppendTx{}, RequestTypeAppendTx},
|
wire.ConcreteType{RequestAppendTx{}, RequestTypeAppendTx},
|
||||||
wire.ConcreteType{RequestCheckTx{}, RequestTypeCheckTx},
|
wire.ConcreteType{RequestCheckTx{}, RequestTypeCheckTx},
|
||||||
wire.ConcreteType{RequestGetHash{}, RequestTypeGetHash},
|
wire.ConcreteType{RequestGetHash{}, RequestTypeGetHash},
|
||||||
wire.ConcreteType{RequestAddListener{}, RequestTypeAddListener},
|
|
||||||
wire.ConcreteType{RequestRemListener{}, RequestTypeRemListener},
|
|
||||||
wire.ConcreteType{RequestQuery{}, RequestTypeQuery},
|
wire.ConcreteType{RequestQuery{}, RequestTypeQuery},
|
||||||
)
|
)
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
|
||||||
|
type KVPair struct {
|
||||||
|
Key []byte
|
||||||
|
Value []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResponseException struct {
|
||||||
|
Error string
|
||||||
|
}
|
||||||
|
|
||||||
type ResponseEcho struct {
|
type ResponseEcho struct {
|
||||||
Message string
|
Message string
|
||||||
}
|
}
|
||||||
|
@ -116,59 +107,43 @@ type ResponseInfo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResponseSetOption struct {
|
type ResponseSetOption struct {
|
||||||
RetCode
|
Error string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResponseAppendTx struct {
|
type ResponseAppendTx struct {
|
||||||
RetCode
|
RetCode
|
||||||
|
RetData []KVPair
|
||||||
|
Error string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResponseCheckTx struct {
|
type ResponseCheckTx struct {
|
||||||
RetCode
|
RetCode
|
||||||
|
RetData []KVPair
|
||||||
|
Error string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResponseGetHash struct {
|
type ResponseGetHash struct {
|
||||||
RetCode
|
|
||||||
Hash []byte
|
Hash []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResponseAddListener struct {
|
|
||||||
RetCode
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResponseRemListener struct {
|
|
||||||
RetCode
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResponseException struct {
|
|
||||||
Error string
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResponseEvent struct {
|
|
||||||
Event
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResponseQuery struct {
|
type ResponseQuery struct {
|
||||||
RetCode
|
|
||||||
Result []byte
|
Result []byte
|
||||||
|
Error string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Response interface {
|
type Response interface {
|
||||||
AssertResponseType()
|
AssertResponseType()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (_ ResponseEcho) AssertResponseType() {}
|
func (_ ResponseEcho) AssertResponseType() {}
|
||||||
func (_ ResponseFlush) AssertResponseType() {}
|
func (_ ResponseFlush) AssertResponseType() {}
|
||||||
func (_ ResponseInfo) AssertResponseType() {}
|
func (_ ResponseInfo) AssertResponseType() {}
|
||||||
func (_ ResponseSetOption) AssertResponseType() {}
|
func (_ ResponseSetOption) AssertResponseType() {}
|
||||||
func (_ ResponseAppendTx) AssertResponseType() {}
|
func (_ ResponseAppendTx) AssertResponseType() {}
|
||||||
func (_ ResponseCheckTx) AssertResponseType() {}
|
func (_ ResponseCheckTx) AssertResponseType() {}
|
||||||
func (_ ResponseGetHash) AssertResponseType() {}
|
func (_ ResponseGetHash) AssertResponseType() {}
|
||||||
func (_ ResponseAddListener) AssertResponseType() {}
|
func (_ ResponseException) AssertResponseType() {}
|
||||||
func (_ ResponseRemListener) AssertResponseType() {}
|
func (_ ResponseQuery) AssertResponseType() {}
|
||||||
func (_ ResponseException) AssertResponseType() {}
|
|
||||||
func (_ ResponseEvent) AssertResponseType() {}
|
|
||||||
func (_ ResponseQuery) AssertResponseType() {}
|
|
||||||
|
|
||||||
var _ = wire.RegisterInterface(
|
var _ = wire.RegisterInterface(
|
||||||
struct{ Response }{},
|
struct{ Response }{},
|
||||||
|
@ -179,9 +154,6 @@ var _ = wire.RegisterInterface(
|
||||||
wire.ConcreteType{ResponseAppendTx{}, ResponseTypeAppendTx},
|
wire.ConcreteType{ResponseAppendTx{}, ResponseTypeAppendTx},
|
||||||
wire.ConcreteType{ResponseCheckTx{}, ResponseTypeCheckTx},
|
wire.ConcreteType{ResponseCheckTx{}, ResponseTypeCheckTx},
|
||||||
wire.ConcreteType{ResponseGetHash{}, ResponseTypeGetHash},
|
wire.ConcreteType{ResponseGetHash{}, ResponseTypeGetHash},
|
||||||
wire.ConcreteType{ResponseAddListener{}, ResponseTypeAddListener},
|
|
||||||
wire.ConcreteType{ResponseRemListener{}, ResponseTypeRemListener},
|
|
||||||
wire.ConcreteType{ResponseException{}, ResponseTypeException},
|
wire.ConcreteType{ResponseException{}, ResponseTypeException},
|
||||||
wire.ConcreteType{ResponseEvent{}, ResponseTypeEvent},
|
|
||||||
wire.ConcreteType{ResponseQuery{}, ResponseTypeQuery},
|
wire.ConcreteType{ResponseQuery{}, ResponseTypeQuery},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue