endpoint_config.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2021 The gRPC Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H
  15. #define GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H
  16. #include <grpc/support/port_platform.h>
  17. #include <string>
  18. #include "absl/strings/string_view.h"
  19. #include "absl/types/variant.h"
  20. namespace grpc_event_engine {
  21. namespace experimental {
  22. /// Collection of parameters used to configure client and server endpoints. The
  23. /// \a EndpointConfig maps string-valued keys to values of type int,
  24. /// string_view, or void pointer. Each EventEngine implementation should
  25. /// document its set of supported configuration options.
  26. class EndpointConfig {
  27. public:
  28. virtual ~EndpointConfig() = default;
  29. using Setting = absl::variant<absl::monostate, int, absl::string_view, void*>;
  30. /// Returns the Setting for a specified key, or \a absl::monostate if there is
  31. /// no such entry. Caller does not take ownership of the resulting value.
  32. virtual Setting Get(absl::string_view key) const = 0;
  33. };
  34. } // namespace experimental
  35. } // namespace grpc_event_engine
  36. #endif // GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H