mirror of
https://github.com/wassname/ray.git
synced 2026-07-09 18:20:40 +08:00
Streaming state (#7348)
This commit is contained in:
+25
-1
@@ -1,5 +1,14 @@
|
||||
package io.ray.streaming.api.context;
|
||||
|
||||
import io.ray.streaming.state.backend.KeyStateBackend;
|
||||
import io.ray.streaming.state.keystate.desc.ListStateDescriptor;
|
||||
import io.ray.streaming.state.keystate.desc.MapStateDescriptor;
|
||||
import io.ray.streaming.state.keystate.desc.ValueStateDescriptor;
|
||||
import io.ray.streaming.state.keystate.state.ListState;
|
||||
import io.ray.streaming.state.keystate.state.MapState;
|
||||
import io.ray.streaming.state.keystate.state.ValueState;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Encapsulate the runtime information of a streaming task.
|
||||
*/
|
||||
@@ -11,8 +20,23 @@ public interface RuntimeContext {
|
||||
|
||||
int getParallelism();
|
||||
|
||||
Long getBatchId();
|
||||
Long getCheckpointId();
|
||||
|
||||
void setCheckpointId(long checkpointId);
|
||||
|
||||
Long getMaxBatch();
|
||||
|
||||
Map<String, String> getConfig();
|
||||
|
||||
void setCurrentKey(Object key);
|
||||
|
||||
KeyStateBackend getKeyStateBackend();
|
||||
|
||||
void setKeyStateBackend(KeyStateBackend keyStateBackend);
|
||||
|
||||
<T> ValueState<T> getValueState(ValueStateDescriptor<T> stateDescriptor);
|
||||
|
||||
<T> ListState<T> getListState(ListStateDescriptor<T> stateDescriptor);
|
||||
|
||||
<S, T> MapState<S, T> getMapState(MapStateDescriptor<S, T> stateDescriptor);
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,6 @@ import io.ray.streaming.operator.StreamOperator;
|
||||
import java.util.List;
|
||||
|
||||
public class SourceOperator<T> extends StreamOperator<SourceFunction<T>> {
|
||||
|
||||
private SourceContextImpl sourceContext;
|
||||
|
||||
public SourceOperator(SourceFunction<T> function) {
|
||||
@@ -38,6 +37,7 @@ public class SourceOperator<T> extends StreamOperator<SourceFunction<T>> {
|
||||
}
|
||||
|
||||
class SourceContextImpl implements SourceContext<T> {
|
||||
|
||||
private List<Collector> collectors;
|
||||
|
||||
public SourceContextImpl(List<Collector> collectors) {
|
||||
|
||||
Reference in New Issue
Block a user