Package cz.o2.proxima.tools.groovy
Interface StreamProvider
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Implementing Classes:
BeamStreamProvider,BeamStreamProvider.Default
public interface StreamProvider extends java.io.CloseableProvider ofStreambased on various parameters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceStreamProvider.TerminatePredicate
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()Close and release all resources.WindowedStream<StreamElement>getBatchSnapshot(long fromStamp, long toStamp, StreamProvider.TerminatePredicate terminateCheck, AttributeDescriptor<?>... attrs)Retrieve batch snapshot stream.WindowedStream<StreamElement>getBatchUpdates(long startStamp, long endStamp, StreamProvider.TerminatePredicate terminateCheck, AttributeDescriptor<?>... attrs)Retrieve batch updates stream.Stream<StreamElement>getStream(Position position, boolean stopAtCurrent, boolean eventTime, StreamProvider.TerminatePredicate terminateCheck, AttributeDescriptor<?>... attrs)Create stream from commit log(s).default <T> WindowedStream<T>impulse(groovy.lang.Closure<T> factory)Return newWindowedStreamthat contains single element generated by calling given (parameterless)Closure.<T> WindowedStream<T>impulse(java.lang.String name, groovy.lang.Closure<T> factory)Return newWindowedStreamthat contains single element generated by calling given (parameterless)Closure.default voidinit(Repository repo, java.lang.String[] args)Initialize the provider with given repository.default <T> WindowedStream<T>periodicImpulse(groovy.lang.Closure<T> factory, long durationMs)Create newWindowedStreamthat contains single element per fixed time windowed.<T> WindowedStream<T>periodicImpulse(java.lang.String name, groovy.lang.Closure<T> factory, long durationMs)Create newWindowedStreamthat contains single element per fixed time windowed.
-
-
-
Method Detail
-
init
default void init(Repository repo, java.lang.String[] args)
Initialize the provider with given repository.- Parameters:
repo- the repositoryargs- command line arguments passed toConsole
-
close
void close()
Close and release all resources.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
getStream
Stream<StreamElement> getStream(Position position, boolean stopAtCurrent, boolean eventTime, StreamProvider.TerminatePredicate terminateCheck, AttributeDescriptor<?>... attrs)
Create stream from commit log(s).- Parameters:
position- position in commit logstopAtCurrent-trueto stop at current dataeventTime-trueto process using event timeterminateCheck-Predicatethat tests if the execution of any terminal operation should be interruptedattrs- attributes to get stream for- Returns:
- stream from commit log
-
getBatchUpdates
WindowedStream<StreamElement> getBatchUpdates(long startStamp, long endStamp, StreamProvider.TerminatePredicate terminateCheck, AttributeDescriptor<?>... attrs)
Retrieve batch updates stream.- Parameters:
startStamp- starting stamp (inclusive)endStamp- ending stamp (exclusive)terminateCheck-Predicatethat tests if the execution of any terminal operation should be interruptedattrs- attributes to read- Returns:
- globally windowed stream
-
getBatchSnapshot
WindowedStream<StreamElement> getBatchSnapshot(long fromStamp, long toStamp, StreamProvider.TerminatePredicate terminateCheck, AttributeDescriptor<?>... attrs)
Retrieve batch snapshot stream.- Parameters:
fromStamp- starting stamp (inclusive)toStamp- ending stamp (exclusive)terminateCheck-Predicatethat tests if the execution of any terminal operation should be interruptedattrs- attributes to read- Returns:
- globally windowed stream
-
impulse
default <T> WindowedStream<T> impulse(groovy.lang.Closure<T> factory)
Return newWindowedStreamthat contains single element generated by calling given (parameterless)Closure.- Type Parameters:
T- type of the resulting stream- Parameters:
factory- the closure that generates the element- Returns:
- globally windowed stream with single element
-
impulse
<T> WindowedStream<T> impulse(@Nullable java.lang.String name, groovy.lang.Closure<T> factory)
Return newWindowedStreamthat contains single element generated by calling given (parameterless)Closure.- Type Parameters:
T- type of the resulting stream- Parameters:
name- name of the transformfactory- the closure that generates the element- Returns:
- globally windowed stream with single element
-
periodicImpulse
default <T> WindowedStream<T> periodicImpulse(groovy.lang.Closure<T> factory, long durationMs)
Create newWindowedStreamthat contains single element per fixed time windowed.- Type Parameters:
T- type of the resulting stream- Parameters:
factory- the closure that generates the elementdurationMs- duration of the fixed time window in ms- Returns:
- globally windowed stream with single element
-
periodicImpulse
<T> WindowedStream<T> periodicImpulse(@Nullable java.lang.String name, groovy.lang.Closure<T> factory, long durationMs)
Create newWindowedStreamthat contains single element per fixed time windowed.- Type Parameters:
T- type of the resulting stream- Parameters:
name- name of the transformfactory- the closure that generates the elementdurationMs- duration of the fixed time window in ms- Returns:
- globally windowed stream with single element
-
-