diff options
Diffstat (limited to 'src/buildtool/execution_api/execution_service')
7 files changed, 32 insertions, 31 deletions
diff --git a/src/buildtool/execution_api/execution_service/TARGETS b/src/buildtool/execution_api/execution_service/TARGETS index 7d82602c..270d103d 100644 --- a/src/buildtool/execution_api/execution_service/TARGETS +++ b/src/buildtool/execution_api/execution_service/TARGETS @@ -9,6 +9,7 @@ [ "operation_cache" , ["@", "gsl", "", "gsl"] , ["src/buildtool/execution_api/common", "common"] + , ["src/buildtool/execution_api/local", "context"] , ["src/buildtool/logging", "logging"] , ["src/buildtool/common", "bazel_types"] , ["src/buildtool/storage", "storage"] @@ -33,6 +34,7 @@ , "stage": ["src", "buildtool", "execution_api", "execution_service"] , "deps": [ ["@", "gsl", "", "gsl"] + , ["src/buildtool/execution_api/local", "context"] , ["src/buildtool/logging", "logging"] , ["src/buildtool/common", "bazel_types"] , ["src/buildtool/storage", "storage"] @@ -49,10 +51,11 @@ , "proto": [["@", "bazel_remote_apis", "", "remote_execution_proto"]] , "stage": ["src", "buildtool", "execution_api", "execution_service"] , "deps": - [ ["src/buildtool/logging", "logging"] + [ ["@", "gsl", "", "gsl"] + , ["src/buildtool/execution_api/local", "context"] + , ["src/buildtool/logging", "logging"] , ["src/buildtool/common", "bazel_types"] , ["src/buildtool/storage", "storage"] - , ["@", "gsl", "", "gsl"] , ["src/buildtool/storage", "config"] ] , "private-deps": @@ -71,8 +74,7 @@ , "stage": ["src", "buildtool", "execution_api", "execution_service"] , "deps": [ ["src/buildtool/execution_api/common", "api_bundle"] - , ["src/buildtool/storage", "config"] - , ["src/buildtool/storage", "storage"] + , ["src/buildtool/execution_api/local", "context"] ] , "private-deps": [ "execution_server" @@ -86,7 +88,6 @@ , ["src/buildtool/logging", "logging"] , ["@", "json", "", "json"] , ["@", "grpc", "", "grpc++"] - , ["src/buildtool/execution_api/remote", "config"] , ["@", "fmt", "", "fmt"] , ["src/buildtool/compatibility", "compatibility"] , ["src/buildtool/common/remote", "port"] @@ -101,6 +102,7 @@ , "stage": ["src", "buildtool", "execution_api", "execution_service"] , "deps": [ ["@", "gsl", "", "gsl"] + , ["src/buildtool/execution_api/local", "context"] , ["src/buildtool/logging", "logging"] , ["src/buildtool/storage", "storage"] , ["src/buildtool/storage", "config"] diff --git a/src/buildtool/execution_api/execution_service/ac_server.hpp b/src/buildtool/execution_api/execution_service/ac_server.hpp index 3072c70a..59b8297f 100644 --- a/src/buildtool/execution_api/execution_service/ac_server.hpp +++ b/src/buildtool/execution_api/execution_service/ac_server.hpp @@ -18,6 +18,7 @@ #include "build/bazel/remote/execution/v2/remote_execution.grpc.pb.h" #include "gsl/gsl" #include "src/buildtool/common/bazel_types.hpp" +#include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" @@ -25,9 +26,9 @@ class ActionCacheServiceImpl final : public bazel_re::ActionCache::Service { public: explicit ActionCacheServiceImpl( - gsl::not_null<StorageConfig const*> const& storage_config, - gsl::not_null<Storage const*> const& storage) noexcept - : storage_config_{*storage_config}, storage_{*storage} {} + gsl::not_null<LocalContext const*> const& local_context) noexcept + : storage_config_{*local_context->storage_config}, + storage_{*local_context->storage} {} // Retrieve a cached execution result. // diff --git a/src/buildtool/execution_api/execution_service/bytestream_server.hpp b/src/buildtool/execution_api/execution_service/bytestream_server.hpp index 870aed77..e246da0c 100644 --- a/src/buildtool/execution_api/execution_service/bytestream_server.hpp +++ b/src/buildtool/execution_api/execution_service/bytestream_server.hpp @@ -17,6 +17,7 @@ #include "google/bytestream/bytestream.grpc.pb.h" #include "gsl/gsl" +#include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" @@ -24,9 +25,9 @@ class BytestreamServiceImpl : public ::google::bytestream::ByteStream::Service { public: explicit BytestreamServiceImpl( - gsl::not_null<StorageConfig const*> const& storage_config, - gsl::not_null<Storage const*> const& storage) noexcept - : storage_config_{*storage_config}, storage_{*storage} {} + gsl::not_null<LocalContext const*> const& local_context) noexcept + : storage_config_{*local_context->storage_config}, + storage_{*local_context->storage} {} // `Read()` is used to retrieve the contents of a resource as a sequence // of bytes. The bytes are returned in a sequence of responses, and the diff --git a/src/buildtool/execution_api/execution_service/cas_server.hpp b/src/buildtool/execution_api/execution_service/cas_server.hpp index 5ad9e799..3c84ade1 100644 --- a/src/buildtool/execution_api/execution_service/cas_server.hpp +++ b/src/buildtool/execution_api/execution_service/cas_server.hpp @@ -21,6 +21,7 @@ #include "build/bazel/remote/execution/v2/remote_execution.grpc.pb.h" #include "gsl/gsl" #include "src/buildtool/common/bazel_types.hpp" +#include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" @@ -29,9 +30,9 @@ class CASServiceImpl final : public bazel_re::ContentAddressableStorage::Service { public: explicit CASServiceImpl( - gsl::not_null<StorageConfig const*> const& storage_config, - gsl::not_null<Storage const*> const& storage) noexcept - : storage_config_{*storage_config}, storage_{*storage} {} + gsl::not_null<LocalContext const*> const& local_context) noexcept + : storage_config_{*local_context->storage_config}, + storage_{*local_context->storage} {} // Determine if blobs are present in the CAS. // diff --git a/src/buildtool/execution_api/execution_service/execution_server.hpp b/src/buildtool/execution_api/execution_service/execution_server.hpp index 7107ed45..e09f028b 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.hpp +++ b/src/buildtool/execution_api/execution_service/execution_server.hpp @@ -25,6 +25,7 @@ #include "src/buildtool/common/bazel_types.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/execution_api/execution_service/operation_cache.hpp" +#include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" @@ -32,12 +33,11 @@ class ExecutionServiceImpl final : public bazel_re::Execution::Service { public: explicit ExecutionServiceImpl( - gsl::not_null<StorageConfig const*> const& storage_config, - gsl::not_null<Storage const*> const& storage, + gsl::not_null<LocalContext const*> const& local_context, gsl::not_null<IExecutionApi const*> const& local_api, std::optional<std::uint8_t> op_exponent) noexcept - : storage_config_{*storage_config}, - storage_{*storage}, + : storage_config_{*local_context->storage_config}, + storage_{*local_context->storage}, api_{*local_api} { if (op_exponent) { op_cache_.SetExponent(*op_exponent); diff --git a/src/buildtool/execution_api/execution_service/server_implementation.cpp b/src/buildtool/execution_api/execution_service/server_implementation.cpp index 73734840..11be6309 100644 --- a/src/buildtool/execution_api/execution_service/server_implementation.cpp +++ b/src/buildtool/execution_api/execution_service/server_implementation.cpp @@ -81,15 +81,13 @@ auto ServerImpl::Create(std::optional<std::string> interface, return std::move(server); } -auto ServerImpl::Run(StorageConfig const& storage_config, - Storage const& storage, +auto ServerImpl::Run(gsl::not_null<LocalContext const*> const& local_context, ApiBundle const& apis, std::optional<std::uint8_t> op_exponent) -> bool { - ExecutionServiceImpl es{ - &storage_config, &storage, &*apis.local, op_exponent}; - ActionCacheServiceImpl ac{&storage_config, &storage}; - CASServiceImpl cas{&storage_config, &storage}; - BytestreamServiceImpl b{&storage_config, &storage}; + ExecutionServiceImpl es{local_context, &*apis.local, op_exponent}; + ActionCacheServiceImpl ac{local_context}; + CASServiceImpl cas{local_context}; + BytestreamServiceImpl b{local_context}; CapabilitiesServiceImpl cap{}; OperarationsServiceImpl op{&es.GetOpCache()}; diff --git a/src/buildtool/execution_api/execution_service/server_implementation.hpp b/src/buildtool/execution_api/execution_service/server_implementation.hpp index d9e16dad..4df8375f 100644 --- a/src/buildtool/execution_api/execution_service/server_implementation.hpp +++ b/src/buildtool/execution_api/execution_service/server_implementation.hpp @@ -20,9 +20,9 @@ #include <optional> #include <string> +#include "gsl/gsl" #include "src/buildtool/execution_api/common/api_bundle.hpp" -#include "src/buildtool/storage/config.hpp" -#include "src/buildtool/storage/storage.hpp" +#include "src/buildtool/execution_api/local/context.hpp" class ServerImpl final { public: @@ -42,13 +42,11 @@ class ServerImpl final { auto operator=(ServerImpl&&) noexcept -> ServerImpl& = default; /// \brief Start the execution service. - /// \param storage_config StorageConfig to be used. - /// \param storage Storage to be used. + /// \param local_context The LocalContext to be used. /// \param apis Apis to be used, only local api is actually /// needed. /// \param op_exponent Log2 threshold for operation cache. - auto Run(StorageConfig const& storage_config, - Storage const& storage, + auto Run(gsl::not_null<LocalContext const*> const& local_context, ApiBundle const& apis, std::optional<std::uint8_t> op_exponent) -> bool; |