public CompletableFuture<Boolean> writeStream( long address, Map<UUID, Long> streamAddresses, ByteBuf buffer) { WriteRequest wr = new WriteRequest(WriteMode.REPLEX_STREAM, streamAddresses, buffer); wr.setLogicalAddresses(streamAddresses); 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 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)); }
/** * Change the default garbage collection interval. * * @param millis The new garbage collection interval, in milliseconds. */ public void setGCInterval(long millis) { router.sendMessage(CorfuMsgType.GC_INTERVAL.payloadMsg(millis)); }
/** Force the compactor to recalculate the contiguous tail. */ public void forceCompact() { router.sendMessage(CorfuMsgType.FORCE_COMPACT.msg()); }
/** Force the garbage collector to begin garbage collection. */ public void forceGC() { router.sendMessage(CorfuMsgType.FORCE_GC.msg()); }
public CompletableFuture<Boolean> fillHole(UUID streamID, long address) { return router.sendMessageAndGetCompletable( CorfuMsgType.FILL_HOLE.payloadMsg(new TrimRequest(streamID, address))); }
/** * Send a hint to the logging unit that a stream can be trimmed. * * @param stream The stream to trim. * @param prefix The prefix of the stream, as a global physical offset, to trim. */ public void trim(UUID stream, long prefix) { router.sendMessage(CorfuMsgType.TRIM.payloadMsg(new TrimRequest(stream, prefix))); }
public CompletableFuture<ReadResponse> read(UUID stream, Range<Long> offsetRange) { return router.sendMessageAndGetCompletable( CorfuMsgType.READ_REQUEST.payloadMsg(new ReadRequest(offsetRange, stream))); }
/** * Asynchronously read from the logging unit. * * @param address The address to read from. * @return A CompletableFuture which will complete with a ReadResult once the read completes. */ public CompletableFuture<ReadResponse> read(long address) { return router.sendMessageAndGetCompletable( CorfuMsgType.READ_REQUEST.payloadMsg(new ReadRequest(address))); }
public CompletableFuture<Boolean> writeCommit( Map<UUID, Long> streams, long address, boolean commit) { CommitRequest wr = new CommitRequest(streams, address, commit); return router.sendMessageAndGetCompletable(CorfuMsgType.COMMIT.payloadMsg(wr)); }