Browse Source

Swap Query return params

pull/1780/head
Jae Kwon 9 years ago
parent
commit
53a8a40785
4 changed files with 6 additions and 6 deletions
  1. +2
    -2
      example/golang/counter.go
  2. +2
    -2
      example/golang/dummy.go
  3. +1
    -1
      server/server.go
  4. +1
    -1
      types/application.go

+ 2
- 2
example/golang/counter.go View File

@ -77,6 +77,6 @@ func (app *CounterApplication) RemListener(key string) types.RetCode {
return types.RetCodeOK
}
func (app *CounterApplication) Query(query []byte) (types.RetCode, []byte) {
return types.RetCodeOK, nil
func (app *CounterApplication) Query(query []byte) ([]byte, types.RetCode) {
return nil, types.RetCodeOK
}

+ 2
- 2
example/golang/dummy.go View File

@ -52,6 +52,6 @@ func (app *DummyApplication) RemListener(key string) types.RetCode {
return types.RetCodeOK
}
func (app *DummyApplication) Query(query []byte) (types.RetCode, []byte) {
return types.RetCodeOK, nil
func (app *DummyApplication) Query(query []byte) ([]byte, types.RetCode) {
return nil, types.RetCodeOK
}

+ 1
- 1
server/server.go View File

@ -128,7 +128,7 @@ func handleRequest(app types.Application, req types.Request, responses chan<- ty
retCode := app.RemListener(req.EventKey)
responses <- types.ResponseRemListener{retCode}
case types.RequestQuery:
retCode, result := app.Query(req.QueryBytes)
result, retCode := app.Query(req.QueryBytes)
responses <- types.ResponseQuery{retCode, result}
default:
responses <- types.ResponseException{"Unknown request"}


+ 1
- 1
types/application.go View File

@ -27,5 +27,5 @@ type Application interface {
RemListener(key string) RetCode
// Query for state
Query(query []byte) (RetCode, []byte)
Query(query []byte) ([]byte, RetCode)
}

Loading…
Cancel
Save