Search in sources :

Example 1 with Event

use of io.pravega.test.integration.selftest.Event in project pravega by pravega.

the class SegmentStoreReader method readExact.

@Override
public CompletableFuture<ReadItem> readExact(String segmentName, Object address) {
    Exceptions.checkNotNullOrEmpty(segmentName, "segmentName");
    Preconditions.checkArgument(address instanceof Address, "Unexpected address type.");
    Address a = (Address) address;
    return this.store.read(segmentName, a.offset, a.length, this.testConfig.getTimeout()).thenApplyAsync(readResult -> {
        byte[] data = new byte[a.length];
        readResult.readRemaining(data, this.testConfig.getTimeout());
        return new SegmentStoreReadItem(new Event(new ByteArraySegment(data), 0), address);
    }, this.executor);
}
Also used : ByteArraySegment(io.pravega.common.util.ByteArraySegment) Event(io.pravega.test.integration.selftest.Event)

Aggregations

ByteArraySegment (io.pravega.common.util.ByteArraySegment)1 Event (io.pravega.test.integration.selftest.Event)1