/** * Creates an empty UpdateDocumentMessage */ public static UpdateDocumentMessage createEmpty() { return new UpdateDocumentMessage(null); }
@Override protected DocumentMessage doDecode(DocumentDeserializer buffer) { final LazyDecoder decoder = (obj, buf) -> { decodeInto((UpdateDocumentMessage) obj, buf); }; return new UpdateDocumentMessage(decoder, buffer); }
@Override public Result update(DocumentUpdate update, DocumentProtocol.Priority pri) { UpdateDocumentMessage msg = new UpdateDocumentMessage(update); msg.setPriority(pri); return send(msg); }
private static DocumentMessage newMessage(DocumentOperation documentOperation) { final TestAndSetMessage message; if (documentOperation instanceof DocumentPut) { message = new PutDocumentMessage(((DocumentPut)documentOperation)); } else if (documentOperation instanceof DocumentUpdate) { message = new UpdateDocumentMessage((DocumentUpdate)documentOperation); } else if (documentOperation instanceof DocumentRemove) { message = new RemoveDocumentMessage(documentOperation.getId()); } else { throw new UnsupportedOperationException(documentOperation.getClass().getName()); } message.setCondition(documentOperation.getCondition()); return message; }
static DocumentOperationMessageV3 newUpdateMessage(VespaXMLFeedReader.Operation op, String operationId) { DocumentUpdate update = op.getDocumentUpdate(); update.setCondition(op.getCondition()); Message msg = new UpdateDocumentMessage(update); String id = (operationId == null) ? update.getId().toString() : operationId; return new DocumentOperationMessageV3(id, msg); }
@Override public boolean update(DocumentUpdate update, DocumentProtocol.Priority pri) { UpdateDocumentMessage msg = new UpdateDocumentMessage(update); msg.setPriority(pri); Reply reply = syncSend(msg); if (reply.hasErrors()) { throw new DocumentAccessException(MessageBusAsyncSession.getErrorMessage(reply), reply.getErrorCodes()); } if (reply.getType() != DocumentProtocol.REPLY_UPDATEDOCUMENT) { throw new DocumentAccessException("Received unknown response: " + reply); } return ((UpdateDocumentReply)reply).wasFound(); }