Debian Codegraph @

test/core/event_engine/util/aborting_event_engine.h

raw
1 // Copyright 2022 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_TEST_CORE_EVENT_ENGINE_UTIL_NO_OP_EVENT_ENGINE_H
15 #define GRPC_TEST_CORE_EVENT_ENGINE_UTIL_NO_OP_EVENT_ENGINE_H
16
17 #include <grpc/support/port_platform.h>
18
19 #include <stdlib.h>
20
21 #include <memory>
22
23 #include "absl/functional/any_invocable.h"
24 #include "absl/status/status.h"
25 #include "absl/status/statusor.h"
26
27 #include <grpc/event_engine/endpoint_config.h>
28 #include <grpc/event_engine/event_engine.h>
29 #include <grpc/event_engine/memory_allocator.h>
30
31 namespace grpc_event_engine {
32 namespace experimental {
33
34 class AbortingEventEngine : public EventEngine {
35 ConnectionHandle Connect(OnConnectCallback /* on_connect */,
36 const ResolvedAddress& /* addr */,
37 const EndpointConfig& /* args */,
38 MemoryAllocator /* memory_allocator */,
39 Duration /* timeout */) override {
40 abort();
41 };
42 bool CancelConnect(ConnectionHandle /* handle */) override { abort(); }
43 absl::StatusOr<std::unique_ptr<Listener>> CreateListener(
44 Listener::AcceptCallback /* on_accept */,
45 absl::AnyInvocable<void(absl::Status)> /* on_shutdown */,
46 const EndpointConfig& /* config */,
47 std::unique_ptr<MemoryAllocatorFactory> /* memory_allocator_factory */)
48 override {
49 abort();
50 };
51 bool IsWorkerThread() override { abort(); }
52 std::unique_ptr<DNSResolver> GetDNSResolver(
53 const DNSResolver::ResolverOptions& /* options */) override {
54 abort();
55 }
56 void Run(Closure* /* closure */) override { abort(); }
57 void Run(absl::AnyInvocable<void()> /* closure */) override { abort(); }
58 TaskHandle RunAfter(Duration /* when */, Closure* /* closure */) override {
59 abort();
60 }
61 TaskHandle RunAfter(Duration /* when */,
62 absl::AnyInvocable<void()> /* closure */) override {
63 abort();
64 }
65 bool Cancel(TaskHandle /* handle */) override { abort(); }
66 };
67
68 } // namespace experimental
69 } // namespace grpc_event_engine
70
71 #endif // GRPC_TEST_CORE_EVENT_ENGINE_UTIL_NO_OP_EVENT_ENGINE_H