completion_queue_factory.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
22 
23 #include <grpc/grpc.h>
24 #include <grpc/support/log.h>
25 
27 
28 /*
29  * == Default completion queue factory implementation ==
30  */
31 
33  const grpc_completion_queue_factory* /*factory*/,
36  attr->cq_completion_type, attr->cq_polling_type, attr->cq_shutdown_cb);
37 }
38 
40 
42  "Default Factory", nullptr, &default_vtable};
43 
44 /*
45  * == Completion queue factory APIs
46  */
47 
49  const grpc_completion_queue_attributes* attributes) {
50  GPR_ASSERT(attributes->version >= 1 &&
51  attributes->version <= GRPC_CQ_CURRENT_VERSION);
52 
53  /* The default factory can handle version 1 of the attributes structure. We
54  may have to change this as more fields are added to the structure */
55  return &g_default_cq_factory;
56 }
57 
58 /*
59  * == Completion queue creation APIs ==
60  */
61 
63  GPR_ASSERT(!reserved);
65  GRPC_CQ_DEFAULT_POLLING, nullptr};
67 }
68 
70  GPR_ASSERT(!reserved);
72  GRPC_CQ_DEFAULT_POLLING, nullptr};
74 }
75 
77  grpc_completion_queue_functor* shutdown_callback, void* reserved) {
78  GPR_ASSERT(!reserved);
80  2, GRPC_CQ_CALLBACK, GRPC_CQ_DEFAULT_POLLING, shutdown_callback};
82 }
83 
85  const grpc_completion_queue_factory* factory,
86  const grpc_completion_queue_attributes* attr, void* reserved) {
87  GPR_ASSERT(!reserved);
88  return factory->vtable->create(factory, attr);
89 }
default_create
static grpc_completion_queue * default_create(const grpc_completion_queue_factory *, const grpc_completion_queue_attributes *attr)
Definition: completion_queue_factory.cc:32
grpc_completion_queue_factory_vtable::create
grpc_completion_queue *(* create)(const grpc_completion_queue_factory *, const grpc_completion_queue_attributes *)
Definition: completion_queue_factory.h:27
log.h
grpc_completion_queue_factory_lookup
const grpc_completion_queue_factory * grpc_completion_queue_factory_lookup(const grpc_completion_queue_attributes *attributes)
Definition: completion_queue_factory.cc:48
GRPC_CQ_NEXT
@ GRPC_CQ_NEXT
Definition: grpc_types.h:760
default_vtable
static grpc_completion_queue_factory_vtable default_vtable
Definition: completion_queue_factory.cc:39
g_default_cq_factory
static const grpc_completion_queue_factory g_default_cq_factory
Definition: completion_queue_factory.cc:41
completion_queue.h
grpc_completion_queue_create_for_next
grpc_completion_queue * grpc_completion_queue_create_for_next(void *reserved)
Definition: completion_queue_factory.cc:62
grpc_completion_queue_factory
Definition: completion_queue_factory.h:31
grpc_completion_queue_create_for_callback
grpc_completion_queue * grpc_completion_queue_create_for_callback(grpc_completion_queue_functor *shutdown_callback, void *reserved)
Definition: completion_queue_factory.cc:76
GRPC_CQ_DEFAULT_POLLING
@ GRPC_CQ_DEFAULT_POLLING
Definition: grpc_types.h:743
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc_completion_queue_factory::vtable
grpc_completion_queue_factory_vtable * vtable
Definition: completion_queue_factory.h:34
grpc_completion_queue
Definition: completion_queue.cc:347
grpc.h
grpc_completion_queue_create_internal
grpc_completion_queue * grpc_completion_queue_create_internal(grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, grpc_completion_queue_functor *shutdown_callback)
Definition: completion_queue.cc:514
GRPC_CQ_PLUCK
@ GRPC_CQ_PLUCK
Definition: grpc_types.h:763
grpc_completion_queue_attributes
Definition: grpc_types.h:791
grpc_completion_queue_attributes::version
int version
Definition: grpc_types.h:794
attr
OPENSSL_EXPORT X509_ATTRIBUTE * attr
Definition: x509.h:1666
GRPC_CQ_CURRENT_VERSION
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:789
grpc_completion_queue_factory_vtable
Definition: completion_queue_factory.h:26
grpc_completion_queue_functor
Definition: grpc_types.h:773
grpc_completion_queue_create
grpc_completion_queue * grpc_completion_queue_create(const grpc_completion_queue_factory *factory, const grpc_completion_queue_attributes *attr, void *reserved)
Definition: completion_queue_factory.cc:84
GRPC_CQ_CALLBACK
@ GRPC_CQ_CALLBACK
Definition: grpc_types.h:766
grpc_completion_queue_create_for_pluck
grpc_completion_queue * grpc_completion_queue_create_for_pluck(void *reserved)
Definition: completion_queue_factory.cc:69
completion_queue_factory.h
port_platform.h


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