Search in sources :

Example 1 with SegmentDeleted

use of io.pravega.shared.protocol.netty.WireCommands.SegmentDeleted in project pravega by pravega.

the class PravegaRequestProcessor method deleteTableSegment.

@Override
public void deleteTableSegment(final DeleteTableSegment deleteTableSegment) {
    String segment = deleteTableSegment.getSegment();
    final String operation = "deleteTableSegment";
    if (!verifyToken(segment, deleteTableSegment.getRequestId(), deleteTableSegment.getDelegationToken(), operation)) {
        return;
    }
    log.info(deleteTableSegment.getRequestId(), "Deleting table segment {}.", deleteTableSegment);
    val timer = new Timer();
    tableStore.deleteSegment(segment, deleteTableSegment.isMustBeEmpty(), TIMEOUT).thenRun(() -> {
        connection.send(new SegmentDeleted(deleteTableSegment.getRequestId(), segment));
        this.tableStatsRecorder.deleteTableSegment(segment, timer.getElapsed());
    }).exceptionally(e -> handleException(deleteTableSegment.getRequestId(), segment, operation, e));
}
Also used : lombok.val(lombok.val) Timer(io.pravega.common.Timer) SegmentDeleted(io.pravega.shared.protocol.netty.WireCommands.SegmentDeleted)

Aggregations

Timer (io.pravega.common.Timer)1 SegmentDeleted (io.pravega.shared.protocol.netty.WireCommands.SegmentDeleted)1 lombok.val (lombok.val)1