• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 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 
15 #ifndef GRPC_SRC_CORE_LIB_EVENT_ENGINE_EXTENSIONS_CHAOTIC_GOOD_EXTENSION_H
16 #define GRPC_SRC_CORE_LIB_EVENT_ENGINE_EXTENSIONS_CHAOTIC_GOOD_EXTENSION_H
17 
18 #include <grpc/support/port_platform.h>
19 
20 #include "absl/strings/string_view.h"
21 #include "src/core/lib/resource_quota/memory_quota.h"
22 
23 namespace grpc_event_engine {
24 namespace experimental {
25 
26 /// An Endpoint extension class that will be supported by EventEngine endpoints
27 /// which need to work with the ChaoticGood transport.
28 class ChaoticGoodExtension {
29  public:
30   virtual ~ChaoticGoodExtension() = default;
EndpointExtensionName()31   static absl::string_view EndpointExtensionName() {
32     return "io.grpc.event_engine.extension.chaotic_good_extension";
33   }
34 
35   /// If invoked, the endpoint begins collecting TCP stats. If the boolean
36   /// arg is_control_channel is true, then the collected stats are grouped into
37   /// histograms and counters specific to the chaotic good control channel.
38   /// Otherwise they are grouped into histograms and counters specific to the
39   /// chaotic good data channel.
40   virtual void EnableStatsCollection(bool is_control_channel) = 0;
41 
42   /// Forces the endpoint to use the provided memory quota instead of using the
43   /// one provided to it through the channel args. It is safe to call this
44   /// only when there are no outstanding Reads on the Endpoint.
45   virtual void UseMemoryQuota(grpc_core::MemoryQuotaRefPtr mem_quota) = 0;
46 
47   /// Forces the endpoint to receive rpcs in one contiguous block of memory.
48   /// It is safe to call this only when there are no outstanding Reads on
49   /// the Endpoint.
50   virtual void EnableRpcReceiveCoalescing() = 0;
51 
52   /// Disables rpc receive coalescing until it is explicitly enabled again.
53   /// It is safe to call this only when there are no outstanding Reads on
54   /// the Endpoint.
55   virtual void DisableRpcReceiveCoalescing() = 0;
56   /// If invoked, the endpoint tries to preserve proper order and alignment of
57   /// any memory that maybe shared across reads.
58   virtual void EnforceRxMemoryAlignment() = 0;
59 };
60 
61 }  // namespace experimental
62 }  // namespace grpc_event_engine
63 
64 #endif  // GRPC_SRC_CORE_LIB_EVENT_ENGINE_EXTENSIONS_CHAOTIC_GOOD_EXTENSION_H
65