org.opensearch.migrations.replay.datahandlers.IPacketConsumer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trafficReplayer Show documentation
Show all versions of trafficReplayer Show documentation
Everything opensearch migrations
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);
}