...
Code Block | ||
---|---|---|
| ||
interface PreviewContext { // all records from the stage identified by identifier <T> Iterator<T> getOutputRecords(PreviewId identifier); // all metrics from the stage identified by identifier Collection<MetricTimeSeries> getMetrics(PreviewId identifier); // all logs from the stage identified by identifier String getLogs(PreviewId identifier); } |
Code Block | ||
---|---|---|
| ||
interface PreviewEmitter {
void emit(T record);
} |
Code Block |
---|
class DefaultPreview implements PreviewContext, PreviewEmitter {
// implementation for methods, emit, getEmittedRecords, getLogs and getMetrics.
}
|
Code Block |
---|
class PreviewHelper {
Map<PreviewId, DefaultPreview> previewIdToDefaultPreview;
PreviewEmitter getPreviewEmitter(PreviewId identifier) {
// create DefaultPreview for identifier in previewIdToDefaultPreview and return if doesn't exist already, else get and return.
}
PreviewContext getPreviewContext(PreviewId identifier) {
// create DefaultPreview for identifier in previewIdToDefaultPreview and return if doesn't exist already, else get and return.
}
} |
Implementation:
SDK:
Preview Execution Isolation:
...