org.opensearch.migrations.replay.traffic.source.ITrafficCaptureSource 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.traffic.source;
import java.io.IOException;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
import org.opensearch.migrations.replay.datatypes.ITrafficStreamKey;
import org.opensearch.migrations.replay.tracing.ITrafficSourceContexts;
public interface ITrafficCaptureSource extends AutoCloseable {
enum CommitResult {
IMMEDIATE,
AFTER_NEXT_READ,
BLOCKED_BY_OTHER_COMMITS,
IGNORED
}
CompletableFuture> readNextTrafficStreamChunk(
Supplier contextSupplier
);
CommitResult commitTrafficStream(ITrafficStreamKey trafficStreamKey) throws IOException;
default void close() throws Exception {}
/**
* Keep-alive call to be used by the BlockingTrafficSource to keep this connection alive if
* this is required.
*/
default void touch(ITrafficSourceContexts.IBackPressureBlockContext context) {}
/**
* @return The time that the next call to touch() must be completed for this source to stay
* active. Empty indicates that touch() does not need to be called to keep the
* source active.
*/
default Optional getNextRequiredTouch() {
return Optional.empty();
}
}