diff options
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.h | 16 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.m | 2 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCallOptions.h | 8 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCallOptions.m | 14 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/ChannelArgsUtil.h | 14 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCChannel.h | 2 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCChannel.m | 2 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCChannelFactory.h | 2 | ||||
-rw-r--r-- | src/objective-c/ProtoRPC/ProtoRPC.h | 11 | ||||
-rw-r--r-- | src/objective-c/ProtoRPC/ProtoRPC.m | 11 | ||||
-rw-r--r-- | src/objective-c/tests/GRPCClientTests.m | 7 | ||||
-rw-r--r-- | src/objective-c/tests/InteropTests.m | 7 |
12 files changed, 52 insertions, 44 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 13dcfa0713..b3936ad8fc 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -147,8 +147,8 @@ typedef NS_ENUM(NSUInteger, GRPCErrorCode) { * Keys used in |NSError|'s |userInfo| dictionary to store the response headers and trailers sent by * the server. */ -extern NSString * const kGRPCHeadersKey; -extern NSString * const kGRPCTrailersKey; +extern NSString *const kGRPCHeadersKey; +extern NSString *const kGRPCTrailersKey; /** An object can implement this protocol to receive responses from server from a call. */ @protocol GRPCResponseHandler<NSObject> @@ -156,13 +156,13 @@ extern NSString * const kGRPCTrailersKey; @optional /** Issued when initial metadata is received from the server. */ -- (void)receivedInitialMetadata:(NSDictionary * _Nullable)initialMetadata; +- (void)receivedInitialMetadata:(NSDictionary *_Nullable)initialMetadata; /** * Issued when a message is received from the server. The message is the raw data received from the * server, with decompression and without proto deserialization. */ -- (void)receivedRawMessage:(NSData * _Nullable)message; +- (void)receivedRawMessage:(NSData *_Nullable)message; /** * Issued when a call finished. If the call finished successfully, \a error is nil and \a @@ -170,7 +170,8 @@ extern NSString * const kGRPCTrailersKey; * is non-nil and contains the corresponding error information, including gRPC error codes and * error descriptions. */ -- (void)closedWithTrailingMetadata:(NSDictionary * _Nullable)trailingMetadata error:(NSError * _Nullable)error; +- (void)closedWithTrailingMetadata:(NSDictionary *_Nullable)trailingMetadata + error:(NSError *_Nullable)error; @required @@ -218,7 +219,7 @@ extern NSString * const kGRPCTrailersKey; - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; ++ (instancetype) new NS_UNAVAILABLE; /** * Designated initializer for a call. @@ -228,7 +229,8 @@ extern NSString * const kGRPCTrailersKey; */ - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions responseHandler:(id<GRPCResponseHandler>)responseHandler - callOptions:(GRPCCallOptions * _Nullable)callOptions NS_DESIGNATED_INITIALIZER; + callOptions:(GRPCCallOptions *_Nullable)callOptions + NS_DESIGNATED_INITIALIZER; /** * Convenience initializer for a call that uses default call options (see GRPCCallOptions.m for * the default options). diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 34a0e436ea..60a946a472 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -108,7 +108,7 @@ const char *kCFStreamVarName = "grpc_cfstream"; - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions responseHandler:(id<GRPCResponseHandler>)responseHandler - callOptions:(GRPCCallOptions * _Nullable)callOptions { + callOptions:(GRPCCallOptions *_Nullable)callOptions { if (requestOptions.host.length == 0 || requestOptions.path.length == 0) { [NSException raise:NSInvalidArgumentException format:@"Neither host nor path can be nil."]; } diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index 4a93db84bc..d1daaa1d82 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -27,14 +27,12 @@ typedef NS_ENUM(NSUInteger, GRPCCallSafety) { /** Signal that the call is idempotent. gRPC is free to use PUT verb. */ GRPCCallSafetyIdempotentRequest = 1, /** - * Signal that the call is cacheable and will not affect server state. gRPC is free to use GET - * verb. - */ + * Signal that the call is cacheable and will not affect server state. gRPC is free to use GET + * verb. + */ GRPCCallSafetyCacheableRequest = 2, }; - - // Compression algorithm to be used by a gRPC call typedef NS_ENUM(NSInteger, GRPCCompressionAlgorithm) { GRPCCompressNone = 0, diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.m b/src/objective-c/GRPCClient/GRPCCallOptions.m index e148664925..fe75c17b09 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.m +++ b/src/objective-c/GRPCClient/GRPCCallOptions.m @@ -102,7 +102,7 @@ static const NSUInteger kDefaultChannelID = 0; initialMetadata:kDefaultInitialMetadata userAgentPrefix:kDefaultUserAgentPrefix responseSizeLimit:kDefaultResponseSizeLimit - compressionAlgorithm:kDefaultCompressionAlgorithm + compressionAlgorithm:kDefaultCompressionAlgorithm enableRetry:kDefaultEnableRetry keepaliveInterval:kDefaultKeepaliveInterval keepaliveTimeout:kDefaultKeepaliveTimeout @@ -127,7 +127,7 @@ static const NSUInteger kDefaultChannelID = 0; initialMetadata:(NSDictionary *)initialMetadata userAgentPrefix:(NSString *)userAgentPrefix responseSizeLimit:(NSUInteger)responseSizeLimit - compressionAlgorithm:(GRPCCompressionAlgorithm)compressionAlgorithm + compressionAlgorithm:(GRPCCompressionAlgorithm)compressionAlgorithm enableRetry:(BOOL)enableRetry keepaliveInterval:(NSTimeInterval)keepaliveInterval keepaliveTimeout:(NSTimeInterval)keepaliveTimeout @@ -181,7 +181,7 @@ static const NSUInteger kDefaultChannelID = 0; initialMetadata:_initialMetadata userAgentPrefix:_userAgentPrefix responseSizeLimit:_responseSizeLimit - compressionAlgorithm:_compressionAlgorithm + compressionAlgorithm:_compressionAlgorithm enableRetry:_enableRetry keepaliveInterval:_keepaliveInterval keepaliveTimeout:_keepaliveTimeout @@ -209,7 +209,7 @@ static const NSUInteger kDefaultChannelID = 0; initialMetadata:_initialMetadata userAgentPrefix:_userAgentPrefix responseSizeLimit:_responseSizeLimit - compressionAlgorithm:_compressionAlgorithm + compressionAlgorithm:_compressionAlgorithm enableRetry:_enableRetry keepaliveInterval:_keepaliveInterval keepaliveTimeout:_keepaliveTimeout @@ -326,7 +326,7 @@ static const NSUInteger kDefaultChannelID = 0; initialMetadata:kDefaultInitialMetadata userAgentPrefix:kDefaultUserAgentPrefix responseSizeLimit:kDefaultResponseSizeLimit - compressionAlgorithm:kDefaultCompressionAlgorithm + compressionAlgorithm:kDefaultCompressionAlgorithm enableRetry:kDefaultEnableRetry keepaliveInterval:kDefaultKeepaliveInterval keepaliveTimeout:kDefaultKeepaliveTimeout @@ -353,7 +353,7 @@ static const NSUInteger kDefaultChannelID = 0; initialMetadata:_initialMetadata userAgentPrefix:_userAgentPrefix responseSizeLimit:_responseSizeLimit - compressionAlgorithm:_compressionAlgorithm + compressionAlgorithm:_compressionAlgorithm enableRetry:_enableRetry keepaliveInterval:_keepaliveInterval keepaliveTimeout:_keepaliveTimeout @@ -381,7 +381,7 @@ static const NSUInteger kDefaultChannelID = 0; initialMetadata:_initialMetadata userAgentPrefix:_userAgentPrefix responseSizeLimit:_responseSizeLimit - compressionAlgorithm:_compressionAlgorithm + compressionAlgorithm:_compressionAlgorithm enableRetry:_enableRetry keepaliveInterval:_keepaliveInterval keepaliveTimeout:_keepaliveTimeout diff --git a/src/objective-c/GRPCClient/private/ChannelArgsUtil.h b/src/objective-c/GRPCClient/private/ChannelArgsUtil.h index 3fb876ecc4..f271e846f0 100644 --- a/src/objective-c/GRPCClient/private/ChannelArgsUtil.h +++ b/src/objective-c/GRPCClient/private/ChannelArgsUtil.h @@ -24,11 +24,15 @@ void GRPCFreeChannelArgs(grpc_channel_args* channel_args); /** - * Allocates a @c grpc_channel_args and populates it with the options specified in the - * @c dictionary. Keys must be @c NSString, @c NSNumber, or a pointer. If the value responds to - * @c @selector(UTF8String) then it will be mapped to @c GRPC_ARG_STRING. If the value responds to - * @c @selector(intValue), it will be mapped to @c GRPC_ARG_INTEGER. Otherwise, if the value is not - * nil, it is mapped as a pointer. The caller of this function is responsible for calling + * Allocates a @c grpc_channel_args and populates it with the options specified + * in the + * @c dictionary. Keys must be @c NSString, @c NSNumber, or a pointer. If the + * value responds to + * @c @selector(UTF8String) then it will be mapped to @c GRPC_ARG_STRING. If the + * value responds to + * @c @selector(intValue), it will be mapped to @c GRPC_ARG_INTEGER. Otherwise, + * if the value is not nil, it is mapped as a pointer. The caller of this + * function is responsible for calling * @c GRPCFreeChannelArgs to free the @c grpc_channel_args struct. */ grpc_channel_args* GRPCBuildChannelArgs(NSDictionary* dictionary); diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h index 7151dbb6e9..e1bf8fb1af 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.h +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -32,7 +32,7 @@ struct grpc_channel_credentials; - (nullable instancetype)init NS_UNAVAILABLE; -+ (nullable instancetype)new NS_UNAVAILABLE; ++ (nullable instancetype) new NS_UNAVAILABLE; /** * Returns a channel connecting to \a host with options as \a callOptions. The channel may be new diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index f3ac140599..018ed28a7a 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -222,7 +222,7 @@ static GRPCChannelPool *gChannelPool; }); } -- (nullable instancetype)initWithUnmanagedChannel:(grpc_channel * _Nullable)unmanagedChannel +- (nullable instancetype)initWithUnmanagedChannel:(grpc_channel *_Nullable)unmanagedChannel configuration:(GRPCChannelConfiguration *)configuration { NSAssert(configuration, @"Configuration must not be empty."); if (!unmanagedChannel) { diff --git a/src/objective-c/GRPCClient/private/GRPCChannelFactory.h b/src/objective-c/GRPCClient/private/GRPCChannelFactory.h index 14dc7079ba..a934e966e9 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannelFactory.h +++ b/src/objective-c/GRPCClient/private/GRPCChannelFactory.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN /** A factory interface which generates new channel. */ @protocol GRPCChannelFactory - /** Create a channel with specific channel args to a specific host. */ +/** Create a channel with specific channel args to a specific host. */ - (nullable grpc_channel *)createChannelWithHost:(NSString *)host channelArgs:(nullable NSDictionary *)args; diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index 3a7fd58fb1..960a9a12bd 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -31,12 +31,12 @@ NS_ASSUME_NONNULL_BEGIN @optional /** Issued when initial metadata is received from the server. */ -- (void)receivedInitialMetadata:(NSDictionary * _Nullable)initialMetadata; +- (void)receivedInitialMetadata:(NSDictionary *_Nullable)initialMetadata; /** * Issued when a message is received from the server. The message is the deserialized proto object. */ -- (void)receivedProtoMessage:(GPBMessage * _Nullable)message; +- (void)receivedProtoMessage:(GPBMessage *_Nullable)message; /** * Issued when a call finished. If the call finished successfully, \a error is nil and \a @@ -44,7 +44,8 @@ NS_ASSUME_NONNULL_BEGIN * is non-nil and contains the corresponding error information, including gRPC error codes and * error descriptions. */ -- (void)closedWithTrailingMetadata:(NSDictionary * _Nullable)trailingMetadata error:(NSError * _Nullable)error; +- (void)closedWithTrailingMetadata:(NSDictionary *_Nullable)trailingMetadata + error:(NSError *_Nullable)error; @required @@ -70,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions message:(GPBMessage *)message responseHandler:(id<GRPCProtoResponseHandler>)handler - callOptions:(GRPCCallOptions * _Nullable)callOptions + callOptions:(GRPCCallOptions *_Nullable)callOptions responseClass:(Class)responseClass NS_DESIGNATED_INITIALIZER; /** @@ -95,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions responseHandler:(id<GRPCProtoResponseHandler>)handler - callOptions:(GRPCCallOptions * _Nullable)callOptions + callOptions:(GRPCCallOptions *_Nullable)callOptions responseClass:(Class)responseClass NS_DESIGNATED_INITIALIZER; /** diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index f6e3298f62..28c037e609 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -34,7 +34,7 @@ - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions message:(GPBMessage *)message responseHandler:(id<GRPCProtoResponseHandler>)handler - callOptions:(GRPCCallOptions * _Nullable)callOptions + callOptions:(GRPCCallOptions *_Nullable)callOptions responseClass:(Class)responseClass { if ((self = [super init])) { _call = [[GRPCStreamingProtoCall alloc] initWithRequestOptions:requestOptions @@ -70,7 +70,7 @@ - (instancetype)initWithRequestOptions:(GRPCRequestOptions *)requestOptions responseHandler:(id<GRPCProtoResponseHandler>)handler - callOptions:(GRPCCallOptions * _Nullable)callOptions + callOptions:(GRPCCallOptions *_Nullable)callOptions responseClass:(Class)responseClass { if (requestOptions.host.length == 0 || requestOptions.path.length == 0) { [NSException raise:NSInvalidArgumentException format:@"Neither host nor path can be nil."]; @@ -153,7 +153,7 @@ }); } -- (void)receivedInitialMetadata:(NSDictionary * _Nullable)initialMetadata { +- (void)receivedInitialMetadata:(NSDictionary *_Nullable)initialMetadata { if (_handler && initialMetadata != nil) { id<GRPCProtoResponseHandler> handler = _handler; if ([handler respondsToSelector:@selector(initialMetadata:)]) { @@ -164,7 +164,7 @@ } } -- (void)receivedRawMessage:(NSData * _Nullable)message { +- (void)receivedRawMessage:(NSData *_Nullable)message { if (_handler && message != nil) { id<GRPCProtoResponseHandler> handler = _handler; NSError *error = nil; @@ -188,7 +188,8 @@ } } -- (void)closedWithTrailingMetadata:(NSDictionary * _Nullable)trailingMetadata error:(NSError * _Nullable)error { +- (void)closedWithTrailingMetadata:(NSDictionary *_Nullable)trailingMetadata + error:(NSError *_Nullable)error { if (_handler) { id<GRPCProtoResponseHandler> handler = _handler; if ([handler respondsToSelector:@selector(closedWithTrailingMetadata:error:)]) { diff --git a/src/objective-c/tests/GRPCClientTests.m b/src/objective-c/tests/GRPCClientTests.m index 0a9ec97c48..0d1b80e33c 100644 --- a/src/objective-c/tests/GRPCClientTests.m +++ b/src/objective-c/tests/GRPCClientTests.m @@ -114,19 +114,20 @@ static GRPCProtoMethod *kFullDuplexCallMethod; return self; } -- (void)receivedInitialMetadata:(NSDictionary * _Nullable)initialMetadata { +- (void)receivedInitialMetadata:(NSDictionary *_Nullable)initialMetadata { if (_initialMetadataCallback) { _initialMetadataCallback(initialMetadata); } } -- (void)receivedProtoMessage:(GPBMessage * _Nullable)message { +- (void)receivedProtoMessage:(GPBMessage *_Nullable)message { if (_messageCallback) { _messageCallback(message); } } -- (void)closedWithTrailingMetadata:(NSDictionary * _Nullable)trailingMetadata error:(NSError * _Nullable)error { +- (void)closedWithTrailingMetadata:(NSDictionary *_Nullable)trailingMetadata + error:(NSError *_Nullable)error { if (_closeCallback) { _closeCallback(trailingMetadata, error); } diff --git a/src/objective-c/tests/InteropTests.m b/src/objective-c/tests/InteropTests.m index fb49bb99e0..d67dc0743e 100644 --- a/src/objective-c/tests/InteropTests.m +++ b/src/objective-c/tests/InteropTests.m @@ -102,19 +102,20 @@ BOOL isRemoteInteropTest(NSString *host) { return self; } -- (void)receivedInitialMetadata:(NSDictionary * _Nullable)initialMetadata { +- (void)receivedInitialMetadata:(NSDictionary *_Nullable)initialMetadata { if (_initialMetadataCallback) { _initialMetadataCallback(initialMetadata); } } -- (void)receivedProtoMessage:(GPBMessage * _Nullable)message { +- (void)receivedProtoMessage:(GPBMessage *_Nullable)message { if (_messageCallback) { _messageCallback(message); } } -- (void)closedWithTrailingMetadata:(NSDictionary * _Nullable)trailingMetadata error:(NSError * _Nullable)error { +- (void)closedWithTrailingMetadata:(NSDictionary *_Nullable)trailingMetadata + error:(NSError *_Nullable)error { if (_closeCallback) { _closeCallback(trailingMetadata, error); } |