/** * Asynchronously write to the logging unit. * * @param address The address to write to. * @param streams The streams, if any, that this write belongs to. * @param rank The rank of this write (used for quorum replication). * @param buffer The object, post-serialization, to write. * @param backpointerMap The map of backpointers to write. * @return A CompletableFuture which will complete with the WriteResult once the write completes. */ public CompletableFuture<Boolean> write( long address, Set<UUID> streams, long rank, ByteBuf buffer, Map<UUID, Long> backpointerMap) { WriteRequest wr = new WriteRequest(WriteMode.NORMAL, null, buffer); wr.setStreams(streams); wr.setRank(rank); wr.setBackpointerMap(backpointerMap); wr.setGlobalAddress(address); return router.sendMessageAndGetCompletable(CorfuMsgType.WRITE.payloadMsg(wr)); }
/** * Asynchronously write to the logging unit. * * @param address The address to write to. * @param streams The streams, if any, that this write belongs to. * @param rank The rank of this write (used for quorum replication). * @param writeObject The object, pre-serialization, to write. * @param backpointerMap The map of backpointers to write. * @return A CompletableFuture which will complete with the WriteResult once the write completes. */ public CompletableFuture<Boolean> write( long address, Set<UUID> streams, long rank, Object writeObject, Map<UUID, Long> backpointerMap) { ByteBuf payload = ByteBufAllocator.DEFAULT.buffer(); Serializers.getSerializer(CORFU).serialize(writeObject, payload); WriteRequest wr = new WriteRequest(WriteMode.NORMAL, null, payload); wr.setStreams(streams); wr.setRank(rank); wr.setBackpointerMap(backpointerMap); wr.setGlobalAddress(address); return router.sendMessageAndGetCompletable(CorfuMsgType.WRITE.payloadMsg(wr)); }