use of io.pravega.shared.protocol.netty.WireCommands.CreateSegment in project pravega by pravega.
the class MockController method createStream.
@Override
@Synchronized
public CompletableFuture<Boolean> createStream(StreamConfiguration streamConfig) {
Stream stream = new StreamImpl(streamConfig.getScope(), streamConfig.getStreamName());
if (createdStreams.get(stream) != null) {
return CompletableFuture.completedFuture(false);
}
if (createdScopes.get(streamConfig.getScope()) == null) {
return Futures.failedFuture(new IllegalArgumentException("Scope does not exit."));
}
createdStreams.put(stream, streamConfig);
createdScopes.get(streamConfig.getScope()).add(stream);
for (Segment segment : getSegmentsForStream(stream)) {
createSegment(segment.getScopedName(), new PravegaNodeUri(endpoint, port));
}
return CompletableFuture.completedFuture(true);
}
Aggregations