GRPCTransportId -> GRPCTransportID

pull/20107/head
Muxi Yan 5 years ago
parent 8a35222164
commit e5e2b79c01
  1. 2
      src/objective-c/GRPCClient/GRPCCall+Cronet.h
  2. 2
      src/objective-c/GRPCClient/GRPCCall+Cronet.m
  3. 4
      src/objective-c/GRPCClient/GRPCCallOptions.h
  4. 8
      src/objective-c/GRPCClient/GRPCCallOptions.m
  5. 2
      src/objective-c/GRPCClient/GRPCInterceptor.h
  6. 4
      src/objective-c/GRPCClient/GRPCInterceptor.m
  7. 10
      src/objective-c/GRPCClient/GRPCTransport.h
  8. 14
      src/objective-c/GRPCClient/GRPCTransport.m
  9. 2
      src/objective-c/GRPCClient/GRPCTypes.h
  10. 4
      src/objective-c/GRPCClient/private/GRPCTransport+Private.h
  11. 4
      src/objective-c/GRPCClient/private/GRPCTransport+Private.m
  12. 2
      src/objective-c/tests/CronetTests/InteropTestsRemoteWithCronet.m
  13. 2
      src/objective-c/tests/InteropTests/InteropTests.h
  14. 2
      src/objective-c/tests/InteropTests/InteropTests.m
  15. 2
      src/objective-c/tests/InteropTests/InteropTestsLocalCleartext.m
  16. 2
      src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m

@ -22,7 +22,7 @@
typedef struct stream_engine stream_engine;
// Transport id for Cronet transport
extern const GRPCTransportId gGRPCCoreCronetId;
extern const GRPCTransportID gGRPCCoreCronetId;
// Deprecated class. Please use the gGRPCCoreCronetId with GRPCCallOptions.transport instead.
@interface GRPCCall (Cronet)

@ -18,7 +18,7 @@
#import "GRPCCall+Cronet.h"
const GRPCTransportId gGRPCCoreCronetId = "io.grpc.transport.core.cronet";
const GRPCTransportID gGRPCCoreCronetId = "io.grpc.transport.core.cronet";
static BOOL useCronet = NO;
static stream_engine *globalCronetEngine;

