Controller Service proxies rpc calls to the corresponding servers

This commit is contained in:
Krishna Srinivas
2015-09-19 01:30:09 -07:00
parent c953b0dab3
commit e600bd6b4f
12 changed files with 263 additions and 141 deletions

View File

@@ -20,6 +20,8 @@ import (
"net/http"
router "github.com/gorilla/mux"
jsonrpc "github.com/gorilla/rpc/v2"
"github.com/gorilla/rpc/v2/json"
)
// registerAPI - register all the object API handlers to their respective paths
@@ -70,3 +72,12 @@ func getAPIHandler(conf APIConfig) (http.Handler, MinioAPI) {
apiHandler := registerCustomMiddleware(mux, mwHandlers...)
return apiHandler, minioAPI
}
func getRPCServerHandler() http.Handler {
s := jsonrpc.NewServer()
s.RegisterCodec(json.NewCodec(), "application/json")
s.RegisterService(new(serverServerService), "Server")
mux := router.NewRouter()
mux.Handle("/rpc", s)
return mux
}