use of io.pravega.controller.store.stream.OperationContext in project pravega by pravega.
the class ControllerService method listKeyValueTables.
/**
* List existing KeyValueTables in specified scope.
*
* @param scope Name of the scope.
* @param token continuation token
* @param limit limit for number of KeyValueTables to return.
* @param requestId request id
* @return List of KeyValueTables in scope.
*/
public CompletableFuture<Pair<List<String>, String>> listKeyValueTables(final String scope, final String token, final int limit, final long requestId) {
Exceptions.checkNotNullOrEmpty(scope, "scope");
OperationContext context = streamStore.createScopeContext(scope, requestId);
return kvtMetadataStore.listKeyValueTables(scope, token, limit, context, executor);
}
use of io.pravega.controller.store.stream.OperationContext in project pravega by pravega.
the class ControllerService method deleteScope.
/**
* Controller Service API to delete scope.
*
* @param scope Name of scope to be deleted.
* @param requestId request id
* @return Status of delete scope.
*/
public CompletableFuture<DeleteScopeStatus> deleteScope(final String scope, final long requestId) {
Exceptions.checkNotNullOrEmpty(scope, "scope");
Timer timer = new Timer();
OperationContext context = streamStore.createScopeContext(scope, requestId);
return streamStore.deleteScope(scope, context, executor).thenApply(r -> reportDeleteScopeMetrics(scope, r, timer.getElapsed()));
}
use of io.pravega.controller.store.stream.OperationContext in project pravega by pravega.
the class ControllerService method listStreamsInScope.
/**
* List existing streams in scopes.
*
* @param scope Name of the scope.
* @param requestId request id
* @return List of streams in scope.
*/
public CompletableFuture<Map<String, StreamConfiguration>> listStreamsInScope(final String scope, final long requestId) {
Exceptions.checkNotNullOrEmpty(scope, "scope");
OperationContext context = streamStore.createScopeContext(scope, requestId);
return streamStore.listStreamsInScope(scope, context, executor);
}
use of io.pravega.controller.store.stream.OperationContext in project pravega by pravega.
the class ControllerService method getSegmentsBetweenStreamCuts.
public CompletableFuture<List<StreamSegmentRecord>> getSegmentsBetweenStreamCuts(Controller.StreamCutRange range, long requestId) {
Preconditions.checkNotNull(range, "segment");
Preconditions.checkArgument(!(range.getFromMap().isEmpty() && range.getToMap().isEmpty()));
String scope = range.getStreamInfo().getScope();
String stream = range.getStreamInfo().getStream();
OperationContext context = streamStore.createStreamContext(scope, stream, requestId);
return streamStore.getSegmentsBetweenStreamCuts(scope, stream, range.getFromMap(), range.getToMap(), context, executor);
}
use of io.pravega.controller.store.stream.OperationContext in project pravega by pravega.
the class ControllerService method isSegmentValid.
/**
* Checks if the segment is still open.
*
* @param scope scope
* @param stream stream name
* @param segmentId segment to validate
* @param requestId request id
* @return future that when completed will indicate if the segment is open or not.
*/
public CompletableFuture<Boolean> isSegmentValid(final String scope, final String stream, final long segmentId, final long requestId) {
Exceptions.checkNotNullOrEmpty(scope, "scope");
Exceptions.checkNotNullOrEmpty(stream, "stream");
OperationContext context = streamStore.createStreamContext(scope, stream, requestId);
return streamStore.getActiveSegments(scope, stream, context, executor).thenApplyAsync(x -> x.stream().anyMatch(z -> z.segmentId() == segmentId), executor);
}
Aggregations