aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/GRPCClient/private/GRPCChannelPool.h
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-11-30 13:43:56 -0800
committerGravatar Muxi Yan <mxyan@google.com>2018-11-30 13:45:40 -0800
commit459da578db5ae9bd95f91be2888236c4870a7314 (patch)
tree0269f17e1edb63374d3fffb011f4a0e7d2a4ad8d /src/objective-c/GRPCClient/private/GRPCChannelPool.h
parenta7c41346d8470e7eb5f10234daa08d09a48fa779 (diff)
Refactor channel pool
Diffstat (limited to 'src/objective-c/GRPCClient/private/GRPCChannelPool.h')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannelPool.h35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.h b/src/objective-c/GRPCClient/private/GRPCChannelPool.h
index 7f8ee19fe5..338b6e440f 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannelPool.h
+++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.h
@@ -32,10 +32,13 @@ NS_ASSUME_NONNULL_BEGIN
@class GRPCChannelPool;
@class GRPCCompletionQueue;
@class GRPCChannelConfiguration;
+@class GRPCWrappedCall;
/**
- * Channel proxy that can be retained and automatically reestablish connection when the channel is
- * disconnected.
+ * A proxied channel object that can be retained and creates GRPCWrappedCall object from. If a
+ * raw channel is not present (i.e. no tcp connection to the server) when a GRPCWrappedCall object
+ * is requested, it issues a connection/reconnection. The behavior of this object is to mimic that
+ * of gRPC core's channel object.
*/
@interface GRPCPooledChannel : NSObject
@@ -47,24 +50,21 @@ NS_ASSUME_NONNULL_BEGIN
* Initialize with an actual channel object \a channel and a reference to the channel pool.
*/
- (nullable instancetype)initWithChannelConfiguration:
- (GRPCChannelConfiguration *)channelConfiguration
- channelPool:(GRPCChannelPool *)channelPool
- NS_DESIGNATED_INITIALIZER;
+ (GRPCChannelConfiguration *)channelConfiguration;
/**
- * Create a grpc core call object (grpc_call) from this channel. If channel is disconnected, get a
+ * Create a GRPCWrappedCall object (grpc_call) from this channel. If channel is disconnected, get a
* new channel object from the channel pool.
*/
-- (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path
- completionQueue:(GRPCCompletionQueue *)queue
- callOptions:(GRPCCallOptions *)callOptions;
+- (nullable GRPCWrappedCall *)wrappedCallWithPath:(NSString *)path
+ completionQueue:(GRPCCompletionQueue *)queue
+ callOptions:(GRPCCallOptions *)callOptions;
/**
- * Return ownership and destroy the grpc_call object created by
- * \a unmanagedCallWithPath:completionQueue:callOptions: and decrease channel refcount. If refcount
- * of the channel becomes 0, return the channel object to channel pool.
+ * Notify the pooled channel that a wrapped call object is no longer referenced and will be
+ * dealloc'ed.
*/
-- (void)destroyUnmanagedCall:(grpc_call *)unmanagedCall;
+- (void)notifyWrappedCallDealloc:(GRPCWrappedCall *)wrappedCall;
/**
* Force the channel to disconnect immediately. Subsequent calls to unmanagedCallWithPath: will
@@ -78,6 +78,13 @@ NS_ASSUME_NONNULL_BEGIN
@interface GRPCPooledChannel (Test)
/**
+ * Initialize a pooled channel with non-default destroy delay for testing purpose.
+ */
+- (nullable instancetype)initWithChannelConfiguration:
+(GRPCChannelConfiguration *)channelConfiguration
+ destroyDelay:(NSTimeInterval)destroyDelay;
+
+/**
* Return the pointer to the raw channel wrapped.
*/
@property(atomic, readonly) GRPCChannel *wrappedChannel;
@@ -118,7 +125,7 @@ NS_ASSUME_NONNULL_BEGIN
* Get an instance of pool isolated from the global shared pool with channels' destroy delay being
* \a destroyDelay.
*/
-- (nullable instancetype)initTestPoolWithDestroyDelay:(NSTimeInterval)destroyDelay;
+- (nullable instancetype)initTestPool;
@end