示例#1
0
 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));
 }
示例#2
0
 /**
  * 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));
 }
示例#3
0
 /**
  * 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));
 }
示例#4
0
 /**
  * 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));
 }
示例#5
0
 /** Force the compactor to recalculate the contiguous tail. */
 public void forceCompact() {
   router.sendMessage(CorfuMsgType.FORCE_COMPACT.msg());
 }
示例#6
0
 /** Force the garbage collector to begin garbage collection. */
 public void forceGC() {
   router.sendMessage(CorfuMsgType.FORCE_GC.msg());
 }
示例#7
0
 public CompletableFuture<Boolean> fillHole(UUID streamID, long address) {
   return router.sendMessageAndGetCompletable(
       CorfuMsgType.FILL_HOLE.payloadMsg(new TrimRequest(streamID, address)));
 }
示例#8
0
 /**
  * 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)));
 }
示例#9
0
 public CompletableFuture<ReadResponse> read(UUID stream, Range<Long> offsetRange) {
   return router.sendMessageAndGetCompletable(
       CorfuMsgType.READ_REQUEST.payloadMsg(new ReadRequest(offsetRange, stream)));
 }
示例#10
0
 /**
  * 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)));
 }
示例#11
0
 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));
 }