[XdsCertificateProvider] clean up some cruft (#35227)

- Remove old-style channel args utility methods, which are unused.
- Change `ChannelArgsCompare()` to delegate to the `Compare()` method.

Closes #35227

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35227 from markdroth:xds_cert_provider_cleanup 57dc0c0757
PiperOrigin-RevId: 588440245
pull/35231/head
Mark D. Roth 1 year ago committed by Copybara-Service
parent e8d9f222f5
commit e497eed251
  1. 39
      src/core/ext/xds/xds_certificate_provider.cc
  2. 23
      src/core/ext/xds/xds_certificate_provider.h

@ -374,43 +374,4 @@ void XdsCertificateProvider::WatchStatusCallback(std::string cert_name,
if (it->second->IsSafeToRemove()) certificate_state_map_.erase(it); if (it->second->IsSafeToRemove()) certificate_state_map_.erase(it);
} }
namespace {
void* XdsCertificateProviderArgCopy(void* p) {
XdsCertificateProvider* xds_certificate_provider =
static_cast<XdsCertificateProvider*>(p);
return xds_certificate_provider->Ref().release();
}
void XdsCertificateProviderArgDestroy(void* p) {
XdsCertificateProvider* xds_certificate_provider =
static_cast<XdsCertificateProvider*>(p);
xds_certificate_provider->Unref();
}
int XdsCertificateProviderArgCmp(void* p, void* q) {
return QsortCompare(p, q);
}
const grpc_arg_pointer_vtable kChannelArgVtable = {
XdsCertificateProviderArgCopy, XdsCertificateProviderArgDestroy,
XdsCertificateProviderArgCmp};
} // namespace
grpc_arg XdsCertificateProvider::MakeChannelArg() const {
return grpc_channel_arg_pointer_create(
const_cast<char*>(GRPC_ARG_XDS_CERTIFICATE_PROVIDER),
const_cast<XdsCertificateProvider*>(this), &kChannelArgVtable);
}
RefCountedPtr<XdsCertificateProvider>
XdsCertificateProvider::GetFromChannelArgs(const grpc_channel_args* args) {
XdsCertificateProvider* xds_certificate_provider =
grpc_channel_args_find_pointer<XdsCertificateProvider>(
args, GRPC_ARG_XDS_CERTIFICATE_PROVIDER);
return xds_certificate_provider != nullptr ? xds_certificate_provider->Ref()
: nullptr;
}
} // namespace grpc_core } // namespace grpc_core

@ -40,9 +40,6 @@
#include "src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h" #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h"
#include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h" #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h"
#define GRPC_ARG_XDS_CERTIFICATE_PROVIDER \
"grpc.internal.xds_certificate_provider"
namespace grpc_core { namespace grpc_core {
class XdsCertificateProvider : public grpc_tls_certificate_provider { class XdsCertificateProvider : public grpc_tls_certificate_provider {
@ -50,15 +47,6 @@ class XdsCertificateProvider : public grpc_tls_certificate_provider {
XdsCertificateProvider(); XdsCertificateProvider();
~XdsCertificateProvider() override; ~XdsCertificateProvider() override;
static absl::string_view ChannelArgName() {
return GRPC_ARG_XDS_CERTIFICATE_PROVIDER;
}
static int ChannelArgsCompare(const XdsCertificateProvider* a,
const XdsCertificateProvider* b) {
return QsortCompare(a, b);
}
RefCountedPtr<grpc_tls_certificate_distributor> distributor() const override { RefCountedPtr<grpc_tls_certificate_distributor> distributor() const override {
return distributor_; return distributor_;
} }
@ -86,10 +74,13 @@ class XdsCertificateProvider : public grpc_tls_certificate_provider {
void UpdateSubjectAlternativeNameMatchers( void UpdateSubjectAlternativeNameMatchers(
const std::string& cluster, std::vector<StringMatcher> matchers); const std::string& cluster, std::vector<StringMatcher> matchers);
grpc_arg MakeChannelArg() const; static absl::string_view ChannelArgName() {
return "grpc.internal.xds_certificate_provider";
static RefCountedPtr<XdsCertificateProvider> GetFromChannelArgs( }
const grpc_channel_args* args); static int ChannelArgsCompare(const XdsCertificateProvider* a,
const XdsCertificateProvider* b) {
return a->Compare(b);
}
private: private:
class ClusterCertificateState { class ClusterCertificateState {

Loading…
Cancel
Save