Package io.pravega.client.control.impl
Class ControllerImpl
- java.lang.Object
-
- io.pravega.client.control.impl.ControllerImpl
-
- All Implemented Interfaces:
Controller,java.lang.AutoCloseable
public class ControllerImpl extends java.lang.Object implements Controller
RPC based client implementation of Stream Controller V1 API.
-
-
Constructor Summary
Constructors Constructor Description ControllerImpl(io.grpc.ManagedChannelBuilder<?> channelBuilder, ControllerImplConfig config, java.util.concurrent.ScheduledExecutorService executor)Creates a new instance of the Controller client class.ControllerImpl(ControllerImplConfig config, java.util.concurrent.ScheduledExecutorService executor)Creates a new instance of the Controller client class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>abortTransaction(Stream stream, java.util.UUID txId)Aborts a transaction.java.util.concurrent.CompletableFuture<java.lang.Boolean>checkScaleStatus(Stream stream, int scaleEpoch)API to check the status of scale for a given epoch.java.util.concurrent.CompletableFuture<java.lang.Boolean>checkScopeExists(java.lang.String scopeName)Check if scope exists.java.util.concurrent.CompletableFuture<java.lang.Boolean>checkStreamExists(java.lang.String scopeName, java.lang.String streamName)Check if stream exists.java.util.concurrent.CompletableFuture<Transaction.Status>checkTransactionStatus(Stream stream, java.util.UUID txId)Returns the status of the specified transaction.voidclose()Closes controller client.java.util.concurrent.CompletableFuture<java.lang.Void>commitTransaction(Stream stream, java.lang.String writerId, java.lang.Long timestamp, java.util.UUID txId)Commits a transaction, atomically committing all events to the stream, subject to the ordering guarantees specified inEventStreamWriter.java.util.concurrent.CompletableFuture<java.lang.Boolean>createKeyValueTable(java.lang.String scope, java.lang.String kvtName, KeyValueTableConfiguration kvtConfig)API to create a KeyValueTable.java.util.concurrent.CompletableFuture<ReaderGroupConfig>createReaderGroup(java.lang.String scope, java.lang.String rgName, ReaderGroupConfig rgConfig)API create a ReaderGroup.java.util.concurrent.CompletableFuture<java.lang.Boolean>createScope(java.lang.String scopeName)API to create a scope.java.util.concurrent.CompletableFuture<java.lang.Boolean>createStream(java.lang.String scope, java.lang.String streamName, StreamConfiguration streamConfig)API to create a stream.java.util.concurrent.CompletableFuture<TxnSegments>createTransaction(Stream stream, long lease)API to create a new transaction.java.util.concurrent.CompletableFuture<java.lang.Boolean>deleteKeyValueTable(java.lang.String scope, java.lang.String kvtName)API to delete a KeyValueTable.java.util.concurrent.CompletableFuture<java.lang.Boolean>deleteReaderGroup(java.lang.String scope, java.lang.String rgName, java.util.UUID readerGroupId)API to delete a Reader Group.java.util.concurrent.CompletableFuture<java.lang.Boolean>deleteScope(java.lang.String scopeName)API to delete a scope.java.util.concurrent.CompletableFuture<java.lang.Boolean>deleteStream(java.lang.String scope, java.lang.String streamName)API to delete a stream.java.util.concurrent.CompletableFuture<StreamSegments>getCurrentSegments(java.lang.String scope, java.lang.String stream)API to get list of current segments for the stream to write to.java.util.concurrent.CompletableFuture<KeyValueTableSegments>getCurrentSegmentsForKeyValueTable(java.lang.String scope, java.lang.String kvtName)API to get list of current segments for the KeyValueTable to write to.java.util.concurrent.CompletableFuture<io.pravega.shared.protocol.netty.PravegaNodeUri>getEndpointForSegment(java.lang.String qualifiedSegmentName)Given a segment return the endpoint that currently is the owner of that segment.java.util.concurrent.CompletableFuture<StreamSegments>getEpochSegments(java.lang.String scope, java.lang.String stream, int epoch)API to get list of segments for given epoch.java.util.concurrent.CompletableFuture<KeyValueTableConfiguration>getKeyValueTableConfiguration(java.lang.String scope, java.lang.String kvtName)API to get theKeyValueTableConfiguration.java.util.concurrent.CompletableFuture<java.lang.String>getOrRefreshDelegationTokenFor(java.lang.String scope, java.lang.String streamName, io.pravega.shared.security.auth.AccessOperation accessOperation)Obtains a delegation token from the server.java.util.concurrent.CompletableFuture<ReaderGroupConfig>getReaderGroupConfig(java.lang.String scope, java.lang.String rgName)API to get Reader Group Configuration.java.util.concurrent.CompletableFuture<StreamSegmentSuccessors>getSegments(StreamCut fromStreamCut, StreamCut toStreamCut)Returns all the segments from the fromStreamCut till toStreamCut.java.util.concurrent.CompletableFuture<java.util.Map<Segment,java.lang.Long>>getSegmentsAtTime(Stream stream, long timestamp)Given a timestamp and a stream returns segments and offsets that were present at that time in the stream.java.util.concurrent.CompletableFuture<StreamConfiguration>getStreamConfiguration(java.lang.String scopeName, java.lang.String streamName)Fetch the current Stream Configuration.java.util.concurrent.CompletableFuture<StreamSegmentsWithPredecessors>getSuccessors(Segment segment)Returns StreamSegmentsWithPredecessors containing each of the segments that are successors to the segment requested mapped to a list of their predecessors.java.util.concurrent.CompletableFuture<StreamSegmentSuccessors>getSuccessors(StreamCut from)Returns all the segments that come after the provided cutpoint.java.util.concurrent.CompletableFuture<java.lang.Boolean>isSegmentOpen(Segment segment)Checks to see if a segment exists and is not sealed.io.pravega.common.util.AsyncIterator<KeyValueTableInfo>listKeyValueTables(java.lang.String scopeName)Gets anAsyncIteratoron KeyValueTables in scope.io.pravega.common.util.AsyncIterator<java.lang.String>listScopes()Gets an async iterator on scopes.io.pravega.common.util.AsyncIterator<Stream>listStreams(java.lang.String scopeName)Gets an async iterator on streams in scope.io.pravega.common.util.AsyncIterator<Stream>listStreamsForTag(java.lang.String scopeName, java.lang.String tag)Gets an async iterator on streams in scope.java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>>listSubscribers(java.lang.String scope, java.lang.String streamName)Get list of Subscribers for the Stream.java.util.concurrent.CompletableFuture<java.lang.Void>noteTimestampFromWriter(java.lang.String writer, Stream stream, long timestamp, WriterPosition lastWrittenPosition)Notifies that the specified writer has noted the provided timestamp when it was at lastWrittenPosition.java.util.concurrent.CompletableFuture<Transaction.PingStatus>pingTransaction(Stream stream, java.util.UUID txId, long lease)API to send transaction heartbeat and increase the transaction timeout by lease amount of milliseconds.java.util.concurrent.CompletableFuture<java.lang.Void>removeWriter(java.lang.String writerId, Stream stream)Notifies the controller that the specified writer is shutting down gracefully and no longer needs to be considered for calculating entries for the marks segment.CancellableRequest<java.lang.Boolean>scaleStream(Stream stream, java.util.List<java.lang.Long> sealedSegments, java.util.Map<java.lang.Double,java.lang.Double> newKeyRanges, java.util.concurrent.ScheduledExecutorService executor)API to merge or split stream segments.java.util.concurrent.CompletableFuture<java.lang.Boolean>sealStream(java.lang.String scope, java.lang.String streamName)API to seal a stream.java.util.concurrent.CompletableFuture<java.lang.Boolean>startScale(Stream stream, java.util.List<java.lang.Long> sealedSegments, java.util.Map<java.lang.Double,java.lang.Double> newKeyRanges)API to request start of scale operation on controller.java.util.concurrent.CompletableFuture<java.lang.Boolean>truncateStream(java.lang.String scope, java.lang.String stream, StreamCut streamCut)API to Truncate stream.java.util.concurrent.CompletableFuture<java.lang.Long>updateReaderGroup(java.lang.String scope, java.lang.String rgName, ReaderGroupConfig rgConfig)API to update a ReaderGroup config.java.util.concurrent.CompletableFuture<java.lang.Boolean>updateStream(java.lang.String scope, java.lang.String streamName, StreamConfiguration streamConfig)API to update the configuration of a stream.java.util.concurrent.CompletableFuture<java.lang.Boolean>updateSubscriberStreamCut(java.lang.String scope, java.lang.String streamName, java.lang.String subscriber, java.util.UUID readerGroupId, long generation, StreamCut streamCut)API to update the truncation StreamCut for a particular Subscriber on Controller.
-
-
-
Constructor Detail
-
ControllerImpl
public ControllerImpl(ControllerImplConfig config, java.util.concurrent.ScheduledExecutorService executor)
Creates a new instance of the Controller client class.- Parameters:
config- The configuration for this client implementation.executor- The executor service to be used for handling retries.
-
ControllerImpl
public ControllerImpl(io.grpc.ManagedChannelBuilder<?> channelBuilder, ControllerImplConfig config, java.util.concurrent.ScheduledExecutorService executor)Creates a new instance of the Controller client class.- Parameters:
channelBuilder- The channel builder to connect to the service instance.config- The configuration for this client implementation.executor- The executor service to be used internally.
-
-
Method Detail
-
createScope
public java.util.concurrent.CompletableFuture<java.lang.Boolean> createScope(java.lang.String scopeName)
Description copied from interface:ControllerAPI to create a scope. The future completes with true in the case the scope did not exist when the controller executed the operation. In the case of a re-attempt to create the same scope, the future completes with false to indicate that the scope existed when the controller executed the operation.- Specified by:
createScopein interfaceController- Parameters:
scopeName- Scope name.- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the scope was added because it did not already exist.
-
checkScopeExists
public java.util.concurrent.CompletableFuture<java.lang.Boolean> checkScopeExists(java.lang.String scopeName)
Description copied from interface:ControllerCheck if scope exists.- Specified by:
checkScopeExistsin interfaceController- Parameters:
scopeName- name of scope.- Returns:
- CompletableFuture which when completed will indicate if scope exists or not.
-
listScopes
public io.pravega.common.util.AsyncIterator<java.lang.String> listScopes()
Description copied from interface:ControllerGets an async iterator on scopes.- Specified by:
listScopesin interfaceController- Returns:
- An AsyncIterator which can be used to iterate over all scopes.
-
listStreams
public io.pravega.common.util.AsyncIterator<Stream> listStreams(java.lang.String scopeName)
Description copied from interface:ControllerGets an async iterator on streams in scope.- Specified by:
listStreamsin interfaceController- Parameters:
scopeName- The name of the scope for which to list streams in.- Returns:
- An AsyncIterator which can be used to iterate over all Streams in the scope.
-
listStreamsForTag
public io.pravega.common.util.AsyncIterator<Stream> listStreamsForTag(java.lang.String scopeName, java.lang.String tag)
Description copied from interface:ControllerGets an async iterator on streams in scope.- Specified by:
listStreamsForTagin interfaceController- Parameters:
scopeName- The name of the scope for which to list streams in.tag- The Stream tag.- Returns:
- An AsyncIterator which can be used to iterate over all Streams in the scope.
-
deleteScope
public java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteScope(java.lang.String scopeName)
Description copied from interface:ControllerAPI to delete a scope. Note that a scope can only be deleted in the case is it empty. If the scope contains at least one stream, then the delete request will fail.- Specified by:
deleteScopein interfaceController- Parameters:
scopeName- Scope name.- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the scope was removed because it existed.
-
createStream
public java.util.concurrent.CompletableFuture<java.lang.Boolean> createStream(java.lang.String scope, java.lang.String streamName, StreamConfiguration streamConfig)Description copied from interface:ControllerAPI to create a stream. The future completes with true in the case the stream did not exist when the controller executed the operation. In the case of a re-attempt to create the same stream, the future completes with false to indicate that the stream existed when the controller executed the operation.- Specified by:
createStreamin interfaceController- Parameters:
scope- ScopestreamName- Stream namestreamConfig- Stream configuration- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the stream was added because it did not already exist.
-
checkStreamExists
public java.util.concurrent.CompletableFuture<java.lang.Boolean> checkStreamExists(java.lang.String scopeName, java.lang.String streamName)Description copied from interface:ControllerCheck if stream exists.- Specified by:
checkStreamExistsin interfaceController- Parameters:
scopeName- name of scope.streamName- name of stream.- Returns:
- CompletableFuture which when completed will indicate if stream exists or not.
-
getStreamConfiguration
public java.util.concurrent.CompletableFuture<StreamConfiguration> getStreamConfiguration(java.lang.String scopeName, java.lang.String streamName)
Description copied from interface:ControllerFetch the current Stream Configuration. This includes theScalingPolicy,RetentionPolicyand tags for the given stream.- Specified by:
getStreamConfigurationin interfaceController- Parameters:
scopeName- name of scope.streamName- name of stream.- Returns:
- CompletableFuture which returns the current stream configuration.
-
updateStream
public java.util.concurrent.CompletableFuture<java.lang.Boolean> updateStream(java.lang.String scope, java.lang.String streamName, StreamConfiguration streamConfig)Description copied from interface:ControllerAPI to update the configuration of a stream.- Specified by:
updateStreamin interfaceController- Parameters:
scope- ScopestreamName- Stream namestreamConfig- Stream configuration to updated- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the stream was updated because the config is now different from before.
-
listSubscribers
public java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> listSubscribers(java.lang.String scope, java.lang.String streamName)Description copied from interface:ControllerGet list of Subscribers for the Stream.- Specified by:
listSubscribersin interfaceController- Parameters:
scope- Scope namestreamName- Stream name- Returns:
- List of StreamSubscribers.
-
updateSubscriberStreamCut
public java.util.concurrent.CompletableFuture<java.lang.Boolean> updateSubscriberStreamCut(java.lang.String scope, java.lang.String streamName, java.lang.String subscriber, java.util.UUID readerGroupId, long generation, StreamCut streamCut)Description copied from interface:ControllerAPI to update the truncation StreamCut for a particular Subscriber on Controller. Used when Stream has Consumption Based Retention Policy configured.- Specified by:
updateSubscriberStreamCutin interfaceController- Parameters:
scope- Scope namestreamName- Stream namesubscriber- Name/Id that uniquely identifies a Stream Subscriber.readerGroupId- Reader Group Id.generation- subscriber generation number.streamCut- StreamCut at which Stream can be Truncated for a Consumption based retention policy- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the subscribers position was updated in Stream Metadata.
-
truncateStream
public java.util.concurrent.CompletableFuture<java.lang.Boolean> truncateStream(java.lang.String scope, java.lang.String stream, StreamCut streamCut)Description copied from interface:ControllerAPI to Truncate stream. This api takes a stream cut point which corresponds to a cut in the stream segments which is consistent and covers the entire key range space.- Specified by:
truncateStreamin interfaceController- Parameters:
scope- Scopestream- StreamstreamCut- Stream cut to updated- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the stream was truncated at the supplied cut.
-
scaleStream
public CancellableRequest<java.lang.Boolean> scaleStream(Stream stream, java.util.List<java.lang.Long> sealedSegments, java.util.Map<java.lang.Double,java.lang.Double> newKeyRanges, java.util.concurrent.ScheduledExecutorService executor)
Description copied from interface:ControllerAPI to merge or split stream segments. This call returns a future that completes when either the scale operation is completed on controller service (succeeded or failed) or the specified timeout elapses.- Specified by:
scaleStreamin interfaceController- Parameters:
stream- Stream object.sealedSegments- List of segments to be sealed.newKeyRanges- Key ranges after scaling the stream.executor- executor to be used for busy waiting.- Returns:
- A Cancellable request object which can be used to get the future for scale operation or cancel the scale operation.
-
startScale
public java.util.concurrent.CompletableFuture<java.lang.Boolean> startScale(Stream stream, java.util.List<java.lang.Long> sealedSegments, java.util.Map<java.lang.Double,java.lang.Double> newKeyRanges)
Description copied from interface:ControllerAPI to request start of scale operation on controller. This method returns a future that will complete when controller service accepts the scale request.- Specified by:
startScalein interfaceController- Parameters:
stream- Stream object.sealedSegments- List of segments to be sealed.newKeyRanges- Key ranges after scaling the stream.- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the scaling was started or not.
-
checkScaleStatus
public java.util.concurrent.CompletableFuture<java.lang.Boolean> checkScaleStatus(Stream stream, int scaleEpoch)
Description copied from interface:ControllerAPI to check the status of scale for a given epoch.- Specified by:
checkScaleStatusin interfaceController- Parameters:
stream- Stream object.scaleEpoch- stream's epoch for which the scale was started.- Returns:
- True if scale completed, false otherwise.
-
sealStream
public java.util.concurrent.CompletableFuture<java.lang.Boolean> sealStream(java.lang.String scope, java.lang.String streamName)Description copied from interface:ControllerAPI to seal a stream.- Specified by:
sealStreamin interfaceController- Parameters:
scope- ScopestreamName- Stream name- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the stream was sealed because it was not previously.
-
deleteStream
public java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteStream(java.lang.String scope, java.lang.String streamName)Description copied from interface:ControllerAPI to delete a stream. Only a sealed stream can be deleted.- Specified by:
deleteStreamin interfaceController- Parameters:
scope- Scope name.streamName- Stream name.- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the stream was removed because it existed.
-
getSegmentsAtTime
public java.util.concurrent.CompletableFuture<java.util.Map<Segment,java.lang.Long>> getSegmentsAtTime(Stream stream, long timestamp)
Description copied from interface:ControllerGiven a timestamp and a stream returns segments and offsets that were present at that time in the stream.- Specified by:
getSegmentsAtTimein interfaceController- Parameters:
stream- Name of the streamtimestamp- Timestamp for getting segments- Returns:
- A map of segments to the offset within them.
-
getSuccessors
public java.util.concurrent.CompletableFuture<StreamSegmentsWithPredecessors> getSuccessors(Segment segment)
Description copied from interface:ControllerReturns StreamSegmentsWithPredecessors containing each of the segments that are successors to the segment requested mapped to a list of their predecessors. In the event of a scale up the newly created segments contain a subset of the keyspace of the original segment and their only predecessor is the segment that was split. Example: If there are two segments A and B. A scaling event split A into two new segments C and D. The successors of A are C and D. So calling this method with A would return {C → A, D → A} In the event of a scale down there would be one segment the succeeds multiple. So it would contain the union of the keyspace of its predecessors. So calling with that segment would map to multiple segments. Example: If there are two segments A and B. A and B are merged into a segment C. The successor of A is C. so calling this method with A would return {C → {A, B}} If a segment has not been sealed, it may not have successors now even though it might in the future. The successors to a sealed segment are always known and returned. Example: If there is only one segment A and it is not sealed, and no scaling events have occurred calling this with a would return an empty map.- Specified by:
getSuccessorsin interfaceController- Parameters:
segment- The segment whose successors should be looked up.- Returns:
- A mapping from Successor to the list of all of the Successor's predecessors
-
getSuccessors
public java.util.concurrent.CompletableFuture<StreamSegmentSuccessors> getSuccessors(StreamCut from)
Description copied from interface:ControllerReturns all the segments that come after the provided cutpoint.- Specified by:
getSuccessorsin interfaceController- Parameters:
from- The position from which to find the remaining bytes.- Returns:
- The segments beyond a given cut position.
-
getSegments
public java.util.concurrent.CompletableFuture<StreamSegmentSuccessors> getSegments(StreamCut fromStreamCut, StreamCut toStreamCut)
Description copied from interface:ControllerReturns all the segments from the fromStreamCut till toStreamCut.- Specified by:
getSegmentsin interfaceController- Parameters:
fromStreamCut- From stream cut.toStreamCut- To stream cut.- Returns:
- list of segments.
-
getCurrentSegments
public java.util.concurrent.CompletableFuture<StreamSegments> getCurrentSegments(java.lang.String scope, java.lang.String stream)
Description copied from interface:ControllerAPI to get list of current segments for the stream to write to.- Specified by:
getCurrentSegmentsin interfaceController- Parameters:
scope- Scopestream- Stream name- Returns:
- Current stream segments.
-
getEpochSegments
public java.util.concurrent.CompletableFuture<StreamSegments> getEpochSegments(java.lang.String scope, java.lang.String stream, int epoch)
Description copied from interface:ControllerAPI to get list of segments for given epoch.- Specified by:
getEpochSegmentsin interfaceController- Parameters:
scope- Scopestream- Stream nameepoch- Epoch number.- Returns:
- Stream segments for a given Epoch.
-
getEndpointForSegment
public java.util.concurrent.CompletableFuture<io.pravega.shared.protocol.netty.PravegaNodeUri> getEndpointForSegment(java.lang.String qualifiedSegmentName)
Description copied from interface:ControllerGiven a segment return the endpoint that currently is the owner of that segment.This is called when a reader or a writer needs to determine which host/server it needs to contact to read and write, respectively. The result of this function can be cached until the endpoint is unreachable or indicates it is no longer the owner.
- Specified by:
getEndpointForSegmentin interfaceController- Parameters:
qualifiedSegmentName- The name of the segment. Usually obtained fromSegment.getScopedName().- Returns:
- Pravega node URI.
-
isSegmentOpen
public java.util.concurrent.CompletableFuture<java.lang.Boolean> isSegmentOpen(Segment segment)
Description copied from interface:ControllerChecks to see if a segment exists and is not sealed.- Specified by:
isSegmentOpenin interfaceController- Parameters:
segment- The segment to verify.- Returns:
- true if the segment exists and is open or false if it is not.
-
createTransaction
public java.util.concurrent.CompletableFuture<TxnSegments> createTransaction(Stream stream, long lease)
Description copied from interface:ControllerAPI to create a new transaction. The transaction timeout is relative to the creation time.- Specified by:
createTransactionin interfaceController- Parameters:
stream- Stream namelease- Time for which transaction shall remain open with sending any heartbeat.- Returns:
- Transaction id.
-
pingTransaction
public java.util.concurrent.CompletableFuture<Transaction.PingStatus> pingTransaction(Stream stream, java.util.UUID txId, long lease)
Description copied from interface:ControllerAPI to send transaction heartbeat and increase the transaction timeout by lease amount of milliseconds.- Specified by:
pingTransactionin interfaceController- Parameters:
stream- Stream nametxId- Transaction idlease- Time for which transaction shall remain open with sending any heartbeat.- Returns:
- Transaction.PingStatus or PingFailedException
-
commitTransaction
public java.util.concurrent.CompletableFuture<java.lang.Void> commitTransaction(Stream stream, java.lang.String writerId, java.lang.Long timestamp, java.util.UUID txId)
Description copied from interface:ControllerCommits a transaction, atomically committing all events to the stream, subject to the ordering guarantees specified inEventStreamWriter. Will fail withTxnFailedExceptionif the transaction has already been committed or aborted.- Specified by:
commitTransactionin interfaceController- Parameters:
stream- Stream namewriterId- The writer that is committing the transaction.timestamp- The timestamp the writer provided for the commit (or null if they did not specify one).txId- Transaction id- Returns:
- Void or TxnFailedException
-
abortTransaction
public java.util.concurrent.CompletableFuture<java.lang.Void> abortTransaction(Stream stream, java.util.UUID txId)
Description copied from interface:ControllerAborts a transaction. No events written to it may be read, and no further events may be written. Will fail withTxnFailedExceptionif the transaction has already been committed or aborted.- Specified by:
abortTransactionin interfaceController- Parameters:
stream- Stream nametxId- Transaction id- Returns:
- Void or TxnFailedException
-
checkTransactionStatus
public java.util.concurrent.CompletableFuture<Transaction.Status> checkTransactionStatus(Stream stream, java.util.UUID txId)
Description copied from interface:ControllerReturns the status of the specified transaction.- Specified by:
checkTransactionStatusin interfaceController- Parameters:
stream- Stream nametxId- Transaction id- Returns:
- Transaction status.
-
noteTimestampFromWriter
public java.util.concurrent.CompletableFuture<java.lang.Void> noteTimestampFromWriter(java.lang.String writer, Stream stream, long timestamp, WriterPosition lastWrittenPosition)Description copied from interface:ControllerNotifies that the specified writer has noted the provided timestamp when it was at lastWrittenPosition. This is called by writers viaEventStreamWriter.noteTime(long)orTransaction.commit(long). The controller should aggrigate this information and write it to the stream's marks segment so that it read by readers who will in turn ultimately surface this information through theEventStreamReader.getCurrentTimeWindow(Stream)API.- Specified by:
noteTimestampFromWriterin interfaceController- Parameters:
writer- The name of the writer. (User defined)stream- The stream the timestamp is associated with.timestamp- The new timestamp for the writer on the stream.lastWrittenPosition- The position the writer was at when it noted the time.
-
removeWriter
public java.util.concurrent.CompletableFuture<java.lang.Void> removeWriter(java.lang.String writerId, Stream stream)Description copied from interface:ControllerNotifies the controller that the specified writer is shutting down gracefully and no longer needs to be considered for calculating entries for the marks segment. This may not be called in the event that writer crashes.- Specified by:
removeWriterin interfaceController- Parameters:
writerId- The name of the writer. (User defined)stream- The stream the writer was on.
-
close
public void close()
Description copied from interface:ControllerCloses controller client.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceController- See Also:
AutoCloseable.close()
-
getOrRefreshDelegationTokenFor
public java.util.concurrent.CompletableFuture<java.lang.String> getOrRefreshDelegationTokenFor(java.lang.String scope, java.lang.String streamName, io.pravega.shared.security.auth.AccessOperation accessOperation)Description copied from interface:ControllerObtains a delegation token from the server.- Specified by:
getOrRefreshDelegationTokenForin interfaceController- Parameters:
scope- Scope of the stream.streamName- Name of the stream.accessOperation- The requested permission.- Returns:
- The delegation token for the given stream.
-
createKeyValueTable
public java.util.concurrent.CompletableFuture<java.lang.Boolean> createKeyValueTable(java.lang.String scope, java.lang.String kvtName, KeyValueTableConfiguration kvtConfig)Description copied from interface:ControllerAPI to create a KeyValueTable. The future completes with true in the case the KeyValueTable did not exist when the controller executed the operation. In the case of a re-attempt to create the same KeyValueTable, the future completes with false to indicate that the KeyValueTable existed when the controller executed the operation.- Specified by:
createKeyValueTablein interfaceController- Parameters:
scope- ScopekvtName- KeyValueTable namekvtConfig- TheKeyValueTableConfigurationto create with.- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the stream was added because it did not already exist.
-
listKeyValueTables
public io.pravega.common.util.AsyncIterator<KeyValueTableInfo> listKeyValueTables(java.lang.String scopeName)
Description copied from interface:ControllerGets anAsyncIteratoron KeyValueTables in scope.- Specified by:
listKeyValueTablesin interfaceController- Parameters:
scopeName- The name of the scope for which to list KeyValueTables in.- Returns:
- An
AsyncIteratorwhich can be used to iterate over all KeyValueTables in the scope.
-
getKeyValueTableConfiguration
public java.util.concurrent.CompletableFuture<KeyValueTableConfiguration> getKeyValueTableConfiguration(java.lang.String scope, java.lang.String kvtName)
Description copied from interface:ControllerAPI to get theKeyValueTableConfiguration.- Specified by:
getKeyValueTableConfigurationin interfaceController- Parameters:
scope- ScopekvtName- KeyValueTable name- Returns:
- A future which will throw if the operation fails, otherwise returning the KeyValueTableConfiguration of the corresponding KeyValueTable name.
-
deleteKeyValueTable
public java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteKeyValueTable(java.lang.String scope, java.lang.String kvtName)Description copied from interface:ControllerAPI to delete a KeyValueTable. Only a sealed KeyValueTable can be deleted.- Specified by:
deleteKeyValueTablein interfaceController- Parameters:
scope- Scope name.kvtName- KeyValueTable name.- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the KeyValueTable was removed because it existed.
-
getCurrentSegmentsForKeyValueTable
public java.util.concurrent.CompletableFuture<KeyValueTableSegments> getCurrentSegmentsForKeyValueTable(java.lang.String scope, java.lang.String kvtName)
Description copied from interface:ControllerAPI to get list of current segments for the KeyValueTable to write to.- Specified by:
getCurrentSegmentsForKeyValueTablein interfaceController- Parameters:
scope- ScopekvtName- KeyValueTable name- Returns:
- Current KeyValueTable segments.
-
createReaderGroup
public java.util.concurrent.CompletableFuture<ReaderGroupConfig> createReaderGroup(java.lang.String scope, java.lang.String rgName, ReaderGroupConfig rgConfig)
Description copied from interface:ControllerAPI create a ReaderGroup.- Specified by:
createReaderGroupin interfaceController- Parameters:
scope- Scope name for Reader Group.rgName- Stream name.rgConfig- ReaderGroup configuration.- Returns:
- A future which will throw if the operation fails, otherwise returning a boolean to indicate that the subscriber was updated in Stream Metadata.
-
updateReaderGroup
public java.util.concurrent.CompletableFuture<java.lang.Long> updateReaderGroup(java.lang.String scope, java.lang.String rgName, ReaderGroupConfig rgConfig)Description copied from interface:ControllerAPI to update a ReaderGroup config.- Specified by:
updateReaderGroupin interfaceController- Parameters:
scope- Scope name for Reader Group.rgName- Stream name.rgConfig- ReaderGroup configuration.- Returns:
- A future which will throw if the operation fails, otherwise the subscriber was updated in Stream Metadata and a long indicating the updated config generation is returned.
-
getReaderGroupConfig
public java.util.concurrent.CompletableFuture<ReaderGroupConfig> getReaderGroupConfig(java.lang.String scope, java.lang.String rgName)
Description copied from interface:ControllerAPI to get Reader Group Configuration.- Specified by:
getReaderGroupConfigin interfaceController- Parameters:
scope- Scope name for Reader Group.rgName- Stream name.- Returns:
- A future which will throw if the operation fails, otherwise returns configuration of the Reader Group.
-
deleteReaderGroup
public java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteReaderGroup(java.lang.String scope, java.lang.String rgName, java.util.UUID readerGroupId)Description copied from interface:ControllerAPI to delete a Reader Group.- Specified by:
deleteReaderGroupin interfaceController- Parameters:
scope- Scope name for Reader Group.rgName- Reader Group name.readerGroupId- Unique Id for this readerGroup.- Returns:
- A future which will throw if the operation fails, otherwise returns configuration of the Reader Group.
-
-