Support API versioning

This commit is contained in:
Peng Wang
2019-11-11 10:48:51 -05:00
committed by Nik Bougalis
parent 79e9085dd1
commit 2aa11fa41d
16 changed files with 714 additions and 53 deletions

View File

@@ -141,7 +141,7 @@ error_code_i fillHandler (Context& context,
JLOG (context.j.trace()) << "COMMAND:" << strCommand;
JLOG (context.j.trace()) << "REQUEST:" << context.params;
auto handler = getHandler(strCommand);
auto handler = getHandler(context.apiVersion, strCommand);
if (!handler)
return rpcUNKNOWN_COMMAND;
@@ -296,9 +296,9 @@ Status doCommand (
return rpcUNKNOWN_COMMAND;
}
Role roleRequired (std::string const& method)
Role roleRequired (unsigned int version, std::string const& method)
{
auto handler = RPC::getHandler(method);
auto handler = RPC::getHandler(version, method);
if (!handler)
return Role::FORBID;