Package io.pravega.client.admin.impl
Class StreamManagerImpl
- java.lang.Object
-
- io.pravega.client.admin.impl.StreamManagerImpl
-
- All Implemented Interfaces:
StreamManager,java.lang.AutoCloseable
public class StreamManagerImpl extends java.lang.Object implements StreamManager
A stream manager. Used to bootstrap the client.
-
-
Constructor Summary
Constructors Constructor Description StreamManagerImpl(ClientConfig clientConfig)StreamManagerImpl(ClientConfig clientConfig, ControllerImplConfig controllerConfig)StreamManagerImpl(Controller controller, ConnectionPool connectionPool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckScopeExists(java.lang.String scopeName)Checks if a scope exists.booleancheckStreamExists(java.lang.String scopeName, java.lang.String streamName)Checks if a stream exists in scope.voidclose()Closes the stream manager.booleancreateScope(java.lang.String scopeName)Creates a new scope.booleancreateStream(java.lang.String scopeName, java.lang.String streamName, StreamConfiguration config)Creates a new streambooleandeleteScope(java.lang.String scopeName)Deletes an existing scope.booleandeleteScope(java.lang.String scopeName, boolean forceDelete)Deletes scope by listing and deleting all streams in scope.booleandeleteStream(java.lang.String scopeName, java.lang.String streamName)Deletes the provided stream.StreamInfogetStreamInfo(java.lang.String scopeName, java.lang.String streamName)Get information about a given Stream,StreamInfo.java.util.Collection<java.lang.String>getStreamTags(java.lang.String scopeName, java.lang.String streamName)Gets the Tags associated with a stream.java.util.Iterator<java.lang.String>listScopes()Gets an iterator for all scopes.java.util.Iterator<Stream>listStreams(java.lang.String scopeName)Gets an iterator for all streams in scope.java.util.Iterator<Stream>listStreams(java.lang.String scopeName, java.lang.String tagName)Gets an iterator to list all streams with the provided tag.booleansealStream(java.lang.String scopeName, java.lang.String streamName)Seal an existing stream.booleantruncateStream(java.lang.String scopeName, java.lang.String streamName, StreamCut streamCut)Truncate stream at given stream cut.booleanupdateStream(java.lang.String scopeName, java.lang.String streamName, StreamConfiguration config)Change the configuration for an existing stream.
-
-
-
Constructor Detail
-
StreamManagerImpl
public StreamManagerImpl(ClientConfig clientConfig)
-
StreamManagerImpl
public StreamManagerImpl(ClientConfig clientConfig, ControllerImplConfig controllerConfig)
-
StreamManagerImpl
public StreamManagerImpl(Controller controller, ConnectionPool connectionPool)
-
-
Method Detail
-
createStream
public boolean createStream(java.lang.String scopeName, java.lang.String streamName, StreamConfiguration config)Description copied from interface:StreamManagerCreates a new streamNote: This method is idempotent assuming called with the same name and config. This method may block.
- Specified by:
createStreamin interfaceStreamManager- Parameters:
scopeName- The name of the scope to create this stream in.streamName- The name of the stream to be created.config- The configuration the stream should use.- Returns:
- True if stream is created
-
updateStream
public boolean updateStream(java.lang.String scopeName, java.lang.String streamName, StreamConfiguration config)Description copied from interface:StreamManagerChange the configuration for an existing stream.Note: This method is idempotent assuming called with the same name and config. This method may block.
- Specified by:
updateStreamin interfaceStreamManager- Parameters:
scopeName- The name of the scope to create this stream in.streamName- The name of the stream who's config is to be changed.config- The new configuration.- Returns:
- True if stream configuration is updated
-
truncateStream
public boolean truncateStream(java.lang.String scopeName, java.lang.String streamName, StreamCut streamCut)Description copied from interface:StreamManagerTruncate stream at given stream cut. This method may block.- Specified by:
truncateStreamin interfaceStreamManager- Parameters:
scopeName- The name of the scope to create this stream in.streamName- The name of the stream who's config is to be changed.streamCut- The stream cut to truncate at.- Returns:
- True if stream is truncated at given truncation stream cut.
-
sealStream
public boolean sealStream(java.lang.String scopeName, java.lang.String streamName)Description copied from interface:StreamManagerSeal an existing stream.- Specified by:
sealStreamin interfaceStreamManager- Parameters:
scopeName- The name of the scope to create this stream in.streamName- The name of the stream which has to be sealed.- Returns:
- True if stream is sealed
-
deleteStream
public boolean deleteStream(java.lang.String scopeName, java.lang.String streamName)Description copied from interface:StreamManagerDeletes the provided stream. No more events may be written or read. Resources used by the stream will be freed.- Specified by:
deleteStreamin interfaceStreamManager- Parameters:
scopeName- The name of the scope to create this stream in.streamName- The name of the stream to be deleted.- Returns:
- True if stream is deleted
-
listScopes
public java.util.Iterator<java.lang.String> listScopes()
Description copied from interface:StreamManagerGets an iterator for all scopes.- Specified by:
listScopesin interfaceStreamManager- Returns:
- Iterator to iterate over all scopes.
-
createScope
public boolean createScope(java.lang.String scopeName)
Description copied from interface:StreamManagerCreates a new scope.- Specified by:
createScopein interfaceStreamManager- Parameters:
scopeName- The name of the scope to create this stream in.- Returns:
- True if scope is created
-
checkScopeExists
public boolean checkScopeExists(java.lang.String scopeName)
Description copied from interface:StreamManagerChecks if a scope exists.- Specified by:
checkScopeExistsin interfaceStreamManager- Parameters:
scopeName- The name of the scope to check.- Returns:
- True if scope exists.
-
listStreams
public java.util.Iterator<Stream> listStreams(java.lang.String scopeName)
Description copied from interface:StreamManagerGets an iterator for all streams in scope.- Specified by:
listStreamsin interfaceStreamManager- Parameters:
scopeName- The name of the scope for which to list streams in.- Returns:
- Iterator of Stream to iterator over all streams in scope.
-
listStreams
public java.util.Iterator<Stream> listStreams(java.lang.String scopeName, java.lang.String tagName)
Description copied from interface:StreamManagerGets an iterator to list all streams with the provided tag.- Specified by:
listStreamsin interfaceStreamManager- Parameters:
scopeName- The name of the scope for which to list streams in.tagName- The name of the tag.- Returns:
- Iterator of Stream to iterator over all streams in scope with the provided tag.
-
getStreamTags
public java.util.Collection<java.lang.String> getStreamTags(java.lang.String scopeName, java.lang.String streamName)Description copied from interface:StreamManagerGets the Tags associated with a stream.- Specified by:
getStreamTagsin interfaceStreamManager- Parameters:
scopeName- Scope name.streamName- Stream name.- Returns:
- Tags associated with the stream.
-
checkStreamExists
public boolean checkStreamExists(java.lang.String scopeName, java.lang.String streamName)Description copied from interface:StreamManagerChecks if a stream exists in scope.- Specified by:
checkStreamExistsin interfaceStreamManager- Parameters:
scopeName- The name of the scope to check the stream in.streamName- The name of the stream to check.- Returns:
- True if stream exists.
-
deleteScope
public boolean deleteScope(java.lang.String scopeName)
Description copied from interface:StreamManagerDeletes an existing scope. The scope must contain no stream. This is same as callingStreamManager.deleteScope(String, boolean)with deleteStreams flag set to false.- Specified by:
deleteScopein interfaceStreamManager- Parameters:
scopeName- The name of the scope to delete.- Returns:
- True if scope is deleted
-
deleteScope
public boolean deleteScope(java.lang.String scopeName, boolean forceDelete) throws DeleteScopeFailedExceptionDescription copied from interface:StreamManagerDeletes scope by listing and deleting all streams in scope. This method is not atomic and if new streams are added to the scope concurrently, the attempt to delete the scope may fail. Deleting scope is idempotent and failure to delete scope is retry-able.- Specified by:
deleteScopein interfaceStreamManager- Parameters:
scopeName- The name of the scope to delete.forceDelete- To list and delete streams, key-value tables and reader groups in scope before attempting to delete scope.- Returns:
- True if scope is deleted, false otherwise.
- Throws:
DeleteScopeFailedException- is thrown if this method is unable to seal and delete a stream.
-
getStreamInfo
public StreamInfo getStreamInfo(java.lang.String scopeName, java.lang.String streamName)
Description copied from interface:StreamManagerGet information about a given Stream,StreamInfo. This includesStreamCuts pointing to the current HEAD and TAIL of the Stream and the currentStreamConfiguration- Specified by:
getStreamInfoin interfaceStreamManager- Parameters:
scopeName- The scope of the stream.streamName- The stream name.- Returns:
- stream information.
-
close
public void close()
Description copied from interface:StreamManagerCloses the stream manager.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceStreamManager- See Also:
AutoCloseable.close()
-
-