aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-10-08 15:51:39 -0700
committerGravatar Muxi Yan <mxyan@google.com>2018-10-08 15:51:39 -0700
commit0fd4727defda5f8bef106a1f3b59263886b9b6c6 (patch)
tree698c2bf1b6b31e6a652b7093b48d0fae81b11090
parente2e5c8189310841f7edd5ae8a51a616c9d93b309 (diff)
deprecated old API
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+ChannelArg.h34
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+ChannelArg.m5
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h10
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+Cronet.h13
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+OAuth2.h29
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+Tests.h25
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+Tests.m4
7 files changed, 15 insertions, 105 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
index 803f19dedf..2ddd53a5c6 100644
--- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
+++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
@@ -19,52 +19,20 @@
#include <AvailabilityMacros.h>
-typedef NS_ENUM(NSInteger, GRPCCompressAlgorithm) {
- GRPCCompressNone,
- GRPCCompressDeflate,
- GRPCCompressGzip,
-};
-
-/**
- * Methods to configure GRPC channel options.
- */
+// Deprecated interface. Please use GRPCCallOptions instead.
@interface GRPCCall (ChannelArg)
-/**
- * Use the provided @c userAgentPrefix at the beginning of the HTTP User Agent string for all calls
- * to the specified @c host.
- */
+ (void)setUserAgentPrefix:(nonnull NSString *)userAgentPrefix forHost:(nonnull NSString *)host;
-
-/** The default response size limit is 4MB. Set this to override that default. */
+ (void)setResponseSizeLimit:(NSUInteger)limit forHost:(nonnull NSString *)host;
-
+ (void)closeOpenConnections DEPRECATED_MSG_ATTRIBUTE(
"The API for this feature is experimental, "
"and might be removed or modified at any "
"time.");
-
+ (void)setDefaultCompressMethod:(GRPCCompressAlgorithm)algorithm forhost:(nonnull NSString *)host;
-
-/** Enable keepalive and configure keepalive parameters. A user should call this function once to
- * enable keepalive for a particular host. gRPC client sends a ping after every \a interval ms to
- * check if the transport is still alive. After waiting for \a timeout ms, if the client does not
- * receive the ping ack, it closes the transport; all pending calls to this host will fail with
- * error GRPC_STATUS_INTERNAL with error information "keepalive watchdog timeout". */
+ (void)setKeepaliveWithInterval:(int)interval
timeout:(int)timeout
forHost:(nonnull NSString *)host;
-
-/** Enable/Disable automatic retry of gRPC calls on the channel. If automatic retry is enabled, the
- * retry is controlled by server's service config. If automatic retry is disabled, failed calls are
- * immediately returned to the application layer. */
+ (void)enableRetry:(BOOL)enabled forHost:(nonnull NSString *)host;
-
-/** Set channel connection timeout and backoff parameters. All parameters are positive integers in
- * milliseconds. Set a parameter to 0 to make gRPC use default value for that parameter.
- *
- * Refer to gRPC's doc at https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md for the
- * details of each parameter. */
+ (void)setMinConnectTimeout:(unsigned int)timeout
initialBackoff:(unsigned int)initialBackoff
maxBackoff:(unsigned int)maxBackoff
diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
index 0e631fb3ad..d01d0c0d4f 100644
--- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
+++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
@@ -18,6 +18,7 @@
#import "GRPCCall+ChannelArg.h"
+#import "private/GRPCChannel.h"
#import "private/GRPCHost.h"
#import <grpc/impl/codegen/compression_types.h>
@@ -31,11 +32,11 @@
+ (void)setResponseSizeLimit:(NSUInteger)limit forHost:(nonnull NSString *)host {
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
- hostConfig.responseSizeLimitOverride = @(limit);
+ hostConfig.responseSizeLimitOverride = limit;
}
+ (void)closeOpenConnections {
- [GRPCHost flushChannelCache];
+ [GRPCChannel closeOpenConnections];
}
+ (void)setDefaultCompressMethod:(GRPCCompressAlgorithm)algorithm forhost:(nonnull NSString *)host {
diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h
index d7d15c4ee3..7d6f79b765 100644
--- a/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h
+++ b/src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h
@@ -18,20 +18,12 @@
#import "GRPCCall.h"
-/** Helpers for setting TLS Trusted Roots, Client Certificates, and Private Key */
+// Deprecated interface. Please use GRPCCallOptions instead.
@interface GRPCCall (ChannelCredentials)
-/**
- * Use the provided @c pemRootCert as the set of trusted root Certificate Authorities for @c host.
- */
+ (BOOL)setTLSPEMRootCerts:(nullable NSString *)pemRootCert
forHost:(nonnull NSString *)host
error:(NSError *_Nullable *_Nullable)errorPtr;
-/**
- * Configures @c host with TLS/SSL Client Credentials and optionally trusted root Certificate
- * Authorities. If @c pemRootCerts is nil, the default CA Certificates bundled with gRPC will be
- * used.
- */
+ (BOOL)setTLSPEMRootCerts:(nullable NSString *)pemRootCerts
withPrivateKey:(nullable NSString *)pemPrivateKey
withCertChain:(nullable NSString *)pemCertChain
diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h
index 2a5f6e9cf0..3059c6f186 100644
--- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h
+++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h
@@ -20,22 +20,11 @@
#import "GRPCCall.h"
-/**
- * Methods for using cronet transport.
- */
+// Deprecated interface. Please use GRPCCallOptions instead.
@interface GRPCCall (Cronet)
-/**
- * This method should be called before issuing the first RPC. It should be
- * called only once. Create an instance of Cronet engine in your app elsewhere
- * and pass the instance pointer in the stream_engine parameter. Once set,
- * all subsequent RPCs will use Cronet transport. The method is not thread
- * safe.
- */
+ (void)useCronetWithEngine:(stream_engine*)engine;
-
+ (stream_engine*)cronetEngine;
-
+ (BOOL)isUsingCronet;
@end
diff --git a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h
index adb1042aa0..3054bfc5a7 100644
--- a/src/objective-c/GRPCClient/GRPCCall+OAuth2.h
+++ b/src/objective-c/GRPCClient/GRPCCall+OAuth2.h
@@ -18,34 +18,13 @@
#import "GRPCCall.h"
-/**
- * The protocol of an OAuth2 token object from which GRPCCall can acquire a token.
- */
-@protocol GRPCAuthorizationProtocol
-- (void)getTokenWithHandler:(void (^)(NSString *token))hander;
-@end
+#import "GRPCCallOptions.h"
-/** Helpers for setting and reading headers compatible with OAuth2. */
+// Deprecated interface. Please use GRPCCallOptions instead.
@interface GRPCCall (OAuth2)
-/**
- * Setting this property is equivalent to setting "Bearer <passed token>" as the value of the
- * request header with key "authorization" (the authorization header). Setting it to nil removes the
- * authorization header from the request.
- * The value obtained by getting the property is the OAuth2 bearer token if the authorization header
- * of the request has the form "Bearer <token>", or nil otherwise.
- */
-@property(atomic, copy) NSString *oauth2AccessToken;
-
-/** Returns the value (if any) of the "www-authenticate" response header (the challenge header). */
-@property(atomic, readonly) NSString *oauth2ChallengeHeader;
-
-/**
- * The authorization token object to be used when starting the call. If the value is set to nil, no
- * oauth authentication will be used.
- *
- * If tokenProvider exists, it takes precedence over the token set by oauth2AccessToken.
- */
+@property(atomic, copy) NSString* oauth2AccessToken;
+@property(atomic, readonly) NSString* oauth2ChallengeHeader;
@property(atomic, strong) id<GRPCAuthorizationProtocol> tokenProvider;
@end
diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.h b/src/objective-c/GRPCClient/GRPCCall+Tests.h
index 5d35182ae5..edaa5ed582 100644
--- a/src/objective-c/GRPCClient/GRPCCall+Tests.h
+++ b/src/objective-c/GRPCClient/GRPCCall+Tests.h
@@ -18,34 +18,13 @@
#import "GRPCCall.h"
-/**
- * Methods to let tune down the security of gRPC connections for specific hosts. These shouldn't be
- * used in releases, but are sometimes needed for testing.
- */
+// Deprecated interface. Please use GRPCCallOptions instead.
@interface GRPCCall (Tests)
-/**
- * Establish all SSL connections to the provided host using the passed SSL target name and the root
- * certificates found in the file at |certsPath|.
- *
- * Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
- * more than one invocation of the methods of this category.
- */
+ (void)useTestCertsPath:(NSString *)certsPath
testName:(NSString *)testName
forHost:(NSString *)host;
-
-/**
- * Establish all connections to the provided host using cleartext instead of SSL.
- *
- * Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
- * more than one invocation of the methods of this category.
- */
+ (void)useInsecureConnectionsForHost:(NSString *)host;
-
-/**
- * Resets all host configurations to their default values, and flushes all connections from the
- * cache.
- */
+ (void)resetHostSettings;
+
@end
diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.m b/src/objective-c/GRPCClient/GRPCCall+Tests.m
index 0db3ad6b39..ac3b6a658f 100644
--- a/src/objective-c/GRPCClient/GRPCCall+Tests.m
+++ b/src/objective-c/GRPCClient/GRPCCall+Tests.m
@@ -20,6 +20,8 @@
#import "private/GRPCHost.h"
+#import "GRPCCallOptions.h"
+
@implementation GRPCCall (Tests)
+ (void)useTestCertsPath:(NSString *)certsPath
@@ -42,7 +44,7 @@
+ (void)useInsecureConnectionsForHost:(NSString *)host {
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
- hostConfig.secure = NO;
+ hostConfig.transportType = GRPCTransportTypeInsecure;
}
+ (void)resetHostSettings {