deprecated old API

pull/16190/head
Muxi Yan 6 years ago
parent e2e5c81893
commit 0fd4727def
  1. 34
      src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
  2. 5
      src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
  3. 10
      src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h
  4. 13
      src/objective-c/GRPCClient/GRPCCall+Cronet.h
  5. 29
      src/objective-c/GRPCClient/GRPCCall+OAuth2.h
  6. 25
      src/objective-c/GRPCClient/GRPCCall+Tests.h
  7. 4
      src/objective-c/GRPCClient/GRPCCall+Tests.m

@ -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

@ -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 {

@ -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

@ -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

@ -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

@ -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

@ -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 {

Loading…
Cancel
Save