@Override public void reduce(Processor.UnaryProcess request, StreamObserver<Kv.Operand> responseObserver) { LOGGER.info("egg reduce request received"); long now = System.currentTimeMillis(); Kv.Operand.Builder operandBuilder = Kv.Operand.newBuilder(); Kv.Operand operand1 = operandBuilder.setKey(ByteString.copyFromUtf8("k1_" + reduceCount.getAndIncrement())).setValue(ByteString.copyFromUtf8("v1")).build(); Kv.Operand operand2 = operandBuilder.setKey(ByteString.copyFromUtf8("k2_" + reduceCount.getAndIncrement())).setValue(ByteString.copyFromUtf8("v2")).build(); responseObserver.onNext(operand1); responseObserver.onNext(operand2); responseObserver.onCompleted(); }
public static Kv.Operand buildOperand(KeyValue<Bytes, byte[]> keyValue) { return Kv.Operand.newBuilder().setKey(ByteString.copyFrom(keyValue.key.get())) .setValue(ByteString.copyFrom(keyValue.value)).build(); }
public static Kv.Operand buildOperand(Bytes key, byte[] value) { return Kv.Operand.newBuilder().setKey(ByteString.copyFrom(key.get())) .setValue(ByteString.copyFrom(value)).build(); }
KeyValue<Bytes, byte[]> keyValue = keyValueIterator.next(); Kv.Operand operand = Kv.Operand.newBuilder().setKey(ByteString.copyFrom(keyValue.key.get())) .setValue(ByteString.copyFrom(keyValue.value)).build(); responseObserver.onNext(operand); ++count;
.setKey(finalTransferMeta.getDataDesc().getTaggedVariableName()) .setValue(serializedObjectResult) .build();
public Kv.Operand toOperand(DataStructure.RawEntry rawEntry) { Kv.Operand result = null; synchronized (operandBuilderLock) { result = operandBuilder.clear() .setKey(rawEntry.getKey()) .setValue(rawEntry.getValue()) .build(); } return result; } }