Swap Query return params
This commit is contained in:
parent
8ae0a0a481
commit
53a8a40785
|
@ -77,6 +77,6 @@ func (app *CounterApplication) RemListener(key string) types.RetCode {
|
||||||
return types.RetCodeOK
|
return types.RetCodeOK
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *CounterApplication) Query(query []byte) (types.RetCode, []byte) {
|
func (app *CounterApplication) Query(query []byte) ([]byte, types.RetCode) {
|
||||||
return types.RetCodeOK, nil
|
return nil, types.RetCodeOK
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,6 @@ func (app *DummyApplication) RemListener(key string) types.RetCode {
|
||||||
return types.RetCodeOK
|
return types.RetCodeOK
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *DummyApplication) Query(query []byte) (types.RetCode, []byte) {
|
func (app *DummyApplication) Query(query []byte) ([]byte, types.RetCode) {
|
||||||
return types.RetCodeOK, nil
|
return nil, types.RetCodeOK
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ func handleRequest(app types.Application, req types.Request, responses chan<- ty
|
||||||
retCode := app.RemListener(req.EventKey)
|
retCode := app.RemListener(req.EventKey)
|
||||||
responses <- types.ResponseRemListener{retCode}
|
responses <- types.ResponseRemListener{retCode}
|
||||||
case types.RequestQuery:
|
case types.RequestQuery:
|
||||||
retCode, result := app.Query(req.QueryBytes)
|
result, retCode := app.Query(req.QueryBytes)
|
||||||
responses <- types.ResponseQuery{retCode, result}
|
responses <- types.ResponseQuery{retCode, result}
|
||||||
default:
|
default:
|
||||||
responses <- types.ResponseException{"Unknown request"}
|
responses <- types.ResponseException{"Unknown request"}
|
||||||
|
|
|
@ -27,5 +27,5 @@ type Application interface {
|
||||||
RemListener(key string) RetCode
|
RemListener(key string) RetCode
|
||||||
|
|
||||||
// Query for state
|
// Query for state
|
||||||
Query(query []byte) (RetCode, []byte)
|
Query(query []byte) ([]byte, RetCode)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue