Skip to content

Commit

Permalink
Merge branch 'main' into renamespace_logger
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou authored Jun 28, 2024
2 parents 2a34f3f + 0092241 commit cbfe67c
Show file tree
Hide file tree
Showing 57 changed files with 458 additions and 461 deletions.
65 changes: 0 additions & 65 deletions .azure-pipelines-templates/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ parameters:
ctest_args: '-L "raft_scenario"'

jobs:
# Debug
- ${{ each target in parameters.target }}:
- template: common.yml
parameters:
target: ${{ target }}
env: ${{ parameters.env[target] }}
cmake_args: "${{ parameters.build.common.cmake_args }} ${{ parameters.build.debug.cmake_args }} ${{ parameters.build[target].cmake_args }}"
cmake_env: "${{ parameters.build[target].cmake_env }}"
suffix: "Debug"
artifact_name: "${{ target }}_Debug"
ctest_filter: "${{ parameters.test[target].ctest_args }}"
depends_on: configure
installExtendedTestingTools: false

# Tracing
- template: common.yml
parameters:
Expand All @@ -97,57 +83,6 @@ jobs:
installExtendedTestingTools: false
ninja_targets: "${{ parameters.build.tracing.ninja_targets }}"

# Performance
- ${{ if eq(parameters.perf_tests, 'run') }}:
- template: common.yml
parameters:
target: SGX
env: ${{ parameters.env.SGX }}
cmake_args: "${{ parameters.build.common.cmake_args }} ${{ parameters.build.perf.cmake_args }} ${{ parameters.build.SGX.cmake_args }}"
suffix: "Perf"
artifact_name: "SGX_Perf"
ctest_filter: "${{ parameters.test.perf.ctest_args }}"
depends_on: configure
installExtendedTestingTools: false

- ${{ if eq(parameters.perf_tests, 'run') }}:
- template: common.yml
parameters:
target: Virtual
env: ${{ parameters.env.Virtual }}
cmake_args: "${{ parameters.build.common.cmake_args }} ${{ parameters.build.perf.cmake_args }} ${{ parameters.build.Virtual.cmake_args }}"
cmake_env: "${{ parameters.build.Virtual.cmake_env }}"
suffix: "Perf"
artifact_name: "Virtual_Perf"
ctest_filter: "${{ parameters.test.virtual_perf.ctest_args }}"
depends_on: configure
installExtendedTestingTools: false

- ${{ if eq(parameters.perf_tests, 'run') }}:
- template: common.yml
parameters:
target: Virtual
env: ${{ parameters.env.Virtual }}
cmake_args: "${{ parameters.build.common.cmake_args }} ${{ parameters.build.perf.cmake_args }} ${{ parameters.build.Virtual.cmake_args }} -DWORKER_THREADS=2"
cmake_env: "${{ parameters.build.Virtual.cmake_env }}"
suffix: "Perf_MultiThreaded"
artifact_name: "Virtual_Perf_MultiThreaded"
ctest_filter: "-R pi_basic_mt"
depends_on: configure
installExtendedTestingTools: false

- ${{ if eq(parameters.perf_tests, 'run') }}:
- template: common.yml
parameters:
target: SGX
env: ${{ parameters.env.SGX }}
cmake_args: "${{ parameters.build.common.cmake_args }} ${{ parameters.build.perf.cmake_args }} ${{ parameters.build.SGX.cmake_args }} -DWORKER_THREADS=2"
suffix: "Perf_MultiThreaded"
artifact_name: "SGX_Perf_MultiThreaded"
ctest_filter: "-R pi_basic_mt"
depends_on: configure
installExtendedTestingTools: false

- ${{ if eq(parameters.perf_tests, 'run') }}:
- template: simulation.yml
parameters:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `::threading` is now `ccf::threading`, and `ccf/ds/thread_ids.h` has moved to `ccf/threading/thread_ids.h`
- `::consensus` is now `ccf::consensus`
- `::tls` is now `ccf::tls`
- `::http` is now `ccf::http`
- `::nonstd` is now `ccf::nonstd`
- `::crypto` is now `ccf::crypto`
- `::logger` is now `ccf::logger`
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/http_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <optional>