@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* This is currently an experimental option.
*/
@property(readonly) GRPCTransportId transport;
@property(readonly) GRPCTransportID transport;
/**
* Override the hostname during the TLS hostname validation process.
@ -339,7 +339,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* An interceptor must not change the value of this option.
*/
@property(readwrite) GRPCTransportId transport;
@property(readwrite) GRPCTransportID transport;
/**
* Override the hostname during the TLS hostname validation process.

@ -42,7 +42,7 @@ static NSString *const kDefaultPEMCertificateChain = nil;
static NSString *const kDefaultOauth2AccessToken = nil;
static const id<GRPCAuthorizationProtocol> kDefaultAuthTokenProvider = nil;
static const GRPCTransportType kDefaultTransportType = GRPCTransportTypeChttp2BoringSSL;
static const GRPCTransportId kDefaultTransport = NULL;
static const GRPCTransportID kDefaultTransport = NULL;
static NSString *const kDefaultHostNameOverride = nil;
static const id kDefaultLogContext = nil;
static NSString *const kDefaultChannelPoolDomain = nil;
@ -82,7 +82,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
NSString *_PEMPrivateKey;
NSString *_PEMCertificateChain;
GRPCTransportType _transportType;
GRPCTransportId _transport;
GRPCTransportID _transport;
NSString *_hostNameOverride;
id<NSObject> _logContext;
NSString *_channelPoolDomain;
@ -166,7 +166,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
PEMPrivateKey:(NSString *)PEMPrivateKey
PEMCertificateChain:(NSString *)PEMCertificateChain
transportType:(GRPCTransportType)transportType
transport:(GRPCTransportId)transport
transport:(GRPCTransportID)transport
hostNameOverride:(NSString *)hostNameOverride
logContext:(id)logContext
channelPoolDomain:(NSString *)channelPoolDomain
@ -553,7 +553,7 @@ static BOOL areObjectsEqual(id obj1, id obj2) {
_transportType = transportType;
}
- (void)setTransport:(GRPCTransportId)transport {
- (void)setTransport:(GRPCTransportID)transport {
_transport = transport;
}

@ -177,7 +177,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable instancetype)initWithFactories:(nullable NSArray<id<GRPCInterceptorFactory>> *)factories
previousInterceptor:(nullable id<GRPCResponseHandler>)previousInterceptor
transportId:(GRPCTransportId)transportId;
transportId:(GRPCTransportID)transportId;
/**
* Notify the manager that the interceptor has shut down and the manager should release references

@ -31,13 +31,13 @@
GRPCInterceptor *_thisInterceptor;
dispatch_queue_t _dispatchQueue;
NSArray<id<GRPCInterceptorFactory>> *_factories;
GRPCTransportId _transportId;
GRPCTransportID _transportId;
BOOL _shutDown;
}
- (instancetype)initWithFactories:(NSArray<id<GRPCInterceptorFactory>> *)factories
previousInterceptor:(id<GRPCResponseHandler>)previousInterceptor
transportId:(nonnull GRPCTransportId)transportId {
transportId:(nonnull GRPCTransportID)transportId {
if ((self = [super init])) {
if (factories.count == 0) {
[NSException raise:NSInternalInconsistencyException

@ -29,15 +29,15 @@ NS_ASSUME_NONNULL_BEGIN
* by gRPC by default unless explicitly excluded.
*/
extern const struct GRPCDefaultTransportImplList {
const GRPCTransportId core_secure;
const GRPCTransportId core_insecure;
const GRPCTransportID core_secure;
const GRPCTransportID core_insecure;
} GRPCDefaultTransportImplList;
/** Returns whether two transport id's are identical. */
BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs);
BOOL TransportIdIsEqual(GRPCTransportID lhs, GRPCTransportID rhs);
/** Returns the hash value of a transport id. */
NSUInteger TransportIdHash(GRPCTransportId);
NSUInteger TransportIdHash(GRPCTransportID);
#pragma mark Transport and factory
@ -66,7 +66,7 @@ NSUInteger TransportIdHash(GRPCTransportId);
* Parameter \a transportId is the identifier of the implementation, and \a factory is the factory
* object to create the corresponding transport instance.
*/
- (void)registerTransportWithId:(GRPCTransportId)transportId
- (void)registerTransportWithId:(GRPCTransportID)transportId
factory:(id<GRPCTransportFactory>)factory;
@end

