| 1 |
/* |
| 2 |
* |
| 3 |
* Copyright 2015 gRPC authors. |
| 4 |
* |
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 |
* you may not use this file except in compliance with the License. |
| 7 |
* You may obtain a copy of the License at |
| 8 |
* |
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
* |
| 11 |
* Unless required by applicable law or agreed to in writing, software |
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
* See the License for the specific language governing permissions and |
| 15 |
* limitations under the License. |
| 16 |
* |
| 17 |
*/ |
| 18 |
|
| 19 |
#import <Foundation/Foundation.h> |
| 20 |
#include <grpc/grpc.h> |
| 21 |
|
| 22 |
#import "GRPCRequestHeaders.h" |
| 23 |
|
| 24 |
@interface GRPCOperation : NSObject |
| 25 |
@property(nonatomic, readonly) grpc_op op; |
| 26 |
/** Guaranteed to be called when the operation has finished. */ |
| 27 |
- (void)finish; |
| 28 |
@end |
| 29 |
|
| 30 |
@interface GRPCOpSendMetadata : GRPCOperation |
| 31 |
|
| 32 |
- (instancetype)initWithMetadata:(NSDictionary *)metadata handler:(void (^)(void))handler; |
| 33 |
|
| 34 |
- (instancetype)initWithMetadata:(NSDictionary *)metadata |
| 35 |
flags:(uint32_t)flags |
| 36 |
handler:(void (^)(void))handler NS_DESIGNATED_INITIALIZER; |
| 37 |
|
| 38 |
@end |
| 39 |
|
| 40 |
@interface GRPCOpSendMessage : GRPCOperation |
| 41 |
|
| 42 |
- (instancetype)initWithMessage:(NSData *)message |
| 43 |
handler:(void (^)(void))handler NS_DESIGNATED_INITIALIZER; |
| 44 |
|
| 45 |
@end |
| 46 |
|
| 47 |
@interface GRPCOpSendClose : GRPCOperation |
| 48 |
|
| 49 |
- (instancetype)initWithHandler:(void (^)(void))handler NS_DESIGNATED_INITIALIZER; |
| 50 |
|
| 51 |
@end |
| 52 |
|
| 53 |
@interface GRPCOpRecvMetadata : GRPCOperation |
| 54 |
|
| 55 |
- (instancetype)initWithHandler:(void (^)(NSDictionary *))handler NS_DESIGNATED_INITIALIZER; |
| 56 |
|
| 57 |
@end |
| 58 |
|
| 59 |
@interface GRPCOpRecvMessage : GRPCOperation |
| 60 |
|
| 61 |
- (instancetype)initWithHandler:(void (^)(grpc_byte_buffer *))handler NS_DESIGNATED_INITIALIZER; |
| 62 |
|
| 63 |
@end |
| 64 |
|
| 65 |
@interface GRPCOpRecvStatus : GRPCOperation |
| 66 |
|
| 67 |
- (instancetype)initWithHandler:(void (^)(NSError *, NSDictionary *))handler |
| 68 |
NS_DESIGNATED_INITIALIZER; |
| 69 |
|
| 70 |
@end |
| 71 |
|
| 72 |
#pragma mark GRPCWrappedCall |
| 73 |
|
| 74 |
@class GRPCPooledChannel; |
| 75 |
|
| 76 |
@interface GRPCWrappedCall : NSObject |
| 77 |
|
| 78 |
- (instancetype)init NS_UNAVAILABLE; |
| 79 |
|
| 80 |
+ (instancetype)new NS_UNAVAILABLE; |
| 81 |
|
| 82 |
- (instancetype)initWithUnmanagedCall:(grpc_call *)unmanagedCall |
| 83 |
pooledChannel:(GRPCPooledChannel *)pooledChannel NS_DESIGNATED_INITIALIZER; |
| 84 |
|
| 85 |
- (void)startBatchWithOperations:(NSArray *)ops errorHandler:(void (^)(void))errorHandler; |
| 86 |
|
| 87 |
- (void)startBatchWithOperations:(NSArray *)ops; |
| 88 |
|
| 89 |
- (void)cancel; |
| 90 |
|
| 91 |
- (void)channelDisconnected; |
| 92 |
|
| 93 |
@end |