GRPC Objective-C  1.71.0
Instance Methods
GRXConcurrentWriteable Class Reference

This is a thread-safe wrapper over a GRXWriteable instance. More...

#import <GRXConcurrentWriteable.h>

Instance Methods

(instancetype) - initWithWriteable:dispatchQueue:
 The GRXWriteable passed is the wrapped writeable. More...
 
(instancetype) - initWithWriteable:
 
(void) - enqueueValue:completionHandler:
 Enqueues writeValue: to be sent to the writeable from the designated dispatch queue. More...
 
(void) - enqueueSuccessfulCompletion
 Enqueues writesFinishedWithError:nil to be sent to the writeable in the designated dispatch queue. More...
 
(void) - cancelWithError:
 If the writeable has not yet received a writesFinishedWithError: message, this will enqueue one to be sent to it in the designated dispatch queue, and cancel all other pending messages to the writeable enqueued by this object (both past and future). More...
 
(void) - cancelSilently
 Cancels all pending messages to the writeable enqueued by this object (both past and future). More...
 

Detailed Description

This is a thread-safe wrapper over a GRXWriteable instance.

It lets one enqueue calls to a GRXWriteable instance for the thread user provided, guaranteeing that writesFinishedWithError: is the last message sent to it (no matter what messages are sent to the wrapper, in what order, nor from which thread). It also guarantees that, if cancelWithError: is called (e.g. by the app cancelling the writes), no further messages are sent to the writeable except writesFinishedWithError:.

TODO(jcanizales): Let the user specify another queue for the writeable callbacks.

Method Documentation

◆ cancelSilently

- (void) cancelSilently

Cancels all pending messages to the writeable enqueued by this object (both past and future).

Because the writeable won't receive writesFinishedWithError:, this also releases the writeable.

◆ cancelWithError:

- (void) cancelWithError: (NSError *)  error

If the writeable has not yet received a writesFinishedWithError: message, this will enqueue one to be sent to it in the designated dispatch queue, and cancel all other pending messages to the writeable enqueued by this object (both past and future).

The error argument cannot be nil.

◆ enqueueSuccessfulCompletion

- (void) enqueueSuccessfulCompletion

Enqueues writesFinishedWithError:nil to be sent to the writeable in the designated dispatch queue.

After that message is sent to the writeable, all other methods of this object are effectively noops.

◆ enqueueValue:completionHandler:

- (void) enqueueValue: (id)  value
completionHandler: (void(^)(void))  handler 

Enqueues writeValue: to be sent to the writeable from the designated dispatch queue.

The passed handler is invoked from designated dispatch queue after writeValue: returns.

◆ initWithWriteable:

- (instancetype) initWithWriteable: (id< GRXWriteable >)  writeable

◆ initWithWriteable:dispatchQueue:

- (instancetype) initWithWriteable: (id< GRXWriteable >)  writeable
dispatchQueue: (dispatch_queue_t)  NS_DESIGNATED_INITIALIZER 

The GRXWriteable passed is the wrapped writeable.

The GRXWriteable instance is retained until writesFinishedWithError: is sent to it, and released after that.


The documentation for this class was generated from the following file: