s/GetHash/Commit/g

This commit is contained in:
Jae Kwon 2016-02-14 13:11:06 -08:00
parent 851b961daf
commit 88fcacac7a
9 changed files with 48 additions and 48 deletions

View File

@ -207,8 +207,8 @@ func (cli *TMSPClient) CheckTxAsync(tx []byte) *ReqRes {
return cli.queueRequest(types.RequestCheckTx(tx)) return cli.queueRequest(types.RequestCheckTx(tx))
} }
func (cli *TMSPClient) GetHashAsync() *ReqRes { func (cli *TMSPClient) CommitAsync() *ReqRes {
return cli.queueRequest(types.RequestGetHash()) return cli.queueRequest(types.RequestCommit())
} }
func (cli *TMSPClient) QueryAsync(query []byte) *ReqRes { func (cli *TMSPClient) QueryAsync(query []byte) *ReqRes {
@ -251,8 +251,8 @@ func (cli *TMSPClient) CheckTxSync(tx []byte) (code types.CodeType, result []byt
return res.Code, res.Data, res.Log, nil return res.Code, res.Data, res.Log, nil
} }
func (cli *TMSPClient) GetHashSync() (hash []byte, log string, err error) { func (cli *TMSPClient) CommitSync() (hash []byte, log string, err error) {
reqres := cli.queueRequest(types.RequestGetHash()) reqres := cli.queueRequest(types.RequestCommit())
cli.FlushSync() cli.FlushSync()
if cli.err != nil { if cli.err != nil {
return nil, "", cli.err return nil, "", cli.err

View File

@ -83,7 +83,7 @@ func main() {
Name: "get_hash", Name: "get_hash",
Usage: "Get application Merkle root hash", Usage: "Get application Merkle root hash",
Action: func(c *cli.Context) { Action: func(c *cli.Context) {
cmdGetHash(c) cmdCommit(c)
}, },
}, },
{ {
@ -245,8 +245,8 @@ func cmdCheckTx(c *cli.Context) {
} }
// Get application Merkle root hash // Get application Merkle root hash
func cmdGetHash(c *cli.Context) { func cmdCommit(c *cli.Context) {
res, err := makeRequest(conn, types.RequestGetHash()) res, err := makeRequest(conn, types.RequestCommit())
if err != nil { if err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
return return

View File

@ -54,7 +54,7 @@ func (app *CounterApplication) CheckTx(tx []byte) (code types.CodeType, result [
return types.CodeType_OK, nil, "" return types.CodeType_OK, nil, ""
} }
func (app *CounterApplication) GetHash() (hash []byte, log string) { func (app *CounterApplication) Commit() (hash []byte, log string) {
app.hashCount += 1 app.hashCount += 1
if app.txCount == 0 { if app.txCount == 0 {

View File

@ -42,7 +42,7 @@ func (app *DummyApplication) CheckTx(tx []byte) (code types.CodeType, result []b
return types.CodeType_OK, nil, "" return types.CodeType_OK, nil, ""
} }
func (app *DummyApplication) GetHash() (hash []byte, log string) { func (app *DummyApplication) Commit() (hash []byte, log string) {
hash = app.state.Hash() hash = app.state.Hash()
return hash, "" return hash, ""
} }

View File

@ -112,9 +112,9 @@ func handleRequest(app types.Application, req *types.Request, responses chan<- *
case types.MessageType_CheckTx: case types.MessageType_CheckTx:
code, result, logStr := app.CheckTx(req.Data) code, result, logStr := app.CheckTx(req.Data)
responses <- types.ResponseCheckTx(code, result, logStr) responses <- types.ResponseCheckTx(code, result, logStr)
case types.MessageType_GetHash: case types.MessageType_Commit:
hash, logStr := app.GetHash() hash, logStr := app.Commit()
responses <- types.ResponseGetHash(hash, logStr) responses <- types.ResponseCommit(hash, logStr)
case types.MessageType_Query: case types.MessageType_Query:
code, result, logStr := app.Query(req.Data) code, result, logStr := app.Query(req.Data)
responses <- types.ResponseQuery(code, result, logStr) responses <- types.ResponseQuery(code, result, logStr)

View File

@ -15,7 +15,7 @@ type Application interface {
CheckTx(tx []byte) (code CodeType, result []byte, log string) CheckTx(tx []byte) (code CodeType, result []byte, log string)
// Return the application Merkle root hash // Return the application Merkle root hash
GetHash() (hash []byte, log string) Commit() (hash []byte, log string)
// Query for state // Query for state
Query(query []byte) (code CodeType, result []byte, log string) Query(query []byte) (code CodeType, result []byte, log string)

View File

@ -48,9 +48,9 @@ func RequestCheckTx(txBytes []byte) *Request {
} }
} }
func RequestGetHash() *Request { func RequestCommit() *Request {
return &Request{ return &Request{
Type: MessageType_GetHash, Type: MessageType_Commit,
} }
} }
@ -115,9 +115,9 @@ func ResponseCheckTx(code CodeType, result []byte, log string) *Response {
} }
} }
func ResponseGetHash(hash []byte, log string) *Response { func ResponseCommit(hash []byte, log string) *Response {
return &Response{ return &Response{
Type: MessageType_GetHash, Type: MessageType_Commit,
Data: hash, Data: hash,
Log: log, Log: log,
} }

View File

@ -34,7 +34,7 @@ const (
MessageType_Exception MessageType = 5 MessageType_Exception MessageType = 5
MessageType_AppendTx MessageType = 17 MessageType_AppendTx MessageType = 17
MessageType_CheckTx MessageType = 18 MessageType_CheckTx MessageType = 18
MessageType_GetHash MessageType = 19 MessageType_Commit MessageType = 19
MessageType_Query MessageType = 20 MessageType_Query MessageType = 20
) )
@ -47,7 +47,7 @@ var MessageType_name = map[int32]string{
5: "Exception", 5: "Exception",
17: "AppendTx", 17: "AppendTx",
18: "CheckTx", 18: "CheckTx",
19: "GetHash", 19: "Commit",
20: "Query", 20: "Query",
} }
var MessageType_value = map[string]int32{ var MessageType_value = map[string]int32{
@ -59,7 +59,7 @@ var MessageType_value = map[string]int32{
"Exception": 5, "Exception": 5,
"AppendTx": 17, "AppendTx": 17,
"CheckTx": 18, "CheckTx": 18,
"GetHash": 19, "Commit": 19,
"Query": 20, "Query": 20,
} }
@ -143,31 +143,31 @@ func init() {
} }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 405 bytes of a gzipped FileDescriptorProto // 406 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x92, 0xdf, 0x6e, 0xd3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x92, 0x5f, 0x6e, 0xd3, 0x40,
0x14, 0xc6, 0x49, 0x9b, 0xf4, 0xcf, 0x69, 0xd7, 0xb9, 0x87, 0x22, 0xe5, 0x12, 0x0d, 0x09, 0xa1, 0x10, 0xc6, 0x71, 0x62, 0xe7, 0xcf, 0x24, 0x4d, 0x37, 0x43, 0x90, 0xfc, 0x88, 0x8a, 0x84, 0x50,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b,
0x05, 0x68, 0x02, 0x00, 0x00, 0x4f, 0x97, 0x67, 0x02, 0x00, 0x00,
} }

View File

@ -16,7 +16,7 @@ enum MessageType {
Exception = 0x05; Exception = 0x05;
AppendTx = 0x11; AppendTx = 0x11;
CheckTx = 0x12; CheckTx = 0x12;
GetHash = 0x13; Commit = 0x13;
Query = 0x14; Query = 0x14;
} }