blob: 313123a394a5d9cb51ab91a039eb3f98cd7a12bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// Copyright 2023 Huawei Cloud Computing Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/buildtool/execution_api/execution_service/capabilities_server.hpp"
#include "build/bazel/semver/semver.pb.h"
#include "src/buildtool/common/protocol_traits.hpp"
#include "src/buildtool/execution_api/common/message_limits.hpp"
auto CapabilitiesServiceImpl::GetCapabilities(
::grpc::ServerContext* /*context*/,
const ::bazel_re::GetCapabilitiesRequest*
/*request*/,
::bazel_re::ServerCapabilities* response) -> ::grpc::Status {
::bazel_re::CacheCapabilities cache;
::bazel_re::ExecutionCapabilities exec;
cache.add_digest_functions(
ProtocolTraits::IsNative(hash_type_)
? ::bazel_re::DigestFunction_Value::DigestFunction_Value_SHA1
: ::bazel_re::DigestFunction_Value::DigestFunction_Value_SHA256);
cache.mutable_action_cache_update_capabilities()->set_update_enabled(false);
cache.set_max_batch_total_size_bytes(MessageLimits::kMaxGrpcLength);
cache.add_supported_chunking_algorithms(
::bazel_re::ChunkingAlgorithm_Value::ChunkingAlgorithm_Value_FASTCDC);
*(response->mutable_cache_capabilities()) = cache;
exec.set_digest_function(
ProtocolTraits::IsNative(hash_type_)
? ::bazel_re::DigestFunction_Value::DigestFunction_Value_SHA1
: ::bazel_re::DigestFunction_Value::DigestFunction_Value_SHA256);
exec.set_exec_enabled(true);
*(response->mutable_execution_capabilities()) = exec;
::build::bazel::semver::SemVer v{};
v.set_major(2);
v.set_minor(0);
*(response->mutable_low_api_version()) = v;
*(response->mutable_high_api_version()) = v;
return ::grpc::Status::OK;
}
|