use of io.pravega.shared.protocol.netty.WireCommands.DeleteSegment in project pravega by pravega.
the class MockController method deleteSegment.
private boolean deleteSegment(String name, PravegaNodeUri uri) {
CompletableFuture<Boolean> result = new CompletableFuture<>();
FailingReplyProcessor replyProcessor = new FailingReplyProcessor() {
@Override
public void connectionDropped() {
result.completeExceptionally(new ConnectionClosedException());
}
@Override
public void wrongHost(WireCommands.WrongHost wrongHost) {
result.completeExceptionally(new UnsupportedOperationException());
}
@Override
public void segmentDeleted(WireCommands.SegmentDeleted segmentDeleted) {
result.complete(true);
}
@Override
public void noSuchSegment(WireCommands.NoSuchSegment noSuchSegment) {
result.complete(false);
}
@Override
public void processingFailure(Exception error) {
result.completeExceptionally(error);
}
@Override
public void authTokenCheckFailed(WireCommands.AuthTokenCheckFailed authTokenCheckFailed) {
result.completeExceptionally(new AuthenticationException(authTokenCheckFailed.toString()));
}
};
DeleteSegment command = new WireCommands.DeleteSegment(idGenerator.get(), name, "");
sendRequestOverNewConnection(command, replyProcessor, result);
return getAndHandleExceptions(result, RuntimeException::new);
}
use of io.pravega.shared.protocol.netty.WireCommands.DeleteSegment in project pravega by pravega.
the class MockController method deleteStream.
@Override
@Synchronized
public CompletableFuture<Boolean> deleteStream(String scope, String streamName) {
Stream stream = new StreamImpl(scope, streamName);
if (createdStreams.get(stream) == null) {
return CompletableFuture.completedFuture(false);
}
for (Segment segment : getSegmentsForStream(stream)) {
deleteSegment(segment.getScopedName(), new PravegaNodeUri(endpoint, port));
}
createdStreams.remove(stream);
createdScopes.get(scope).remove(stream);
return CompletableFuture.completedFuture(true);
}
Aggregations