s/didReceiveValue/writeValue

pull/1664/head
Jorge Canizales 10 years ago
parent 421f6c9488
commit a90a9c395d
  1. 2
      src/objective-c/GRPCClient/GRPCCall.m
  2. 5
      src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h
  3. 2
      src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m
  4. 2
      src/objective-c/ProtoRPC/ProtoRPC.m
  5. 4
      src/objective-c/RxLibrary/GRXBufferedPipe.h
  6. 6
      src/objective-c/RxLibrary/GRXBufferedPipe.m
  7. 2
      src/objective-c/RxLibrary/GRXImmediateWriter.m
  8. 5
      src/objective-c/RxLibrary/GRXWriteable.h
  9. 2
      src/objective-c/RxLibrary/GRXWriteable.m
  10. 4
      src/objective-c/RxLibrary/GRXWriter.m
  11. 4
      src/objective-c/RxLibrary/transformations/GRXMappingWriter.m
  12. 4
      src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m

@ -231,7 +231,7 @@
handler:resumingHandler]] errorHandler:errorHandler];
}
- (void)didReceiveValue:(id)value {
- (void)writeValue:(id)value {
// TODO(jcanizales): Throw/assert if value isn't NSData.
// Pause the input and only resume it when the C layer notifies us that writes

@ -57,9 +57,8 @@
- (instancetype)initWithWriteable:(id<GRXWriteable>)writeable writer:(id<GRXWriter>)writer
NS_DESIGNATED_INITIALIZER;
// Enqueues didReceiveValue: to be sent to the writeable in the main thread.
// The passed handler is invoked from the main thread after didReceiveValue:
// returns.
// Enqueues writeValue: to be sent to the writeable in the main thread.
// The passed handler is invoked from the main thread after writeValue: returns.
- (void)enqueueMessage:(NSData *)message completionHandler:(void (^)())handler;
// Enqueues didFinishWithError:nil to be sent to the writeable in the main

@ -69,7 +69,7 @@
// the race.
id<GRXWriteable> writeable = self.writeable;
if (writeable) {
[writeable didReceiveValue:message];
[writeable writeValue:message];
handler();
}
});

@ -71,7 +71,7 @@
if ((self = [super initWithHost:host method:method requestsWriter:bytesWriter])) {
// A writeable that parses the proto messages received.
_responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
[responsesWriteable didReceiveValue:[responseClass parseFromData:value]];
[responsesWriteable writeValue:[responseClass parseFromData:value]];
} completionHandler:^(NSError *errorOrNil) {
[responsesWriteable didFinishWithError:errorOrNil];
}];

@ -38,8 +38,8 @@
// A buffered pipe is a Writeable that also acts as a Writer (to whichever other writeable is passed
// to -startWithWriteable:).
// Once it is started, whatever values are written into it (via -didReceiveValue:) will be
// propagated immediately, unless flow control prevents it.
// Once it is started, whatever values are written into it (via -writeValue:) will be propagated
// immediately, unless flow control prevents it.
// If it is throttled and keeps receiving values, as well as if it receives values before being
// started, it will buffer them and propagate them in order as soon as its state becomes
// GRXWriterStateStarted.

@ -62,7 +62,7 @@
- (void)writeBufferUntilPausedOrStopped {
while (_state == GRXWriterStateStarted && _queue.count > 0) {
[_writeable didReceiveValue:[self popValue]];
[_writeable writeValue:[self popValue]];
}
if (_inputIsFinished && _queue.count == 0) {
// Our writer finished normally while we were paused or not-started-yet.
@ -77,10 +77,10 @@
return _state == GRXWriterStateStarted && _queue.count == 0;
}
- (void)didReceiveValue:(id)value {
- (void)writeValue:(id)value {
if (self.shouldFastForward) {
// Skip the queue.
[_writeable didReceiveValue:value];
[_writeable writeValue:value];
} else {
// Even if we're paused and with enqueued values, we can't excert back-pressure to our writer.
// So just buffer the new value.

@ -109,7 +109,7 @@
- (void)writeUntilPausedOrStopped {
id value;
while (value = [_enumerator nextObject]) {
[_writeable didReceiveValue:value];
[_writeable writeValue:value];
// If the writeable has a reference to us, it might change our state to paused or finished.
if (_state == GRXWriterStatePaused || _state == GRXWriterStateFinished) {
return;

@ -38,11 +38,10 @@
@protocol GRXWriteable <NSObject>
// Push the next value of the sequence to the receiving object.
// TODO(jcanizales): Name it enumerator:(id<GRXEnumerator>) didProduceValue:(id)?
- (void)didReceiveValue:(id)value;
- (void)writeValue:(id)value;
// Signal that the sequence is completed, or that an error ocurred. After this
// message is sent to the instance, neither it nor didReceiveValue: may be
// message is sent to the instance, neither it nor writeValue: may be
// called again.
// TODO(jcanizales): enumerator:(id<GRXEnumerator>) didFinishWithError:(NSError*)?
- (void)didFinishWithError:(NSError *)errorOrNil;

@ -76,7 +76,7 @@
return self;
}
- (void)didReceiveValue:(id)value {
- (void)writeValue:(id)value {
if (_valueHandler) {
_valueHandler(value);
}

@ -75,8 +75,8 @@
#pragma mark GRXWriteable implementation
- (void)didReceiveValue:(id)value {
[_writeable didReceiveValue:value];
- (void)writeValue:(id)value {
[_writeable writeValue:value];
}
- (void)didFinishWithError:(NSError *)errorOrNil {

@ -57,7 +57,7 @@ static id (^kIdentity)(id value) = ^id(id value) {
}
// Override
- (void)didReceiveValue:(id)value {
[super didReceiveValue:_map(value)];
- (void)writeValue:(id)value {
[super writeValue:_map(value)];
}
@end

@ -208,7 +208,7 @@
id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index]
requestedResponseSize:responses[index]];
[requestsBuffer didReceiveValue:request];
[requestsBuffer writeValue:request];
[_service fullDuplexCallWithRequestsWriter:requestsBuffer
handler:^(BOOL done,
@ -225,7 +225,7 @@
if (index < 4) {
id request = [RMTStreamingOutputCallRequest messageWithPayloadSize:requests[index]
requestedResponseSize:responses[index]];
[requestsBuffer didReceiveValue:request];
[requestsBuffer writeValue:request];
} else {
[requestsBuffer didFinishWithError:nil];
}

Loading…
Cancel
Save