org.opensearch.migrations.replay.datahandlers.IPacketConsumer Maven / Gradle / Ivy
package org.opensearch.migrations.replay.datahandlers;
import org.opensearch.migrations.replay.util.TrackedFuture;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
/**
* This class consumes arrays of bytes or ByteBufs, potentially asynchronously,
* whose completion is signaled via the CompletableFuture that is returned.
*/
public interface IPacketConsumer {
default TrackedFuture consumeBytes(byte[] nextRequestPacket) {
var bb = Unpooled.wrappedBuffer(nextRequestPacket).retain();
var rval = consumeBytes(bb);
bb.release();
return rval;
}
TrackedFuture consumeBytes(ByteBuf nextRequestPacket);
}