aboutsummaryrefslogtreecommitdiff
path: root/zenserver/compute/apply.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/compute/apply.cpp')
-rw-r--r--zenserver/compute/apply.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/zenserver/compute/apply.cpp b/zenserver/compute/apply.cpp
index 59617bc9a..02a714cf0 100644
--- a/zenserver/compute/apply.cpp
+++ b/zenserver/compute/apply.cpp
@@ -316,12 +316,33 @@ SandboxedFunctionJob::SpawnJob(std::filesystem::path ExePath)
return true;
}
-HttpFunctionService::HttpFunctionService(CasStore& Store, const std::filesystem::path& SandboxBaseDir)
-: m_Log("exec", begin(spdlog::default_logger()->sinks()), end(spdlog::default_logger()->sinks()))
+HttpFunctionService::HttpFunctionService(CasStore& Store, const std::filesystem::path& BaseDir)
+: m_Log("apply", begin(spdlog::default_logger()->sinks()), end(spdlog::default_logger()->sinks()))
, m_CasStore(Store)
-, m_SandboxPath(SandboxBaseDir)
+, m_SandboxPath(BaseDir / "scratch")
+, m_FunctionPath(BaseDir / "func")
{
m_Router.AddPattern("job", "([[:digit:]]+)");
+ m_Router.AddPattern("function", "([[:xdigit:]]{40})");
+
+ m_Router.RegisterRoute(
+ "functions/{function}",
+ [this](HttpRouterRequest& Req) {
+ HttpServerRequest& HttpReq = Req.ServerRequest();
+
+ switch (HttpReq.RequestVerb())
+ {
+ case HttpVerb::kGet:
+ break;
+
+ case HttpVerb::kPost:
+ {
+ CbObject FunctionSpec = HttpReq.ReadPayloadObject();
+ }
+ break;
+ }
+ },
+ HttpVerb::kGet | HttpVerb::kPost);
m_Router.RegisterRoute(
"jobs/{job}",
@@ -507,7 +528,7 @@ HttpFunctionService::~HttpFunctionService()
const char*
HttpFunctionService::BaseUri() const
{
- return "/func/";
+ return "/apply/";
}
void