src/core/lib/surface/server.h
Go to the documentation of this file.
1 //
2 // Copyright 2015 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_LIB_SURFACE_SERVER_H
18 #define GRPC_CORE_LIB_SURFACE_SERVER_H
19 
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 #include <atomic>
26 #include <functional>
27 #include <list>
28 #include <memory>
29 #include <string>
30 #include <utility>
31 #include <vector>
32 
33 #include "absl/base/thread_annotations.h"
34 #include "absl/memory/memory.h"
35 #include "absl/status/statusor.h"
36 #include "absl/synchronization/notification.h"
37 #include "absl/types/optional.h"
38 
39 #include <grpc/grpc.h>
42 #include <grpc/slice.h>
43 #include <grpc/support/log.h>
44 
68 
70 
71 namespace grpc_core {
72 
74 
75 class Server : public InternallyRefCounted<Server>,
76  public CppImplOf<Server, grpc_server> {
77  public:
78  // Filter vtable.
80 
81  // Opaque type used for registered methods.
82  struct RegisteredMethod;
83 
84  // An object to represent the most relevant characteristics of a
85  // newly-allocated call object when using an AllocatingRequestMatcherBatch.
87  void* tag;
92  };
93 
94  // An object to represent the most relevant characteristics of a
95  // newly-allocated call object when using an
96  // AllocatingRequestMatcherRegistered.
98  void* tag;
104  };
105 
109  class ListenerInterface : public Orphanable {
110  public:
111  ~ListenerInterface() override = default;
112 
115  virtual void Start(Server* server,
116  const std::vector<grpc_pollset*>* pollsets) = 0;
117 
121 
124  virtual void SetOnDestroyDone(grpc_closure* on_destroy_done) = 0;
125  };
126 
127  explicit Server(ChannelArgs args);
128  ~Server() override;
129 
130  void Orphan() ABSL_LOCKS_EXCLUDED(mu_global_) override;
131 
134 
135  // Do not call this before Start(). Returns the pollsets. The
136  // vector itself is immutable, but the pollsets inside are mutable. The
137  // result is valid for the lifetime of the server.
138  const std::vector<grpc_pollset*>& pollsets() const { return pollsets_; }
139 
141  return config_fetcher_.get();
142  }
143 
145  std::unique_ptr<grpc_server_config_fetcher> config_fetcher) {
147  }
148 
150 
151  // Adds a listener to the server. When the server starts, it will call
152  // the listener's Start() method, and when it shuts down, it will orphan
153  // the listener.
154  void AddListener(OrphanablePtr<ListenerInterface> listener);
155 
156  // Starts listening for connections.
158 
159  // Sets up a transport. Creates a channel stack and binds the transport to
160  // the server. Called from the listener when a new connection is accepted.
161  // Takes ownership of a ref on resource_user from the caller.
163  grpc_transport* transport, grpc_pollset* accepting_pollset,
165  const RefCountedPtr<channelz::SocketNode>& socket_node);
166 
168 
169  // Functions to specify that a specific registered method or the unregistered
170  // collection should use a specific allocator for request matching.
172  grpc_completion_queue* cq, void* method_tag,
173  std::function<RegisteredCallAllocation()> allocator);
175  std::function<BatchCallAllocation()> allocator);
176 
177  RegisteredMethod* RegisterMethod(
178  const char* method, const char* host,
180  uint32_t flags);
181 
183  grpc_metadata_array* request_metadata,
184  grpc_completion_queue* cq_bound_to_call,
185  grpc_completion_queue* cq_for_notification,
186  void* tag);
187 
189  RegisteredMethod* rm, grpc_call** call, gpr_timespec* deadline,
190  grpc_metadata_array* request_metadata,
191  grpc_byte_buffer** optional_payload,
192  grpc_completion_queue* cq_bound_to_call,
193  grpc_completion_queue* cq_for_notification, void* tag_new);
194 
197 
198  void StopListening();
199 
201 
203 
204  private:
205  struct RequestedCall;
206 
208  RegisteredMethod* server_registered_method = nullptr;
210  bool has_host;
213  };
214 
215  class RequestMatcherInterface;
216  class RealRequestMatcher;
217  class AllocatingRequestMatcherBase;
218  class AllocatingRequestMatcherBatch;
219  class AllocatingRequestMatcherRegistered;
220 
221  class ChannelData {
222  public:
223  ChannelData() = default;
224  ~ChannelData();
225 
229  intptr_t channelz_socket_uuid);
230 
232  Channel* channel() const { return channel_.get(); }
233  size_t cq_idx() const { return cq_idx_; }
234 
236  const grpc_slice& path);
237 
238  // Filter vtable functions.
242 
243  private:
244  class ConnectivityWatcher;
245 
246  static void AcceptStream(void* arg, grpc_transport* /*transport*/,
247  const void* transport_server_data);
248 
250 
251  static void FinishDestroy(void* arg, grpc_error_handle error);
252 
255  // The index into Server::cqs_ of the CQ used as a starting point for
256  // where to publish new incoming calls.
257  size_t cq_idx_;
259  // A hash-table of the methods and hosts of the registered methods.
260  // TODO(vjpai): Convert this to an STL map type as opposed to a direct
261  // bucket implementation. (Consider performance impact, hash function to
262  // use, etc.)
267  };
268 
269  class CallData {
270  public:
271  enum class CallState {
272  NOT_STARTED, // Waiting for metadata.
273  PENDING, // Initial metadata read, not flow controlled in yet.
274  ACTIVATED, // Flow controlled in, on completion queue.
275  ZOMBIED, // Cancelled before being queued.
276  };
277 
280  ~CallData();
281 
282  // Starts the recv_initial_metadata batch on the call.
283  // Invoked from ChannelData::AcceptStream().
285 
286  void SetState(CallState state);
287 
288  // Attempts to move from PENDING to ACTIVATED state. Returns true
289  // on success.
290  bool MaybeActivate();
291 
292  // Publishes an incoming call to the application after it has been
293  // matched.
294  void Publish(size_t cq_idx, RequestedCall* rc);
295 
296  void KillZombie();
297 
298  void FailCallCreation();
299 
300  // Filter vtable functions.
301  static grpc_error_handle InitCallElement(
303  static void DestroyCallElement(grpc_call_element* elem,
304  const grpc_call_final_info* /*final_info*/,
305  grpc_closure* /*ignored*/);
306  static void StartTransportStreamOpBatch(
308 
309  private:
310  // Helper functions for handling calls at the top of the call stack.
311  static void RecvInitialMetadataBatchComplete(void* arg,
313  void StartNewRpc(grpc_call_element* elem);
314  static void PublishNewRpc(void* arg, grpc_error_handle error);
315 
316  // Functions used inside the call stack.
317  void StartTransportStreamOpBatchImpl(grpc_call_element* elem,
319  static void RecvInitialMetadataReady(void* arg, grpc_error_handle error);
320  static void RecvTrailingMetadataReady(void* arg, grpc_error_handle error);
321 
323 
325 
326  std::atomic<CallState> state_{CallState::NOT_STARTED};
327 
331 
332  grpc_completion_queue* cq_new_ = nullptr;
333 
334  RequestMatcherInterface* matcher_ = nullptr;
335  grpc_byte_buffer* payload_ = nullptr;
336 
338 
339  grpc_metadata_array initial_metadata_ =
340  grpc_metadata_array(); // Zero-initialize the C struct.
342 
344  uint32_t recv_initial_metadata_flags_ = 0;
348 
353 
355 
357  };
358 
359  struct Listener {
361  : listener(std::move(l)) {}
364  };
365 
366  struct ShutdownTag {
367  ShutdownTag(void* tag_arg, grpc_completion_queue* cq_arg)
368  : tag(tag_arg), cq(cq_arg) {}
369  void* const tag;
372  };
373 
374  static void ListenerDestroyDone(void* arg, grpc_error_handle error);
375 
376  static void DoneShutdownEvent(void* server,
377  grpc_cq_completion* /*completion*/) {
378  static_cast<Server*>(server)->Unref();
379  }
380 
381  static void DoneRequestEvent(void* req, grpc_cq_completion* completion);
382 
383  void FailCall(size_t cq_idx, RequestedCall* rc, grpc_error_handle error);
384  grpc_call_error QueueRequestedCall(size_t cq_idx, RequestedCall* rc);
385 
388 
391 
393  grpc_completion_queue* cq_for_notification, void* tag,
394  grpc_byte_buffer** optional_payload, RegisteredMethod* rm);
396  size_t* cq_idx, grpc_completion_queue* cq_for_notification, void* tag,
397  grpc_byte_buffer** optional_payload, RegisteredMethod* rm);
398 
400 
401  // Take a shutdown ref for a request (increment by 2) and return if shutdown
402  // has not been called.
404  int old_value = shutdown_refs_.fetch_add(2, std::memory_order_acq_rel);
405  return (old_value & 1) != 0;
406  }
407 
408  // Decrement the shutdown ref counter by either 1 (for shutdown call) or 2
409  // (for in-flight request) and possibly call MaybeFinishShutdown if
410  // appropriate.
412  if (shutdown_refs_.fetch_sub(2, std::memory_order_acq_rel) == 2) {
413  MutexLock lock(&mu_global_);
415  // The last request in-flight during shutdown is now complete.
416  if (requests_complete_ != nullptr) {
417  GPR_ASSERT(!requests_complete_->HasBeenNotified());
418  requests_complete_->Notify();
419  }
420  }
421  }
422  // Returns a notification pointer to wait on if there are requests in-flight,
423  // or null.
426  if (shutdown_refs_.fetch_sub(1, std::memory_order_acq_rel) == 1) {
427  // There is no request in-flight.
429  return nullptr;
430  }
431  requests_complete_ = absl::make_unique<absl::Notification>();
432  return requests_complete_.get();
433  }
434 
435  bool ShutdownCalled() const {
436  return (shutdown_refs_.load(std::memory_order_acquire) & 1) == 0;
437  }
438 
439  // Returns whether there are no more shutdown refs, which means that shutdown
440  // has been called and all accepted requests have been published if using an
441  // AllocatingRequestMatcher.
442  bool ShutdownReady() const {
443  return shutdown_refs_.load(std::memory_order_acquire) == 0;
444  }
445 
448  std::unique_ptr<grpc_server_config_fetcher> config_fetcher_;
449 
450  std::vector<grpc_completion_queue*> cqs_;
451  std::vector<grpc_pollset*> pollsets_;
452  bool started_ = false;
453 
454  // The two following mutexes control access to server-state.
455  // mu_global_ controls access to non-call-related state (e.g., channel state).
456  // mu_call_ controls access to call-related state (e.g., the call lists).
457  //
458  // If they are ever required to be nested, you must lock mu_global_
459  // before mu_call_. This is currently used in shutdown processing
460  // (ShutdownAndNotify() and MaybeFinishShutdown()).
461  Mutex mu_global_; // mutex for server and channel state
462  Mutex mu_call_; // mutex for call-specific state
463 
464  // startup synchronization: flag, signals whether we are doing the listener
465  // start routine or not.
466  bool starting_ ABSL_GUARDED_BY(mu_global_) = false;
468 
469  std::vector<std::unique_ptr<RegisteredMethod>> registered_methods_;
470 
471  // Request matcher for unregistered methods.
472  std::unique_ptr<RequestMatcherInterface> unregistered_request_matcher_;
473 
474  // The shutdown refs counter tracks whether or not shutdown has been called
475  // and whether there are any AllocatingRequestMatcher requests that have been
476  // accepted but not yet started (+2 on each one). If shutdown has been called,
477  // the lowest bit will be 0 (defaults to 1) and the counter will be even. The
478  // server should not notify on shutdown until the counter is 0 (shutdown is
479  // called and there are no requests that are accepted but not started).
480  std::atomic<int> shutdown_refs_{1};
481  bool shutdown_published_ ABSL_GUARDED_BY(mu_global_) = false;
482  std::vector<ShutdownTag> shutdown_tags_ ABSL_GUARDED_BY(mu_global_);
483  std::unique_ptr<absl::Notification> requests_complete_
485 
486  std::list<ChannelData*> channels_;
487 
488  std::list<Listener> listeners_;
490 
491  // The last time we printed a shutdown progress message.
493 };
494 
495 } // namespace grpc_core
496 
498  public:
500  : public grpc_core::DualRefCounted<ConnectionManager> {
501  public:
502  // Ownership of \a args is transfered.
505  };
506 
508  public:
509  virtual ~WatcherInterface() = default;
510  // UpdateConnectionManager() is invoked by the config fetcher when a new
511  // config is available. Implementations should update the connection manager
512  // and start serving if not already serving.
513  virtual void UpdateConnectionManager(
515  // Implementations should stop serving when this is called. Serving should
516  // only resume when UpdateConfig() is invoked.
517  virtual void StopServing() = 0;
518  };
519 
520  virtual ~grpc_server_config_fetcher() = default;
521 
522  virtual void StartWatch(std::string listening_address,
523  std::unique_ptr<WatcherInterface> watcher) = 0;
524  virtual void CancelWatch(WatcherInterface* watcher) = 0;
525  virtual grpc_pollset_set* interested_parties() = 0;
526 };
527 
528 #endif /* GRPC_CORE_LIB_SURFACE_SERVER_H */
grpc_server_config_fetcher::WatcherInterface::UpdateConnectionManager
virtual void UpdateConnectionManager(grpc_core::RefCountedPtr< ConnectionManager > manager)=0
trace.h
grpc_core::Channel
Definition: src/core/lib/surface/channel.h:108
grpc_core::Server::SetupTransport
grpc_error_handle SetupTransport(grpc_transport *transport, grpc_pollset *accepting_pollset, const grpc_channel_args *args, const RefCountedPtr< channelz::SocketNode > &socket_node)
Definition: src/core/lib/surface/server.cc:605
grpc_core::Server::CallData::call_combiner_
CallCombiner * call_combiner_
Definition: src/core/lib/surface/server.h:356
slice.h
grpc_core::Server::ListenerDestroyDone
static void ListenerDestroyDone(void *arg, grpc_error_handle error)
Definition: src/core/lib/surface/server.cc:768
phone_pb2.CallState
CallState
Definition: phone_pb2.py:221
grpc_call_error
grpc_call_error
Definition: grpc_types.h:464
grpc_core::CallCombiner
Definition: call_combiner.h:50
pollset.h
grpc_core::CondVar
Definition: src/core/lib/gprpp/sync.h:126
orphanable.h
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
grpc_core::Server::ChannelData::list_position_
absl::optional< std::list< ChannelData * >::iterator > list_position_
Definition: src/core/lib/surface/server.h:258
metadata_batch.h
grpc_core::Server::SendGoaways
void SendGoaways() ABSL_LOCKS_EXCLUDED(mu_global_
Definition: src/core/lib/surface/server.cc:863
const
#define const
Definition: bloaty/third_party/zlib/zconf.h:230
grpc_core::Server::CallData::kill_zombie_closure_
grpc_closure kill_zombie_closure_
Definition: src/core/lib/surface/server.h:337
deadline_
Timestamp deadline_
Definition: channel_connectivity.cc:163
channel_fwd.h
grpc_core::Server::BatchCallAllocation
Definition: src/core/lib/surface/server.h:86
grpc_core::Server::shutdown_refs_
std::atomic< int > shutdown_refs_
Definition: src/core/lib/surface/server.h:480
grpc_core::Orphanable
Definition: orphanable.h:39
grpc_server_config_fetcher
Definition: src/core/lib/surface/server.h:497
recv_initial_metadata_error_
grpc_error_handle recv_initial_metadata_error_
Definition: retry_filter.cc:491
grpc_core::Server::CallData::CallState
CallState
Definition: src/core/lib/surface/server.h:271
grpc_core::Server::Listener::Listener
Listener(OrphanablePtr< ListenerInterface > l)
Definition: src/core/lib/surface/server.h:360
slice.h
grpc_core::Server::channel_args
const grpc_channel_args * channel_args() const
Definition: src/core/lib/surface/server.h:132
grpc_core::Server::unregistered_request_matcher_
std::unique_ptr< RequestMatcherInterface > unregistered_request_matcher_
Definition: src/core/lib/surface/server.h:472
grpc.framework.interfaces.base.utilities.completion
def completion(terminal_metadata, code, message)
Definition: framework/interfaces/base/utilities.py:45
grpc_core::Server::RegisteredCallAllocation::cq
grpc_completion_queue * cq
Definition: src/core/lib/surface/server.h:103
grpc_core::Server::ChannelData
Definition: src/core/lib/surface/server.h:221
grpc_core::InternallyRefCounted< Server >::Unref
void Unref()
Definition: orphanable.h:100
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::Server::ShutdownUnrefOnShutdownCall
absl::Notification * ShutdownUnrefOnShutdownCall() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_global_) GRPC_MUST_USE_RESULT
Definition: src/core/lib/surface/server.h:424
grpc_metadata_array
Definition: grpc_types.h:579
grpc_core::Slice
Definition: src/core/lib/slice/slice.h:282
grpc_call_details
Definition: grpc_types.h:585
grpc_core::MutexLock
Definition: src/core/lib/gprpp/sync.h:88
grpc_core::Server::ShutdownTag::ShutdownTag
ShutdownTag(void *tag_arg, grpc_completion_queue *cq_arg)
Definition: src/core/lib/surface/server.h:367
grpc_pollset_set
struct grpc_pollset_set grpc_pollset_set
Definition: iomgr_fwd.h:23
grpc_core::Server::mu_global_
Mutex mu_global_
Definition: src/core/lib/surface/server.h:461
grpc_core::Server::pollsets_
std::vector< grpc_pollset * > pollsets_
Definition: src/core/lib/surface/server.h:451
grpc_core::DualRefCounted
Definition: dual_ref_counted.h:48
grpc_core::Timestamp
Definition: src/core/lib/gprpp/time.h:62
grpc_core::Server::CallData::recv_initial_metadata_ready_
grpc_closure recv_initial_metadata_ready_
Definition: src/core/lib/surface/server.h:345
grpc_channel_element
Definition: channel_stack.h:186
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
elem
Timer elem
Definition: event_engine/iomgr_event_engine/timer_heap_test.cc:109
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_core::Server::ListenerInterface::Start
virtual void Start(Server *server, const std::vector< grpc_pollset * > *pollsets)=0
grpc_core::Server::ChannelData::channel_
RefCountedPtr< Channel > channel_
Definition: src/core/lib/surface/server.h:254
grpc_core::Server::starting_cv_
CondVar starting_cv_
Definition: src/core/lib/surface/server.h:467
grpc_core::Server::listeners_
std::list< Listener > listeners_
Definition: src/core/lib/surface/server.h:488
completion_queue.h
grpc_core::Server::CancelAllCalls
void CancelAllCalls() ABSL_LOCKS_EXCLUDED(mu_global_)
Definition: src/core/lib/surface/server.cc:852
tcp
static uv_tcp_t tcp
Definition: test-connection-fail.c:29
closure.h
grpc_cq_completion
Definition: src/core/lib/surface/completion_queue.h:43
grpc_core::Server::RegisterMethod
RegisteredMethod * RegisterMethod(const char *method, const char *host, grpc_server_register_method_payload_handling payload_handling, uint32_t flags)
Definition: src/core/lib/surface/server.cc:676
grpc_core::Server::ChannelData::InitTransport
void InitTransport(RefCountedPtr< Server > server, RefCountedPtr< Channel > channel, size_t cq_idx, grpc_transport *transport, intptr_t channelz_socket_uuid)
Definition: src/core/lib/surface/server.cc:1014
grpc_core::Server::ABSL_GUARDED_BY
bool starting_ ABSL_GUARDED_BY(mu_global_)
check_documentation.path
path
Definition: check_documentation.py:57
grpc_core::Server::Server
Server(ChannelArgs args)
Definition: src/core/lib/surface/server.cc:541
grpc_core::Server::SetBatchMethodAllocator
void SetBatchMethodAllocator(grpc_completion_queue *cq, std::function< BatchCallAllocation()> allocator)
Definition: src/core/lib/surface/server.cc:651
grpc_server_config_fetcher::WatcherInterface::StopServing
virtual void StopServing()=0
grpc_call_element
Definition: channel_stack.h:194
grpc_core::Server::RequestCall
grpc_call_error RequestCall(grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag)
Definition: src/core/lib/surface/server.cc:935
channelz.h
iterator
const typedef MCPhysReg * iterator
Definition: MCRegisterInfo.h:27
grpc_channel_args
Definition: grpc_types.h:132
grpc_core::Server::ValidateServerRequest
static grpc_call_error ValidateServerRequest(grpc_completion_queue *cq_for_notification, void *tag, grpc_byte_buffer **optional_payload, RegisteredMethod *rm)
Definition: src/core/lib/surface/server.cc:881
grpc_server_register_method_payload_handling
grpc_server_register_method_payload_handling
Definition: grpc.h:396
grpc_core::Server::CallData::original_recv_initial_metadata_ready_
grpc_closure * original_recv_initial_metadata_ready_
Definition: src/core/lib/surface/server.h:346
grpc_core::Server::channelz_node_
RefCountedPtr< channelz::ServerNode > channelz_node_
Definition: src/core/lib/surface/server.h:447
gen_build_yaml.struct
def struct(**kwargs)
Definition: test/core/end2end/gen_build_yaml.py:30
grpc_core::Server::config_fetcher_
std::unique_ptr< grpc_server_config_fetcher > config_fetcher_
Definition: src/core/lib/surface/server.h:448
grpc_core::Server::HasOpenConnections
bool HasOpenConnections() ABSL_LOCKS_EXCLUDED(mu_global_)
Definition: src/core/lib/surface/server.cc:638
grpc_core::channelz::ServerNode
Definition: channelz.h:239
grpc_core::Server::ShutdownReady
bool ShutdownReady() const
Definition: src/core/lib/surface/server.h:442
call
FilterStackCall * call
Definition: call.cc:750
grpc_core::Server::ChannelData::channelz_socket_uuid_
intptr_t channelz_socket_uuid_
Definition: src/core/lib/surface/server.h:266
grpc_core::Server::DoneShutdownEvent
static void DoneShutdownEvent(void *server, grpc_cq_completion *)
Definition: src/core/lib/surface/server.h:376
grpc_types.h
absl::Notification
Definition: abseil-cpp/absl/synchronization/notification.h:66
grpc_core::Server::ListenerInterface::channelz_listen_socket_node
virtual channelz::ListenSocketNode * channelz_listen_socket_node() const =0
grpc_core::Server::Listener::destroy_done
grpc_closure destroy_done
Definition: src/core/lib/surface/server.h:363
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
grpc_core::Server::Listener::listener
OrphanablePtr< ListenerInterface > listener
Definition: src/core/lib/surface/server.h:362
recv_trailing_metadata_error_
grpc_error_handle recv_trailing_metadata_error_
Definition: retry_filter.cc:505
grpc_core::Server::cqs_
std::vector< grpc_completion_queue * > cqs_
Definition: src/core/lib/surface/server.h:450
grpc_core::Server::ChannelRegisteredMethod
Definition: src/core/lib/surface/server.h:207
grpc_core::Server::ChannelData::DestroyChannelElement
static void DestroyChannelElement(grpc_channel_element *elem)
Definition: src/core/lib/surface/server.cc:1172
grpc_core::Server::mu_call_
Mutex mu_call_
Definition: src/core/lib/surface/server.h:462
grpc_core::Server::ChannelData::GetRegisteredMethod
ChannelRegisteredMethod * GetRegisteredMethod(const grpc_slice &host, const grpc_slice &path)
Definition: src/core/lib/surface/server.cc:1077
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_core::Server::pollsets
const std::vector< grpc_pollset * > & pollsets() const
Definition: src/core/lib/surface/server.h:138
grpc_core::RefCountedPtr
Definition: ref_counted_ptr.h:35
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc_core::Server::kServerTopFilter
static const grpc_channel_filter kServerTopFilter
Definition: src/core/lib/surface/server.h:79
grpc_core::Server::ChannelData::channel
Channel * channel() const
Definition: src/core/lib/surface/server.h:232
grpc_core::Server::SetRegisteredMethodAllocator
void SetRegisteredMethodAllocator(grpc_completion_queue *cq, void *method_tag, std::function< RegisteredCallAllocation()> allocator)
Definition: src/core/lib/surface/server.cc:643
grpc_core::grpc_server_channel_trace
TraceFlag grpc_server_channel_trace(false, "server_channel")
Definition: src/core/lib/surface/server.h:73
grpc_core::Server::CallData::recv_trailing_metadata_ready_
grpc_closure recv_trailing_metadata_ready_
Definition: src/core/lib/surface/server.h:350
tag
static void * tag(intptr_t t)
Definition: bad_client.cc:318
grpc_core::Server::CallData
Definition: src/core/lib/surface/server.h:269
grpc_server_config_fetcher::WatcherInterface::~WatcherInterface
virtual ~WatcherInterface()=default
grpc_core::Server::channels_
std::list< ChannelData * > channels_
Definition: src/core/lib/surface/server.h:486
grpc_core::Server::BatchCallAllocation::initial_metadata
grpc_metadata_array * initial_metadata
Definition: src/core/lib/surface/server.h:89
req
static uv_connect_t req
Definition: test-connection-fail.c:30
channel_stack.h
grpc_completion_queue
Definition: completion_queue.cc:347
grpc_core::Server::RegisteredCallAllocation
Definition: src/core/lib/surface/server.h:97
transport
grpc_transport transport
Definition: filter_fuzzer.cc:146
ABSL_EXCLUSIVE_LOCKS_REQUIRED
#define ABSL_EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: abseil-cpp/absl/base/thread_annotations.h:145
grpc.h
grpc_call
struct grpc_call grpc_call
Definition: grpc_types.h:70
grpc_byte_buffer
Definition: grpc_types.h:43
grpc_core::Server::BatchCallAllocation::cq
grpc_completion_queue * cq
Definition: src/core/lib/surface/server.h:91
grpc_core::Server::RegisteredCallAllocation::deadline
gpr_timespec * deadline
Definition: src/core/lib/surface/server.h:101
call_combiner.h
absl::optional
Definition: abseil-cpp/absl/types/internal/optional.h:61
grpc_core::Server::ShutdownTag
Definition: src/core/lib/surface/server.h:366
grpc_core::Server::config_fetcher
grpc_server_config_fetcher * config_fetcher() const
Definition: src/core/lib/surface/server.h:140
grpc_core::Server::AddListener
void AddListener(OrphanablePtr< ListenerInterface > listener)
Definition: src/core/lib/surface/server.cc:559
grpc_server_config_fetcher::ConnectionManager
Definition: src/core/lib/surface/server.h:499
grpc_core::Server::ListenerInterface::~ListenerInterface
~ListenerInterface() override=default
arg
Definition: cmdline.cc:40
grpc_core::Server::BatchCallAllocation::details
grpc_call_details * details
Definition: src/core/lib/surface/server.h:90
grpc_core::Server::CallData::recv_initial_metadata_batch_complete_
grpc_closure recv_initial_metadata_batch_complete_
Definition: src/core/lib/surface/server.h:341
cpp_impl_of.h
time.h
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
grpc_core::Server::ChannelRegisteredMethod::method
Slice method
Definition: src/core/lib/surface/server.h:211
grpc_core::Server::RegisteredCallAllocation::tag
void * tag
Definition: src/core/lib/surface/server.h:98
grpc_server_config_fetcher::ConnectionManager::UpdateChannelArgsForConnection
virtual absl::StatusOr< grpc_channel_args * > UpdateChannelArgsForConnection(grpc_channel_args *args, grpc_endpoint *tcp)=0
grpc_core::Server::Start
void Start() ABSL_LOCKS_EXCLUDED(mu_global_)
Definition: src/core/lib/surface/server.cc:568
grpc_core::Server::RegisteredCallAllocation::call
grpc_call ** call
Definition: src/core/lib/surface/server.h:99
grpc_core::Server::last_shutdown_message_time_
gpr_timespec last_shutdown_message_time_
Definition: src/core/lib/surface/server.h:492
intptr_t
_W64 signed int intptr_t
Definition: stdint-msvc2008.h:118
NOT_STARTED
@ NOT_STARTED
Definition: win/tty.c:81
error.h
grpc_call_element_args
Definition: channel_stack.h:80
batch
grpc_transport_stream_op_batch * batch
Definition: retry_filter.cc:243
grpc_core::InternallyRefCounted
Definition: orphanable.h:73
grpc_core::Server::ShutdownAndNotify
void ShutdownAndNotify(grpc_completion_queue *cq, void *tag) ABSL_LOCKS_EXCLUDED(mu_global_
Definition: src/core/lib/surface/server.cc:797
grpc_core::Server::CallData::publish_
grpc_closure publish_
Definition: src/core/lib/surface/server.h:354
rm
static bool rm(upb_table *t, lookupkey_t key, upb_value *val, upb_tabkey *removed, uint32_t hash, eqlfunc_t *eql)
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/upb.c:1477
grpc_core::Server::mu_call_
void mu_call_
Definition: src/core/lib/surface/server.h:196
grpc_core::Server::CallData::host_
absl::optional< Slice > host_
Definition: src/core/lib/surface/server.h:329
seen_recv_trailing_metadata_ready_
bool seen_recv_trailing_metadata_ready_
Definition: message_decompress_filter.cc:126
stdint.h
grpc_core::Server::ChannelData::Destroy
void Destroy() ABSL_EXCLUSIVE_LOCKS_REQUIRED(server_ -> mu_global_)
Definition: src/core/lib/surface/server.cc:1142
transport_fwd.h
grpc_channel_filter
Definition: channel_stack.h:111
grpc_core::Server::ChannelData::~ChannelData
~ChannelData()
Definition: src/core/lib/surface/server.cc:997
grpc_core::Server::ChannelData::server
RefCountedPtr< Server > server() const
Definition: src/core/lib/surface/server.h:231
gpr_types.h
grpc_core::TraceFlag
Definition: debug/trace.h:63
grpc_core::Server::ChannelData::AcceptStream
static void AcceptStream(void *arg, grpc_transport *, const void *transport_server_data)
Definition: src/core/lib/surface/server.cc:1106
grpc_core::Server::ChannelData::ChannelData
ChannelData()=default
grpc_server_config_fetcher::WatcherInterface
Definition: src/core/lib/surface/server.h:507
details
static grpc_slice details
Definition: test/core/fling/client.cc:46
grpc_core::Server::QueueRequestedCall
grpc_call_error QueueRequestedCall(size_t cq_idx, RequestedCall *rc)
Definition: src/core/lib/surface/server.cc:916
google::protobuf::python::cmessage::SetState
PyObject * SetState(CMessage *self, PyObject *state)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:2460
grpc_core::Server::ChannelData::FinishDestroy
static void FinishDestroy(void *arg, grpc_error_handle error)
Definition: src/core/lib/surface/server.cc:1132
grpc_core::Server::ChannelData::registered_methods_
std::unique_ptr< std::vector< ChannelRegisteredMethod > > registered_methods_
Definition: src/core/lib/surface/server.h:263
grpc_core::Mutex
Definition: src/core/lib/gprpp/sync.h:61
grpc_core::Server::RegisterCompletionQueue
void RegisterCompletionQueue(grpc_completion_queue *cq)
Definition: src/core/lib/surface/server.cc:659
grpc_core::Server
Definition: src/core/lib/surface/server.h:75
grpc_core::Server::started_
bool started_
Definition: src/core/lib/surface/server.h:452
GRPC_MUST_USE_RESULT
#define GRPC_MUST_USE_RESULT
Definition: impl/codegen/port_platform.h:584
grpc_core::Server::CallData::server_
RefCountedPtr< Server > server_
Definition: src/core/lib/surface/server.h:322
grpc_core::Server::listeners_destroyed_
size_t listeners_destroyed_
Definition: src/core/lib/surface/server.h:489
absl::flags_internal
Definition: abseil-cpp/absl/flags/commandlineflag.h:40
server
Definition: examples/python/async_streaming/server.py:1
ABSL_LOCKS_EXCLUDED
#define ABSL_LOCKS_EXCLUDED(...)
Definition: abseil-cpp/absl/base/thread_annotations.h:163
grpc_core::Server::ValidateServerRequestAndCq
grpc_call_error ValidateServerRequestAndCq(size_t *cq_idx, grpc_completion_queue *cq_for_notification, void *tag, grpc_byte_buffer **optional_payload, RegisteredMethod *rm)
Definition: src/core/lib/surface/server.cc:895
grpc_core::Server::ShutdownTag::tag
void *const tag
Definition: src/core/lib/surface/server.h:369
grpc_core::Server::channel_args_
const grpc_channel_args *const channel_args_
Definition: src/core/lib/surface/server.h:446
grpc_core::Server::ChannelRegisteredMethod::host
Slice host
Definition: src/core/lib/surface/server.h:212
grpc_core::Server::BatchCallAllocation::call
grpc_call ** call
Definition: src/core/lib/surface/server.h:88
grpc_core::OrphanablePtr
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:64
grpc_core::Server::CallData::call_
grpc_call * call_
Definition: src/core/lib/surface/server.h:324
grpc_core::Server::RegisteredCallAllocation::optional_payload
grpc_byte_buffer ** optional_payload
Definition: src/core/lib/surface/server.h:102
grpc_core::Server::RequestRegisteredCall
grpc_call_error RequestRegisteredCall(RegisteredMethod *rm, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *request_metadata, grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new)
Definition: src/core/lib/surface/server.cc:952
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
grpc_core::Server::ShutdownCalled
bool ShutdownCalled() const
Definition: src/core/lib/surface/server.h:435
grpc_core::Server::ShutdownTag::cq
grpc_completion_queue *const cq
Definition: src/core/lib/surface/server.h:370
grpc_core::Server::ChannelData::finish_destroy_channel_closure_
grpc_closure finish_destroy_channel_closure_
Definition: src/core/lib/surface/server.h:265
grpc_core::Server::ChannelData::server_
RefCountedPtr< Server > server_
Definition: src/core/lib/surface/server.h:253
grpc_core::Server::StopListening
void StopListening()
Definition: src/core/lib/surface/server.cc:836
grpc_core::Server::FailCall
void FailCall(size_t cq_idx, RequestedCall *rc, grpc_error_handle error)
Definition: src/core/lib/surface/server.cc:706
grpc_core::Server::DoneRequestEvent
static void DoneRequestEvent(void *req, grpc_cq_completion *completion)
Definition: src/core/lib/surface/server.cc:702
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
grpc_core::Server::~Server
~Server() override
Definition: src/core/lib/surface/server.cc:544
channelz
void channelz(grpc_end2end_test_config config)
Definition: test/core/end2end/tests/channelz.cc:318
grpc_core::Server::registered_methods_
std::vector< std::unique_ptr< RegisteredMethod > > registered_methods_
Definition: src/core/lib/surface/server.h:469
grpc_core::ChannelArgs
Definition: channel_args.h:111
grpc_core::Server::ShutdownUnrefOnRequest
void ShutdownUnrefOnRequest() ABSL_LOCKS_EXCLUDED(mu_global_)
Definition: src/core/lib/surface/server.h:411
ref_counted_ptr.h
state_
grpc_connectivity_state state_
Definition: channel_connectivity.cc:213
grpc_core::Server::BatchCallAllocation::tag
void * tag
Definition: src/core/lib/surface/server.h:87
grpc_transport
Definition: transport_impl.h:89
transport.h
grpc_core::Server::ChannelData::cq_idx
size_t cq_idx() const
Definition: src/core/lib/surface/server.h:233
watcher
ClusterWatcher * watcher
Definition: cds.cc:148
dual_ref_counted.h
channel_args.h
grpc_core::Server::ListenerInterface::SetOnDestroyDone
virtual void SetOnDestroyDone(grpc_closure *on_destroy_done)=0
grpc_core::Server::MaybeFinishShutdown
void MaybeFinishShutdown() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_global_) ABSL_LOCKS_EXCLUDED(mu_call_)
Definition: src/core/lib/surface/server.cc:717
grpc_channel_element_args
Definition: channel_stack.h:74
absl
Definition: abseil-cpp/absl/algorithm/algorithm.h:31
grpc_core::Server::Listener
Definition: src/core/lib/surface/server.h:359
grpc_core::channelz::ListenSocketNode
Definition: channelz.h:351
grpc_core::Timestamp::InfFuture
static constexpr Timestamp InfFuture()
Definition: src/core/lib/gprpp/time.h:79
grpc_call_final_info
Definition: channel_stack.h:95
grpc_core::Server::ChannelData::registered_method_max_probes_
uint32_t registered_method_max_probes_
Definition: src/core/lib/surface/server.h:264
absl::StatusOr
Definition: abseil-cpp/absl/status/statusor.h:187
iomgr_fwd.h
gpr_timespec
Definition: gpr_types.h:50
endpoint.h
grpc_core::Server::RegisteredCallAllocation::initial_metadata
grpc_metadata_array * initial_metadata
Definition: src/core/lib/surface/server.h:100
grpc_error
Definition: error_internal.h:42
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
grpc_core::Server::ShutdownTag::completion
grpc_cq_completion completion
Definition: src/core/lib/surface/server.h:371
grpc_core::Server::Orphan
void Orphan() ABSL_LOCKS_EXCLUDED(mu_global_) override
Definition: src/core/lib/surface/server.cc:872
method
NSString * method
Definition: ProtoMethod.h:28
grpc_core::Server::ListenerInterface
Definition: src/core/lib/surface/server.h:109
grpc_metadata_batch
Definition: metadata_batch.h:1259
grpc_pollset
Definition: bm_cq_multiple_threads.cc:37
grpc_core::Server::ChannelData::InitChannelElement
static grpc_error_handle InitChannelElement(grpc_channel_element *elem, grpc_channel_element_args *args)
Definition: src/core/lib/surface/server.cc:1164
grpc_core::Server::KillPendingWorkLocked
void KillPendingWorkLocked(grpc_error_handle error) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_call_)
Definition: src/core/lib/surface/server.cc:747
grpc_transport_stream_op_batch
Definition: transport.h:284
grpc_closure
Definition: closure.h:56
grpc_core::Server::CallData::path_
absl::optional< Slice > path_
Definition: src/core/lib/surface/server.h:328
grpc_endpoint
Definition: endpoint.h:105
grpc_core::Server::channelz_node
channelz::ServerNode * channelz_node() const
Definition: src/core/lib/surface/server.h:133
grpc_core::Server::ShutdownRefOnRequest
bool ShutdownRefOnRequest()
Definition: src/core/lib/surface/server.h:403
recv_initial_metadata_
grpc_metadata_array recv_initial_metadata_
Definition: rls.cc:671
grpc_core::CppImplOf
Definition: cpp_impl_of.h:27
cq
static grpc_completion_queue * cq
Definition: test/core/fling/client.cc:37
sync.h
grpc_core::Server::ChannelRegisteredMethod::flags
uint32_t flags
Definition: src/core/lib/surface/server.h:209
old_value
int old_value
Definition: abseil-cpp/absl/strings/internal/str_format/output.cc:30
grpc_core::Server::set_config_fetcher
void set_config_fetcher(std::unique_ptr< grpc_server_config_fetcher > config_fetcher)
Definition: src/core/lib/surface/server.h:144
grpc_core::Server::ChannelData::cq_idx_
size_t cq_idx_
Definition: src/core/lib/surface/server.h:257
grpc_core::Server::CallData::original_recv_trailing_metadata_ready_
grpc_closure * original_recv_trailing_metadata_ready_
Definition: src/core/lib/surface/server.h:351
grpc_core::Server::ChannelRegisteredMethod::has_host
bool has_host
Definition: src/core/lib/surface/server.h:210
channel.h
port_platform.h
grpc_core::Server::GetChannelsLocked
std::vector< RefCountedPtr< Channel > > GetChannelsLocked() const
Definition: src/core/lib/surface/server.cc:759


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:11