commit
4a84747b07
41 changed files with 624 additions and 184 deletions
@ -0,0 +1,55 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016 gRPC authors. |
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_IMPL_H |
||||
#define GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_IMPL_H |
||||
|
||||
#include <grpcpp/support/config.h> |
||||
|
||||
namespace grpc_impl { |
||||
|
||||
/// The gRPC server uses this interface to expose the health checking service
|
||||
/// without depending on protobuf.
|
||||
class HealthCheckServiceInterface { |
||||
public: |
||||
virtual ~HealthCheckServiceInterface() {} |
||||
|
||||
/// Set or change the serving status of the given \a service_name.
|
||||
virtual void SetServingStatus(const grpc::string& service_name, |
||||
bool serving) = 0; |
||||
/// Apply to all registered service names.
|
||||
virtual void SetServingStatus(bool serving) = 0; |
||||
|
||||
/// Set all registered service names to not serving and prevent future
|
||||
/// state changes.
|
||||
virtual void Shutdown() {} |
||||
}; |
||||
|
||||
/// Enable/disable the default health checking service. This applies to all C++
|
||||
/// servers created afterwards. For each server, user can override the default
|
||||
/// with a HealthCheckServiceServerBuilderOption.
|
||||
/// NOT thread safe.
|
||||
void EnableDefaultHealthCheckService(bool enable); |
||||
|
||||
/// Returns whether the default health checking service is enabled.
|
||||
/// NOT thread safe.
|
||||
bool DefaultHealthCheckServiceEnabled(); |
||||
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_IMPL_H
|
@ -0,0 +1,57 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016 gRPC authors. |
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPCPP_IMPL_SERVER_INITIALIZER_IMPL_H |
||||
#define GRPCPP_IMPL_SERVER_INITIALIZER_IMPL_H |
||||
|
||||
#include <memory> |
||||
#include <vector> |
||||
|
||||
#include <grpcpp/server.h> |
||||
|
||||
namespace grpc { |
||||
|
||||
class Server; |
||||
class Service; |
||||
} // namespace grpc
|
||||
namespace grpc_impl { |
||||
|
||||
class ServerInitializer { |
||||
public: |
||||
ServerInitializer(grpc::Server* server) : server_(server) {} |
||||
|
||||
bool RegisterService(std::shared_ptr<grpc::Service> service) { |
||||
if (!server_->RegisterService(nullptr, service.get())) { |
||||
return false; |
||||
} |
||||
default_services_.push_back(service); |
||||
return true; |
||||
} |
||||
|
||||
const std::vector<grpc::string>* GetServiceList() { |
||||
return &server_->services_; |
||||
} |
||||
|
||||
private: |
||||
grpc::Server* server_; |
||||
std::vector<std::shared_ptr<grpc::Service> > default_services_; |
||||
}; |
||||
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_IMPL_SERVER_INITIALIZER_IMPL_H
|
@ -0,0 +1,68 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2016 gRPC authors. |
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPCPP_RESOURCE_QUOTA_IMPL_H |
||||
#define GRPCPP_RESOURCE_QUOTA_IMPL_H |
||||
|
||||
struct grpc_resource_quota; |
||||
|
||||
#include <grpcpp/impl/codegen/config.h> |
||||
#include <grpcpp/impl/codegen/grpc_library.h> |
||||
|
||||
namespace grpc_impl { |
||||
|
||||
/// ResourceQuota represents a bound on memory and thread usage by the gRPC
|
||||
/// library. A ResourceQuota can be attached to a server (via \a ServerBuilder),
|
||||
/// or a client channel (via \a ChannelArguments).
|
||||
/// gRPC will attempt to keep memory and threads used by all attached entities
|
||||
/// below the ResourceQuota bound.
|
||||
class ResourceQuota final : private ::grpc::GrpcLibraryCodegen { |
||||
public: |
||||
/// \param name - a unique name for this ResourceQuota.
|
||||
explicit ResourceQuota(const grpc::string& name); |
||||
ResourceQuota(); |
||||
~ResourceQuota(); |
||||
|
||||
/// Resize this \a ResourceQuota to a new size. If \a new_size is smaller
|
||||
/// than the current size of the pool, memory usage will be monotonically
|
||||
/// decreased until it falls under \a new_size.
|
||||
/// No time bound is given for this to occur however.
|
||||
ResourceQuota& Resize(size_t new_size); |
||||
|
||||
/// Set the max number of threads that can be allocated from this
|
||||
/// ResourceQuota object.
|
||||
///
|
||||
/// If the new_max_threads value is smaller than the current value, no new
|
||||
/// threads are allocated until the number of active threads fall below
|
||||
/// new_max_threads. There is no time bound on when this may happen i.e none
|
||||
/// of the current threads are forcefully destroyed and all threads run their
|
||||
/// normal course.
|
||||
ResourceQuota& SetMaxThreads(int new_max_threads); |
||||
|
||||
grpc_resource_quota* c_resource_quota() const { return impl_; } |
||||
|
||||
private: |
||||
ResourceQuota(const ResourceQuota& rhs); |
||||
ResourceQuota& operator=(const ResourceQuota& rhs); |
||||
|
||||
grpc_resource_quota* const impl_; |
||||
}; |
||||
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_RESOURCE_QUOTA_IMPL_H
|
@ -0,0 +1,48 @@ |
||||
#region Copyright notice and license |
||||
|
||||
// Copyright 2019 The gRPC Authors |
||||
// |
||||
// 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. |
||||
|
||||
#endregion |
||||
|
||||
namespace Grpc.Core |
||||
{ |
||||
/// <summary> |
||||
/// Verification context for VerifyPeerCallback. |
||||
/// Note: experimental API that can change or be removed without any prior notice. |
||||
/// </summary> |
||||
public class VerifyPeerContext |
||||
{ |
||||
/// <summary> |
||||
/// Initializes a new instance of the <see cref="T:Grpc.Core.VerifyPeerContext"/> class. |
||||
/// </summary> |
||||
/// <param name="targetName">The target name of the peer.</param> |
||||
/// <param name="peerPem">The PEM encoded certificate of the peer.</param> |
||||
internal VerifyPeerContext(string targetName, string peerPem) |
||||
{ |
||||
this.TargetName = targetName; |
||||
this.PeerPem = peerPem; |
||||
} |
||||
|
||||
/// <summary> |
||||
/// The target name of the peer. |
||||
/// </summary> |
||||
public string TargetName { get; } |
||||
|
||||
/// <summary> |
||||
/// The PEM encoded certificate of the peer. |
||||
/// </summary> |
||||
public string PeerPem { get; } |
||||
} |
||||
} |
@ -0,0 +1,23 @@ |
||||
#!/usr/bin/env bash |
||||
# Copyright 2017 gRPC authors. |
||||
# |
||||
# 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. |
||||
|
||||
set -ex |
||||
|
||||
# TODO(jtattermusch): use the latest version of bazel |
||||
|
||||
# Use --all_incompatible_changes to give an early warning about future |
||||
# bazel incompatibilities. |
||||
EXTRA_FLAGS="--config=opt --cache_test_results=no --all_incompatible_changes" |
||||
github/grpc/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh "${EXTRA_FLAGS}" |
Loading…
Reference in new issue