Commit 99e5e4b6 authored by Ciarán Ó Rourke's avatar Ciarán Ó Rourke
Browse files

Ran clang format

parent f86198f0
......@@ -25,14 +25,15 @@ void PushRequestHandler::onRequest(
// can't push
return;
}
#ifdef DEBUG
std::cout << "Got the following PUT request: \n";
std::string path = headers->getPath();
std::cout << path << '\n';
headers->getHeaders().forEach([&] (const std::string& header, const std::string& val) {
std::cout << header << ": " << val << '\n';
headers->getHeaders().forEach(
[&](const std::string& header, const std::string& val) {
std::cout << header << ": " << val << '\n';
});
#endif
......@@ -40,32 +41,32 @@ void PushRequestHandler::onRequest(
std::cout << "Starting Create Bucket queries..." << std::endl;
#endif
s3_header.setHeaders(std::move(headers));
if(s3_header.isCreateBucketRequest())
{
if (s3_header.isCreateBucketRequest()) {
// Ignore, since we don't really have buckets.
// Or do we want a list of the actual buckets to give an error, when a
// requested bucket doesn't exist?
proxygen::ResponseBuilder(downstream_).status(200, "Ok").sendWithEOM();
return;
}
try {
#ifdef DEBUG
std::cout << "Bucket: " << s3_header.getBucket() << '\n';
std::cout << "Key: " << s3_header.getKey() << '\n';
auto metaData = s3_header.getMetaData();
std::cout << "Metadata: " << '\n';
std::for_each(metaData.begin(), metaData.end(),
[&](std::pair<std::string, std::string> pair){
std::for_each(
metaData.begin(), metaData.end(),
[&](std::pair<std::string, std::string> pair) {
std::cout << pair.first << " : " << pair.second << '\n';
});
std::cout << std::endl;
#endif
#endif
phobos.setBucketName(s3_header.getBucket());
phobos.setMetaData(s3_header.getMetaData());
#ifdef DEBUG
std::cout << "Send put to phobos layer" << std::endl;
#endif
......@@ -93,8 +94,7 @@ void PushRequestHandler::onBody(std::unique_ptr<folly::IOBuf> body) noexcept
{
#ifdef DEBUG
std::cout << "Adding data to FIFO... " << std::endl;
if(body)
{
if (body) {
body->coalesce();
size_t totalBodyLength = body->computeChainDataLength();
std::cout << "Body Data Length " << totalBodyLength << '\n';
......@@ -104,43 +104,36 @@ void PushRequestHandler::onBody(std::unique_ptr<folly::IOBuf> body) noexcept
std::cout << "End of body part! \n" << std::endl;
}
#endif
try
{
try {
phobos.addDataToFIFO(std::move(body));
}
catch(fiphoexceptions::FIFOException& fifoExcp)
{
catch (fiphoexceptions::FIFOException& fifoExcp) {
proxygen::ResponseBuilder(downstream_)
.status(409, "Conflict")
.body(fifoExcp.what())
.sendWithEOM();
return;
}
proxygen::ResponseBuilder(downstream_)
.status(100, "Continue")
.send();
proxygen::ResponseBuilder(downstream_).status(100, "Continue").send();
}
void PushRequestHandler::onEOM() noexcept
void PushRequestHandler::onEOM() noexcept
{
try
{
try {
#ifdef DEBUG
std::cout << "Finish IO..." << std::endl;
#endif
phobos.finishPUT();
}
catch(fiphoexceptions::FIFOException& fifoExcp)
{
catch (fiphoexceptions::FIFOException& fifoExcp) {
proxygen::ResponseBuilder(downstream_)
.status(409, "Conflict")
.body(fifoExcp.what())
.sendWithEOM();
return;
}
catch(fiphoexceptions::PhobosException& phoExcp)
{
catch (fiphoexceptions::PhobosException& phoExcp) {
proxygen::ResponseBuilder(downstream_)
.status(409, "Conflict")
.body(phoExcp.what())
......@@ -148,12 +141,11 @@ void PushRequestHandler::onEOM() noexcept
return;
}
proxygen::ResponseBuilder(downstream_)
.status(200, "OK")
.sendWithEOM();
proxygen::ResponseBuilder(downstream_).status(200, "OK").sendWithEOM();
}
void PushRequestHandler::onUpgrade(proxygen::UpgradeProtocol /*protocol*/) noexcept
void PushRequestHandler::onUpgrade(
proxygen::UpgradeProtocol /*protocol*/) noexcept
{
// handler doesn't support upgrades
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment