Classes | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
grpc_core::Server Class Reference

#include <server.h>

Inheritance diagram for grpc_core::Server:
Inheritance graph
[legend]

Classes

struct  BatchCallAllocation
 
class  CallData
 
class  ChannelData
 
struct  ChannelRegisteredMethod
 
struct  Listener
 
class  ListenerInterface
 
struct  RegisteredCallAllocation
 
struct  ShutdownTag
 

Public Member Functions

void AddListener (OrphanablePtr< ListenerInterface > listener)
 
void CancelAllCalls () ABSL_LOCKS_EXCLUDED(mu_global_)
 
const grpc_channel_argschannel_args () const
 
channelz::ServerNodechannelz_node () const
 
grpc_server_config_fetcherconfig_fetcher () const
 
bool HasOpenConnections () ABSL_LOCKS_EXCLUDED(mu_global_)
 
void Orphan () ABSL_LOCKS_EXCLUDED(mu_global_) override
 
const std::vector< grpc_pollset * > & pollsets () const
 
void RegisterCompletionQueue (grpc_completion_queue *cq)
 
RegisteredMethod * RegisterMethod (const char *method, const char *host, grpc_server_register_method_payload_handling payload_handling, uint32_t flags)
 
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)
 
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)
 
void SendGoaways () ABSL_LOCKS_EXCLUDED(mu_global_
 
 Server (ChannelArgs args)
 
void set_config_fetcher (std::unique_ptr< grpc_server_config_fetcher > config_fetcher)
 
void SetBatchMethodAllocator (grpc_completion_queue *cq, std::function< BatchCallAllocation()> allocator)
 
void SetRegisteredMethodAllocator (grpc_completion_queue *cq, void *method_tag, std::function< RegisteredCallAllocation()> allocator)
 
grpc_error_handle SetupTransport (grpc_transport *transport, grpc_pollset *accepting_pollset, const grpc_channel_args *args, const RefCountedPtr< channelz::SocketNode > &socket_node)
 
void ShutdownAndNotify (grpc_completion_queue *cq, void *tag) ABSL_LOCKS_EXCLUDED(mu_global_
 
void Start () ABSL_LOCKS_EXCLUDED(mu_global_)
 
void StopListening ()
 
 ~Server () override
 
- Public Member Functions inherited from grpc_core::InternallyRefCounted< Server >
 InternallyRefCounted (const InternallyRefCounted &)=delete
 
InternallyRefCountedoperator= (const InternallyRefCounted &)=delete
 
- Public Member Functions inherited from grpc_core::Orphanable
Orphanableoperator= (const Orphanable &)=delete
 
 Orphanable (const Orphanable &)=delete
 
- Public Member Functions inherited from grpc_core::CppImplOf< Server, grpc_server >
grpc_serverc_ptr ()
 

Public Attributes

void mu_call_
 

Static Public Attributes

static const grpc_channel_filter kServerTopFilter
 

Private Member Functions

bool starting_ ABSL_GUARDED_BY (mu_global_)
 
bool shutdown_published_ ABSL_GUARDED_BY (mu_global_)
 
std::vector< ShutdownTag > shutdown_tags_ ABSL_GUARDED_BY (mu_global_)
 
std::unique_ptr< absl::Notification > requests_complete_ ABSL_GUARDED_BY (mu_global_)
 
void FailCall (size_t cq_idx, RequestedCall *rc, grpc_error_handle error)
 
std::vector< RefCountedPtr< Channel > > GetChannelsLocked () const
 
void KillPendingWorkLocked (grpc_error_handle error) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_call_)
 
void MaybeFinishShutdown () ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_global_) ABSL_LOCKS_EXCLUDED(mu_call_)
 
grpc_call_error QueueRequestedCall (size_t cq_idx, RequestedCall *rc)
 
bool ShutdownCalled () const
 
bool ShutdownReady () const
 
bool ShutdownRefOnRequest ()
 
void ShutdownUnrefOnRequest () ABSL_LOCKS_EXCLUDED(mu_global_)
 
absl::NotificationShutdownUnrefOnShutdownCall () ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_global_) GRPC_MUST_USE_RESULT
 
grpc_call_error ValidateServerRequestAndCq (size_t *cq_idx, grpc_completion_queue *cq_for_notification, void *tag, grpc_byte_buffer **optional_payload, RegisteredMethod *rm)
 

Static Private Member Functions

static void DoneRequestEvent (void *req, grpc_cq_completion *completion)
 
static void DoneShutdownEvent (void *server, grpc_cq_completion *)
 
static void ListenerDestroyDone (void *arg, grpc_error_handle error)
 
static grpc_call_error ValidateServerRequest (grpc_completion_queue *cq_for_notification, void *tag, grpc_byte_buffer **optional_payload, RegisteredMethod *rm)
 

Private Attributes

const grpc_channel_args *const channel_args_
 
std::list< ChannelData * > channels_
 
RefCountedPtr< channelz::ServerNodechannelz_node_
 
std::unique_ptr< grpc_server_config_fetcherconfig_fetcher_
 
std::vector< grpc_completion_queue * > cqs_
 
gpr_timespec last_shutdown_message_time_
 
std::list< Listenerlisteners_
 
size_t listeners_destroyed_ = 0
 
Mutex mu_call_
 
Mutex mu_global_
 
std::vector< grpc_pollset * > pollsets_
 
std::vector< std::unique_ptr< RegisteredMethod > > registered_methods_
 
std::atomic< intshutdown_refs_ {1}
 
bool started_ = false
 
CondVar starting_cv_
 
std::unique_ptr< RequestMatcherInterface > unregistered_request_matcher_
 

Additional Inherited Members

- Static Public Member Functions inherited from grpc_core::CppImplOf< Server, grpc_server >
static const ServerFromC (const grpc_server *c_type)
 
static ServerFromC (grpc_server *c_type)
 
- Protected Member Functions inherited from grpc_core::InternallyRefCounted< Server >
 InternallyRefCounted (const char *trace=nullptr, intptr_t initial_refcount=1)
 
RefCountedPtr< ServerRef () GRPC_MUST_USE_RESULT
 
RefCountedPtr< ServerRef (const DebugLocation &location, const char *reason) GRPC_MUST_USE_RESULT
 
void Unref ()
 
void Unref (const DebugLocation &location, const char *reason)
 
 ~InternallyRefCounted () override=default
 
- Protected Member Functions inherited from grpc_core::Orphanable
 Orphanable ()
 
virtual ~Orphanable ()
 
- Protected Member Functions inherited from grpc_core::CppImplOf< Server, grpc_server >
 ~CppImplOf ()=default
 

Detailed Description

Definition at line 75 of file src/core/lib/surface/server.h.

Constructor & Destructor Documentation

◆ Server()

grpc_core::Server::Server ( ChannelArgs  args)
explicit

Definition at line 541 of file src/core/lib/surface/server.cc.

◆ ~Server()

grpc_core::Server::~Server ( )
override

Definition at line 544 of file src/core/lib/surface/server.cc.

Member Function Documentation

◆ ABSL_GUARDED_BY() [1/4]

bool starting_ grpc_core::Server::ABSL_GUARDED_BY ( mu_global_  )
private

◆ ABSL_GUARDED_BY() [2/4]

bool shutdown_published_ grpc_core::Server::ABSL_GUARDED_BY ( mu_global_  )
private

◆ ABSL_GUARDED_BY() [3/4]

std::vector<ShutdownTag> shutdown_tags_ grpc_core::Server::ABSL_GUARDED_BY ( mu_global_  )
private

◆ ABSL_GUARDED_BY() [4/4]

std::unique_ptr<absl::Notification> requests_complete_ grpc_core::Server::ABSL_GUARDED_BY ( mu_global_  )
private

◆ AddListener()

void grpc_core::Server::AddListener ( OrphanablePtr< ListenerInterface listener)

Definition at line 559 of file src/core/lib/surface/server.cc.

◆ CancelAllCalls()

void grpc_core::Server::CancelAllCalls ( )

Definition at line 852 of file src/core/lib/surface/server.cc.

◆ channel_args()

const grpc_channel_args* grpc_core::Server::channel_args ( ) const
inline

Definition at line 132 of file src/core/lib/surface/server.h.

◆ channelz_node()

channelz::ServerNode* grpc_core::Server::channelz_node ( ) const
inline

Definition at line 133 of file src/core/lib/surface/server.h.

◆ config_fetcher()

grpc_server_config_fetcher* grpc_core::Server::config_fetcher ( ) const
inline

Definition at line 140 of file src/core/lib/surface/server.h.

◆ DoneRequestEvent()

void grpc_core::Server::DoneRequestEvent ( void *  req,
grpc_cq_completion completion 
)
staticprivate

Definition at line 702 of file src/core/lib/surface/server.cc.

◆ DoneShutdownEvent()

static void grpc_core::Server::DoneShutdownEvent ( void *  server,
grpc_cq_completion  
)
inlinestaticprivate

Definition at line 376 of file src/core/lib/surface/server.h.

◆ FailCall()

void grpc_core::Server::FailCall ( size_t  cq_idx,
RequestedCall *  rc,
grpc_error_handle  error 
)
private

Definition at line 706 of file src/core/lib/surface/server.cc.

◆ GetChannelsLocked()

std::vector< RefCountedPtr< Channel > > grpc_core::Server::GetChannelsLocked ( ) const
private

Definition at line 759 of file src/core/lib/surface/server.cc.

◆ HasOpenConnections()

bool grpc_core::Server::HasOpenConnections ( )

Definition at line 638 of file src/core/lib/surface/server.cc.

◆ KillPendingWorkLocked()

void grpc_core::Server::KillPendingWorkLocked ( grpc_error_handle  error)
private

Definition at line 747 of file src/core/lib/surface/server.cc.

◆ ListenerDestroyDone()

void grpc_core::Server::ListenerDestroyDone ( void *  arg,
grpc_error_handle  error 
)
staticprivate

Definition at line 768 of file src/core/lib/surface/server.cc.

◆ MaybeFinishShutdown()

void grpc_core::Server::MaybeFinishShutdown ( )
private

Definition at line 717 of file src/core/lib/surface/server.cc.

◆ Orphan()

void grpc_core::Server::Orphan ( )
overridevirtual

Implements grpc_core::Orphanable.

Definition at line 872 of file src/core/lib/surface/server.cc.

◆ pollsets()

const std::vector<grpc_pollset*>& grpc_core::Server::pollsets ( ) const
inline

Definition at line 138 of file src/core/lib/surface/server.h.

◆ QueueRequestedCall()

grpc_call_error grpc_core::Server::QueueRequestedCall ( size_t  cq_idx,
RequestedCall *  rc 
)
private

Definition at line 916 of file src/core/lib/surface/server.cc.

◆ RegisterCompletionQueue()

void grpc_core::Server::RegisterCompletionQueue ( grpc_completion_queue cq)

Definition at line 659 of file src/core/lib/surface/server.cc.

◆ RegisterMethod()

Server::RegisteredMethod * grpc_core::Server::RegisterMethod ( const char *  method,
const char *  host,
grpc_server_register_method_payload_handling  payload_handling,
uint32_t  flags 
)

Definition at line 676 of file src/core/lib/surface/server.cc.

◆ RequestCall()

grpc_call_error grpc_core::Server::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 at line 935 of file src/core/lib/surface/server.cc.

◆ RequestRegisteredCall()

grpc_call_error grpc_core::Server::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 at line 952 of file src/core/lib/surface/server.cc.

◆ SendGoaways()

void grpc_core::Server::SendGoaways ( )

Definition at line 863 of file src/core/lib/surface/server.cc.

◆ set_config_fetcher()

void grpc_core::Server::set_config_fetcher ( std::unique_ptr< grpc_server_config_fetcher config_fetcher)
inline

Definition at line 144 of file src/core/lib/surface/server.h.

◆ SetBatchMethodAllocator()

void grpc_core::Server::SetBatchMethodAllocator ( grpc_completion_queue cq,
std::function< BatchCallAllocation()>  allocator 
)

Definition at line 651 of file src/core/lib/surface/server.cc.

◆ SetRegisteredMethodAllocator()

void grpc_core::Server::SetRegisteredMethodAllocator ( grpc_completion_queue cq,
void *  method_tag,
std::function< RegisteredCallAllocation()>  allocator 
)

Definition at line 643 of file src/core/lib/surface/server.cc.

◆ SetupTransport()

grpc_error_handle grpc_core::Server::SetupTransport ( grpc_transport transport,
grpc_pollset accepting_pollset,
const grpc_channel_args args,
const RefCountedPtr< channelz::SocketNode > &  socket_node 
)

Definition at line 605 of file src/core/lib/surface/server.cc.

◆ ShutdownAndNotify()

void grpc_core::Server::ShutdownAndNotify ( grpc_completion_queue cq,
void *  tag 
)

Definition at line 797 of file src/core/lib/surface/server.cc.

◆ ShutdownCalled()

bool grpc_core::Server::ShutdownCalled ( ) const
inlineprivate

Definition at line 435 of file src/core/lib/surface/server.h.

◆ ShutdownReady()

bool grpc_core::Server::ShutdownReady ( ) const
inlineprivate

Definition at line 442 of file src/core/lib/surface/server.h.

◆ ShutdownRefOnRequest()

bool grpc_core::Server::ShutdownRefOnRequest ( )
inlineprivate

Definition at line 403 of file src/core/lib/surface/server.h.

◆ ShutdownUnrefOnRequest()

void grpc_core::Server::ShutdownUnrefOnRequest ( )
inlineprivate

Definition at line 411 of file src/core/lib/surface/server.h.

◆ ShutdownUnrefOnShutdownCall()

absl::Notification* grpc_core::Server::ShutdownUnrefOnShutdownCall ( )
inlineprivate

Definition at line 424 of file src/core/lib/surface/server.h.

◆ Start()

void grpc_core::Server::Start ( )

Definition at line 568 of file src/core/lib/surface/server.cc.

◆ StopListening()

void grpc_core::Server::StopListening ( )

Definition at line 836 of file src/core/lib/surface/server.cc.

◆ ValidateServerRequest()

grpc_call_error grpc_core::Server::ValidateServerRequest ( grpc_completion_queue cq_for_notification,
void *  tag,
grpc_byte_buffer **  optional_payload,
RegisteredMethod *  rm 
)
staticprivate

Definition at line 881 of file src/core/lib/surface/server.cc.

◆ ValidateServerRequestAndCq()

grpc_call_error grpc_core::Server::ValidateServerRequestAndCq ( size_t *  cq_idx,
grpc_completion_queue cq_for_notification,
void *  tag,
grpc_byte_buffer **  optional_payload,
RegisteredMethod *  rm 
)
private

Definition at line 895 of file src/core/lib/surface/server.cc.

Member Data Documentation

◆ channel_args_

const grpc_channel_args* const grpc_core::Server::channel_args_
private

Definition at line 446 of file src/core/lib/surface/server.h.

◆ channels_

std::list<ChannelData*> grpc_core::Server::channels_
private

Definition at line 486 of file src/core/lib/surface/server.h.

◆ channelz_node_

RefCountedPtr<channelz::ServerNode> grpc_core::Server::channelz_node_
private

Definition at line 447 of file src/core/lib/surface/server.h.

◆ config_fetcher_

std::unique_ptr<grpc_server_config_fetcher> grpc_core::Server::config_fetcher_
private

Definition at line 448 of file src/core/lib/surface/server.h.

◆ cqs_

std::vector<grpc_completion_queue*> grpc_core::Server::cqs_
private

Definition at line 450 of file src/core/lib/surface/server.h.

◆ kServerTopFilter

const grpc_channel_filter grpc_core::Server::kServerTopFilter
static

◆ last_shutdown_message_time_

gpr_timespec grpc_core::Server::last_shutdown_message_time_
private

Definition at line 492 of file src/core/lib/surface/server.h.

◆ listeners_

std::list<Listener> grpc_core::Server::listeners_
private

Definition at line 488 of file src/core/lib/surface/server.h.

◆ listeners_destroyed_

size_t grpc_core::Server::listeners_destroyed_ = 0
private

Definition at line 489 of file src/core/lib/surface/server.h.

◆ mu_call_ [1/2]

void grpc_core::Server::mu_call_

Definition at line 196 of file src/core/lib/surface/server.h.

◆ mu_call_ [2/2]

Mutex grpc_core::Server::mu_call_
private

Definition at line 462 of file src/core/lib/surface/server.h.

◆ mu_global_

Mutex grpc_core::Server::mu_global_
private

Definition at line 461 of file src/core/lib/surface/server.h.

◆ pollsets_

std::vector<grpc_pollset*> grpc_core::Server::pollsets_
private

Definition at line 451 of file src/core/lib/surface/server.h.

◆ registered_methods_

std::vector<std::unique_ptr<RegisteredMethod> > grpc_core::Server::registered_methods_
private

Definition at line 469 of file src/core/lib/surface/server.h.

◆ shutdown_refs_

std::atomic<int> grpc_core::Server::shutdown_refs_ {1}
private

Definition at line 480 of file src/core/lib/surface/server.h.

◆ started_

bool grpc_core::Server::started_ = false
private

Definition at line 452 of file src/core/lib/surface/server.h.

◆ starting_cv_

CondVar grpc_core::Server::starting_cv_
private

Definition at line 467 of file src/core/lib/surface/server.h.

◆ unregistered_request_matcher_

std::unique_ptr<RequestMatcherInterface> grpc_core::Server::unregistered_request_matcher_
private

Definition at line 472 of file src/core/lib/surface/server.h.


The documentation for this class was generated from the following files:
grpc_core::Server::CallData::StartTransportStreamOpBatch
static void StartTransportStreamOpBatch(grpc_call_element *elem, grpc_transport_stream_op_batch *batch)
Definition: src/core/lib/surface/server.cc:1444
grpc_channel_next_op
void grpc_channel_next_op(grpc_channel_element *elem, grpc_transport_op *op)
Definition: channel_stack.cc:264
grpc_call_stack_ignore_set_pollset_or_pollset_set
void grpc_call_stack_ignore_set_pollset_or_pollset_set(grpc_call_element *, grpc_polling_entity *)
Definition: channel_stack.cc:233
grpc_core::Server::ChannelData::DestroyChannelElement
static void DestroyChannelElement(grpc_channel_element *elem)
Definition: src/core/lib/surface/server.cc:1172
grpc_core::Server::CallData::DestroyCallElement
static void DestroyCallElement(grpc_call_element *elem, const grpc_call_final_info *, grpc_closure *)
Definition: src/core/lib/surface/server.cc:1437
grpc_channel_stack_no_post_init
void grpc_channel_stack_no_post_init(grpc_channel_stack *, grpc_channel_element *)
Definition: channel_stack.cc:282
grpc_channel_next_get_info
void grpc_channel_next_get_info(grpc_channel_element *elem, const grpc_channel_info *channel_info)
Definition: channel_stack.cc:258
grpc_core::Server::CallData::InitCallElement
static grpc_error_handle InitCallElement(grpc_call_element *elem, const grpc_call_element_args *args)
Definition: src/core/lib/surface/server.cc:1430
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
Author(s):
autogenerated on Fri May 16 2025 03:03:37