@ -18,24 +18,24 @@
#import "GRPCTransport.h"
static const GRPCTransportId gGRPCCoreSecureId = "io.grpc.transport.core.secure";
static const GRPCTransportId gGRPCCoreInsecureId = "io.grpc.transport.core.insecure";
static const GRPCTransportID gGRPCCoreSecureId = "io.grpc.transport.core.secure";
static const GRPCTransportID gGRPCCoreInsecureId = "io.grpc.transport.core.insecure";
const struct GRPCDefaultTransportImplList GRPCDefaultTransportImplList = {
.core_secure = gGRPCCoreSecureId, .core_insecure = gGRPCCoreInsecureId};
static const GRPCTransportId gDefaultTransportId = gGRPCCoreSecureId;
static const GRPCTransportID gDefaultTransportId = gGRPCCoreSecureId;
static GRPCTransportRegistry *gTransportRegistry = nil;
static dispatch_once_t initTransportRegistry;
BOOL TransportIdIsEqual(GRPCTransportId lhs, GRPCTransportId rhs) {
BOOL TransportIdIsEqual(GRPCTransportID lhs, GRPCTransportID rhs) {
// Directly comparing pointers works because we require users to use the id provided by each
// implementation, not coming up with their own string.
return lhs == rhs;
}
NSUInteger TransportIdHash(GRPCTransportId transportId) {
NSUInteger TransportIdHash(GRPCTransportID transportId) {
if (transportId == NULL) {
transportId = gDefaultTransportId;
}
@ -66,7 +66,7 @@ NSUInteger TransportIdHash(GRPCTransportId transportId) {
return self;
}
- (void)registerTransportWithId:(GRPCTransportId)transportId
- (void)registerTransportWithId:(GRPCTransportID)transportId
factory:(id<GRPCTransportFactory>)factory {
NSString *nsTransportId = [NSString stringWithCString:transportId encoding:NSUTF8StringEncoding];
NSAssert(_registry[nsTransportId] == nil, @"The transport %@ has already been registered.",
@ -83,7 +83,7 @@ NSUInteger TransportIdHash(GRPCTransportId transportId) {
}
}
- (id<GRPCTransportFactory>)getTransportFactoryWithId:(GRPCTransportId)transportId {
- (id<GRPCTransportFactory>)getTransportFactoryWithId:(GRPCTransportID)transportId {
if (transportId == NULL) {
if (_defaultFactory == nil) {
[NSException raise:NSInvalidArgumentException

@ -171,7 +171,7 @@ extern NSString* _Nonnull const kGRPCHeadersKey;
extern NSString* _Nonnull const kGRPCTrailersKey;
/** The id of a transport implementation. */
typedef char* _Nonnull GRPCTransportId;
typedef char* _Nonnull GRPCTransportID;
/**
* Implement this protocol to provide a token to gRPC when a call is initiated.

@ -31,13 +31,13 @@ NS_ASSUME_NONNULL_BEGIN
* registered with the registry, the default transport factory (core + secure) is returned. If the
* default transport does not exist, an exception is thrown.
*/
- (id<GRPCTransportFactory>)getTransportFactoryWithId:(GRPCTransportId)transportId;
- (id<GRPCTransportFactory>)getTransportFactoryWithId:(GRPCTransportID)transportId;
@end
@interface GRPCTransportManager : NSObject<GRPCInterceptorInterface>
- (instancetype)initWithTransportId:(GRPCTransportId)transportId
- (instancetype)initWithTransportId:(GRPCTransportID)transportId
previousInterceptor:(id<GRPCResponseHandler>)previousInterceptor;
/**

@ -21,13 +21,13 @@
#import <GRPCClient/GRPCTransport.h>
@implementation GRPCTransportManager {
GRPCTransportId _transportId;
GRPCTransportID _transportId;
GRPCTransport *_transport;
id<GRPCResponseHandler> _previousInterceptor;
dispatch_queue_t _dispatchQueue;
}
- (instancetype)initWithTransportId:(GRPCTransportId)transportId
- (instancetype)initWithTransportId:(GRPCTransportID)transportId
previousInterceptor:(id<GRPCResponseHandler>)previousInterceptor {
if ((self = [super init])) {
id<GRPCTransportFactory> factory =

@ -52,7 +52,7 @@ static int32_t kRemoteInteropServerOverhead = 12;
return kRemoteSSLHost;
}
+ (GRPCTransportId)transport {
+ (GRPCTransportID)transport {
return gGRPCCoreCronetId;
}

@ -59,7 +59,7 @@
* The transport to be used. The base implementation returns NULL. Subclasses should override to
* appropriate settings.
*/
+ (GRPCTransportId)transport;
+ (GRPCTransportID)transport;
/**
* The root certificates to be used. The base implementation returns nil. Subclasses should override

@ -404,7 +404,7 @@ static dispatch_once_t initGlobalInterceptorFactory;
return GRPCTransportTypeChttp2BoringSSL;
}
+ (GRPCTransportId)transport {
+ (GRPCTransportID)transport {
return NULL;
}

@ -61,7 +61,7 @@ static int32_t kLocalInteropServerOverhead = 10;
[GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost];
}
+ (GRPCTransportId)transport {
+ (GRPCTransportID)transport {
return GRPCDefaultTransportImplList.core_insecure;
}

@ -57,7 +57,7 @@ static int32_t kLocalInteropServerOverhead = 10;
return kLocalInteropServerOverhead; // bytes
}
+ (GRPCTransportId)transport {
+ (GRPCTransportID)transport {
return GRPCDefaultTransportImplList.core_secure;
}

Loading…
Cancel
Save