namespace http
namespace ccf::http
{
// Default parser limits, used as a DoS protection against
// requests that are too large.
Expand Down
109 changes: 56 additions & 53 deletions include/ccf/http_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,75 @@
// Licensed under the Apache 2.0 License.
#pragma once

namespace http
namespace ccf
{
namespace headers
namespace http
{
// All HTTP headers are expected to be lowercase
static constexpr auto ACCEPT = "accept";
static constexpr auto ALLOW = "allow";
static constexpr auto AUTHORIZATION = "authorization";
static constexpr auto CACHE_CONTROL = "cache-control";
static constexpr auto CONTENT_LENGTH = "content-length";
static constexpr auto CONTENT_TYPE = "content-type";
static constexpr auto DATE = "date";
static constexpr auto DIGEST = "digest";
static constexpr auto HOST = "host";
static constexpr auto LOCATION = "location";
static constexpr auto RETRY_AFTER = "retry-after";
static constexpr auto TRAILER = "trailer";
static constexpr auto WWW_AUTHENTICATE = "www-authenticate";
namespace headers
{
// All HTTP headers are expected to be lowercase
static constexpr auto ACCEPT = "accept";
static constexpr auto ALLOW = "allow";
static constexpr auto AUTHORIZATION = "authorization";
static constexpr auto CACHE_CONTROL = "cache-control";
static constexpr auto CONTENT_LENGTH = "content-length";
static constexpr auto CONTENT_TYPE = "content-type";
static constexpr auto DATE = "date";
static constexpr auto DIGEST = "digest";
static constexpr auto HOST = "host";
static constexpr auto LOCATION = "location";
static constexpr auto RETRY_AFTER = "retry-after";
static constexpr auto TRAILER = "trailer";
static constexpr auto WWW_AUTHENTICATE = "www-authenticate";

static constexpr auto CCF_TX_ID = "x-ms-ccf-transaction-id";
}
static constexpr auto CCF_TX_ID = "x-ms-ccf-transaction-id";
}

namespace headervalues
{
namespace contenttype
namespace headervalues
{
static constexpr auto JSON = "application/json";
static constexpr auto MSGPACK = "application/msgpack";
static constexpr auto TEXT = "text/plain";
static constexpr auto OCTET_STREAM = "application/octet-stream";
static constexpr auto GRPC = "application/grpc";
static constexpr auto COSE = "application/cose";
static constexpr auto JAVASCRIPT = "text/javascript";
namespace contenttype
{
static constexpr auto JSON = "application/json";
static constexpr auto MSGPACK = "application/msgpack";
static constexpr auto TEXT = "text/plain";
static constexpr auto OCTET_STREAM = "application/octet-stream";
static constexpr auto GRPC = "application/grpc";
static constexpr auto COSE = "application/cose";
static constexpr auto JAVASCRIPT = "text/javascript";
}
}
}

namespace auth
{
static constexpr auto DIGEST_SHA256 = "SHA-256";
namespace auth
{
static constexpr auto DIGEST_SHA256 = "SHA-256";

static constexpr auto SIGN_AUTH_SCHEME = "Signature";
static constexpr auto SIGN_PARAMS_KEYID = "keyId";
static constexpr auto SIGN_PARAMS_SIGNATURE = "signature";
static constexpr auto SIGN_PARAMS_ALGORITHM = "algorithm";
static constexpr auto SIGN_PARAMS_HEADERS = "headers";
static constexpr auto SIGN_ALGORITHM_ECDSA_SHA256 = "ecdsa-sha256";
static constexpr auto SIGN_ALGORITHM_HS_2019 = "hs2019";
static constexpr auto SIGN_AUTH_SCHEME = "Signature";
static constexpr auto SIGN_PARAMS_KEYID = "keyId";
static constexpr auto SIGN_PARAMS_SIGNATURE = "signature";
static constexpr auto SIGN_PARAMS_ALGORITHM = "algorithm";
static constexpr auto SIGN_PARAMS_HEADERS = "headers";
static constexpr auto SIGN_ALGORITHM_ECDSA_SHA256 = "ecdsa-sha256";
static constexpr auto SIGN_ALGORITHM_HS_2019 = "hs2019";

static constexpr auto SIGN_HEADER_REQUEST_TARGET = "(request-target)";
static constexpr auto SIGN_HEADER_REQUEST_TARGET = "(request-target)";

static constexpr auto SIGN_PARAMS_DELIMITER = ",";
static constexpr auto SIGN_PARAMS_HEADERS_DELIMITER = " ";
static constexpr auto SIGN_PARAMS_DELIMITER = ",";
static constexpr auto SIGN_PARAMS_HEADERS_DELIMITER = " ";

static constexpr auto BEARER_AUTH_SCHEME = "Bearer";
}
static constexpr auto BEARER_AUTH_SCHEME = "Bearer";
}

static constexpr char const* required_signature_headers[] = {
auth::SIGN_HEADER_REQUEST_TARGET, headers::DIGEST};
}
static constexpr char const* required_signature_headers[] = {
auth::SIGN_HEADER_REQUEST_TARGET, ccf::http::headers::DIGEST};
}

