aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2017-12-03 22:24:31 +0000
committerGravatar Nathaniel Manista <nathaniel@google.com>2017-12-03 22:33:19 +0000
commitdfe8403280b27f0577af82ba216d81fd47375675 (patch)
tree99b1bc2128b0d080933b10ddef2f9903e603d711 /src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
parent992b8c10b437ba4d30444bedea73628cd0ec8b15 (diff)
Change client-side credentials' use of gRPC Core
Rather than allocating gRPC Core memory when instantiated and retaining it until deleted, gRPC Python's credentials objects now offer methods to create gRPC Core structures on demand.
Diffstat (limited to 'src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi')
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi82
1 files changed, 52 insertions, 30 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
index bc0f185c77..7e9ea33ca0 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
@@ -12,20 +12,66 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cimport cpython
+
+cdef class CallCredentials:
+
+ cdef grpc_call_credentials *c(self)
+
+ # TODO(https://github.com/grpc/grpc/issues/12531): remove.
+ cdef grpc_call_credentials *c_credentials
+
+
+cdef int _get_metadata(
+ void *state, grpc_auth_metadata_context context,
+ grpc_credentials_plugin_metadata_cb cb, void *user_data,
+ grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
+ size_t *num_creds_md, grpc_status_code *status,
+ const char **error_details) with gil
+
+cdef void _destroy(void *state) with gil
+
+
+cdef class MetadataPluginCallCredentials(CallCredentials):
+
+ cdef readonly object _metadata_plugin
+ cdef readonly bytes _name
+
+ cdef grpc_call_credentials *c(self)
+
+
+cdef grpc_call_credentials *_composition(call_credentialses)
+
+
+cdef class CompositeCallCredentials(CallCredentials):
+
+ cdef readonly tuple _call_credentialses
+
+ cdef grpc_call_credentials *c(self)
cdef class ChannelCredentials:
+ cdef grpc_channel_credentials *c(self)
+
+ # TODO(https://github.com/grpc/grpc/issues/12531): remove.
cdef grpc_channel_credentials *c_credentials
- cdef grpc_ssl_pem_key_cert_pair c_ssl_pem_key_cert_pair
- cdef list references
-cdef class CallCredentials:
+cdef class SSLChannelCredentials(ChannelCredentials):
- cdef grpc_call_credentials *c_credentials
- cdef list references
+ cdef readonly object _pem_root_certificates
+ cdef readonly object _private_key
+ cdef readonly object _certificate_chain
+
+ cdef grpc_channel_credentials *c(self)
+
+
+cdef class CompositeChannelCredentials(ChannelCredentials):
+
+ cdef readonly tuple _call_credentialses
+ cdef readonly ChannelCredentials _channel_credentials
+
+ cdef grpc_channel_credentials *c(self)
cdef class ServerCertificateConfig:
@@ -49,27 +95,3 @@ cdef class ServerCredentials:
cdef object cert_config_fetcher
# whether C-core has asked for the initial_cert_config
cdef bint initial_cert_config_fetched
-
-
-cdef class CredentialsMetadataPlugin:
-
- cdef object plugin_callback
- cdef bytes plugin_name
-
-
-cdef grpc_metadata_credentials_plugin _c_plugin(CredentialsMetadataPlugin plugin)
-
-
-cdef class AuthMetadataContext:
-
- cdef grpc_auth_metadata_context context
-
-
-cdef int plugin_get_metadata(
- void *state, grpc_auth_metadata_context context,
- grpc_credentials_plugin_metadata_cb cb, void *user_data,
- grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
- size_t *num_creds_md, grpc_status_code *status,
- const char **error_details) with gil
-
-cdef void plugin_destroy_c_plugin_state(void *state) with gil