deadline_filter.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H
18 #define GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H
19 
21 
23 
31 
32 namespace grpc_core {
33 class TimerState;
34 } // namespace grpc_core
35 
36 // State used for filters that enforce call deadlines.
37 // Must be the first field in the filter's call_data.
41  grpc_core::Timestamp deadline);
43 
44  // We take a reference to the call stack for the timer callback.
49  // Closure to invoke when we receive trailing metadata.
50  // We use this to cancel the timer.
52  // The original recv_trailing_metadata_ready closure, which we chain to
53  // after our own closure is invoked.
55 };
56 
57 //
58 // NOTE: All of these functions require that the first field in
59 // elem->call_data is a grpc_deadline_state.
60 //
61 
62 // Cancels the existing timer and starts a new one with new_deadline.
63 //
64 // Note: It is generally safe to call this with an earlier deadline
65 // value than the current one, but not the reverse. No checks are done
66 // to ensure that the timer callback is not invoked while it is in the
67 // process of being reset, which means that attempting to increase the
68 // deadline may result in the timer being called twice.
69 //
70 // Note: Must be called while holding the call combiner.
72  grpc_core::Timestamp new_deadline);
73 
74 // To be called from the client-side filter's start_transport_stream_op_batch()
75 // method. Ensures that the deadline timer is cancelled when the call
76 // is completed.
77 //
78 // Note: It is the caller's responsibility to chain to the next filter if
79 // necessary after this function returns.
80 //
81 // Note: Must be called while holding the call combiner.
84 
85 // Should deadline checking be performed (according to channel args)
87 
88 // Deadline filters for direct client channels and server channels.
89 // Note: Deadlines for non-direct client channels are handled by the
90 // client_channel filter.
93 
94 #endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */
grpc_core::CallCombiner
Definition: call_combiner.h:50
grpc_deadline_state_client_start_transport_stream_op_batch
void grpc_deadline_state_client_start_transport_stream_op_batch(grpc_call_element *elem, grpc_transport_stream_op_batch *op)
Definition: deadline_filter.cc:228
channel_fwd.h
grpc_deadline_state::arena
grpc_core::Arena * arena
Definition: deadline_filter.h:47
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::Timestamp
Definition: src/core/lib/gprpp/time.h:62
elem
Timer elem
Definition: event_engine/iomgr_event_engine/timer_heap_test.cc:109
arena.h
closure.h
grpc_call_element
Definition: channel_stack.h:194
grpc_core::Arena
Definition: src/core/lib/resource_quota/arena.h:45
grpc_channel_args
Definition: grpc_types.h:132
grpc_server_deadline_filter
const grpc_channel_filter grpc_server_deadline_filter
Definition: deadline_filter.cc:361
grpc_types.h
grpc_deadline_state::call_combiner
grpc_core::CallCombiner * call_combiner
Definition: deadline_filter.h:46
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_client_deadline_filter
const grpc_channel_filter grpc_client_deadline_filter
Definition: deadline_filter.cc:345
grpc_deadline_state::recv_trailing_metadata_ready
grpc_closure recv_trailing_metadata_ready
Definition: deadline_filter.h:51
channel_stack.h
grpc_deadline_state::grpc_deadline_state
grpc_deadline_state(grpc_call_element *elem, const grpc_call_element_args &args, grpc_core::Timestamp deadline)
Definition: deadline_filter.cc:194
grpc_call_stack
Definition: channel_stack.h:233
grpc_deadline_state::original_recv_trailing_metadata_ready
grpc_closure * original_recv_trailing_metadata_ready
Definition: deadline_filter.h:54
call_combiner.h
time.h
grpc_deadline_state
Definition: deadline_filter.h:38
grpc_call_element_args
Definition: channel_stack.h:80
grpc_channel_filter
Definition: channel_stack.h:111
transport.h
grpc_deadline_checking_enabled
bool grpc_deadline_checking_enabled(const grpc_channel_args *args)
Definition: deadline_filter.cc:377
grpc_core::TimerState
Definition: deadline_filter.cc:44
grpc_deadline_state::call_stack
grpc_call_stack * call_stack
Definition: deadline_filter.h:45
grpc_deadline_state::~grpc_deadline_state
~grpc_deadline_state()
Definition: deadline_filter.cc:218
grpc_deadline_state_reset
void grpc_deadline_state_reset(grpc_call_element *elem, grpc_core::Timestamp new_deadline)
Definition: deadline_filter.cc:220
grpc_transport_stream_op_batch
Definition: transport.h:284
grpc_closure
Definition: closure.h:56
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
port_platform.h
grpc_deadline_state::timer_state
grpc_core::TimerState * timer_state
Definition: deadline_filter.h:48


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:08