namespace http2
{
namespace headers
namespace http2
{
static constexpr auto PATH = ":path";
static constexpr auto STATUS = ":status";
static constexpr auto METHOD = ":method";
namespace headers
{
static constexpr auto PATH = ":path";
static constexpr auto STATUS = ":status";
static constexpr auto METHOD = ":method";
}
}
}
2 changes: 1 addition & 1 deletion include/ccf/http_header_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <map>
#include <string>

namespace http
namespace ccf::http
{
using HeaderMap = std::map<std::string, std::string, std::less<>>;
using HeaderKeyValue = HeaderMap::value_type;
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/http_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <optional>
#include <string_view>

namespace http
namespace ccf::http
{
// Query is parsed into a multimap, so that duplicate keys are retained.
// Handling of duplicates (or ignoring them entirely) is left to the caller.
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/http_responder.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <functional>

namespace http
namespace ccf::http
{
using StreamOnCloseCallback = std::function<void(void)>;

Expand Down
8 changes: 5 additions & 3 deletions include/ccf/node/rpc_context_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace ccf
std::string&& msg,
const std::vector<nlohmann::json>& details = {}) override
{
auto content_type = get_request_header(http::headers::CONTENT_TYPE);
auto content_type = get_request_header(ccf::http::headers::CONTENT_TYPE);
if (
content_type.has_value() &&
content_type.value() == http::headervalues::contenttype::GRPC)
Expand Down Expand Up @@ -110,7 +110,8 @@ namespace ccf
set_response_status(status);
set_response_body(std::vector<uint8_t>(s.begin(), s.end()));
set_response_header(
http::headers::CONTENT_TYPE, http::headervalues::contenttype::JSON);
ccf::http::headers::CONTENT_TYPE,
http::headervalues::contenttype::JSON);
}

void set_grpc_error(grpc_status grpc_status, std::string&& msg)
Expand All @@ -122,7 +123,8 @@ namespace ccf

set_response_status(HTTP_STATUS_OK);
set_response_header(
http::headers::CONTENT_TYPE, http::headervalues::contenttype::GRPC);
ccf::http::headers::CONTENT_TYPE,
http::headervalues::contenttype::GRPC);
set_response_trailer(grpc::make_status_trailer(grpc_status));
set_response_trailer(grpc::make_message_trailer(msg));
}
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/research/grpc_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static grpc_status http_status_to_grpc(http_status s)
namespace ccf::grpc
{
static const http::HeaderMap default_response_headers = {
{http::headers::CONTENT_TYPE, http::headervalues::contenttype::GRPC}};
{ccf::http::headers::CONTENT_TYPE, http::headervalues::contenttype::GRPC}};

static constexpr auto TRAILER_STATUS = "grpc-status";
static constexpr auto TRAILER_MESSAGE = "grpc-message";
Expand Down
2 changes: 1 addition & 1 deletion include/ccf/rpc_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace ccf
virtual const ccf::RESTVerb& get_request_verb() const = 0;
virtual std::string get_request_path() const = 0;
virtual std::string get_method() const = 0;
virtual std::shared_ptr<http::HTTPResponder> get_responder() const = 0;
virtual std::shared_ptr<ccf::http::HTTPResponder> get_responder() const = 0;

/// Returns a map of all PathParams parsed out of the original query path.
/// For instance if this endpoint was installed at `/foo/{name}/{age}`, and
Expand Down
3 changes: 2 additions & 1 deletion samples/apps/basic/basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ namespace basicapp
{
ctx.rpc_ctx->set_response_status(HTTP_STATUS_OK);
ctx.rpc_ctx->set_response_header(
http::headers::CONTENT_TYPE, http::headervalues::contenttype::TEXT);
ccf::http::headers::CONTENT_TYPE,
ccf::http::headervalues::contenttype::TEXT);
ctx.rpc_ctx->set_response_body(record.value());
return;
}
Expand Down
Loading

0 comments on commit cbfe67c

Please sign in to comment.