4
4
package io .deephaven .extensions .barrage ;
5
5
6
6
import com .google .flatbuffers .FlatBufferBuilder ;
7
+ import io .deephaven .chunk .Chunk ;
8
+ import io .deephaven .chunk .attributes .Values ;
7
9
import io .deephaven .engine .rowset .RowSet ;
8
10
import io .deephaven .engine .table .impl .util .BarrageMessage ;
11
+ import io .deephaven .extensions .barrage .chunk .ChunkWriter ;
9
12
import io .deephaven .extensions .barrage .util .DefensiveDrainable ;
10
13
import io .deephaven .util .SafeCloseable ;
11
14
import org .jetbrains .annotations .NotNull ;
17
20
import java .util .function .ToIntFunction ;
18
21
19
22
/**
20
- * A StreamGenerator takes a BarrageMessage and re-uses portions of the serialized payload across different subscribers
21
- * that may subscribe to different viewports and columns.
23
+ * A {@code BarrageMessageWriter} takes a {@link BarrageMessage} and re-uses portions of the serialized payload across
24
+ * different subscribers that may subscribe to different viewports and columns.
22
25
*/
23
- public interface BarrageStreamGenerator extends SafeCloseable {
26
+ public interface BarrageMessageWriter extends SafeCloseable {
24
27
25
28
/**
26
29
* Represents a single update, which might be sent as multiple distinct payloads as necessary based in the
@@ -32,16 +35,18 @@ interface MessageView {
32
35
33
36
interface Factory {
34
37
/**
35
- * Create a StreamGenerator that now owns the BarrageMessage.
38
+ * Create a {@code BarrageMessageWriter} that now owns the {@link BarrageMessage} .
36
39
*
37
40
* @param message the message that contains the update that we would like to propagate
38
41
* @param metricsConsumer a method that can be used to record write metrics
39
42
*/
40
- BarrageStreamGenerator newGenerator (
41
- BarrageMessage message , BarragePerformanceLog .WriteMetricsConsumer metricsConsumer );
43
+ BarrageMessageWriter newMessageWriter (
44
+ @ NotNull BarrageMessage message ,
45
+ @ NotNull ChunkWriter <Chunk <Values >>[] chunkWriters ,
46
+ @ NotNull BarragePerformanceLog .WriteMetricsConsumer metricsConsumer );
42
47
43
48
/**
44
- * Create a MessageView of the Schema to send as the initial message to a new subscriber.
49
+ * Create a {@link MessageView} of the Schema to send as the initial message to a new subscriber.
45
50
*
46
51
* @param schemaPayloadWriter a function that writes schema data to a {@link FlatBufferBuilder} and returns the
47
52
* schema offset
@@ -51,21 +56,22 @@ BarrageStreamGenerator newGenerator(
51
56
}
52
57
53
58
/**
54
- * @return the BarrageMessage that this generator is operating on
59
+ * @return the {@link BarrageMessage} that this writer is operating on
55
60
*/
56
61
BarrageMessage getMessage ();
57
62
58
63
/**
59
- * Obtain a Full-Subscription View of this StreamGenerator that can be sent to a single subscriber.
64
+ * Obtain a Full-Subscription {@link MessageView} of this {@code BarrageMessageWriter} that can be sent to a single
65
+ * subscriber.
60
66
*
61
67
* @param options serialization options for this specific view
62
- * @param isInitialSnapshot indicates whether or not this is the first snapshot for the listener
68
+ * @param isInitialSnapshot indicates whether this is the first snapshot for the listener
63
69
* @return a MessageView filtered by the subscription properties that can be sent to that subscriber
64
70
*/
65
71
MessageView getSubView (BarrageSubscriptionOptions options , boolean isInitialSnapshot );
66
72
67
73
/**
68
- * Obtain a View of this StreamGenerator that can be sent to a single subscriber.
74
+ * Obtain a {@link MessageView} of this {@code BarrageMessageWriter} that can be sent to a single subscriber.
69
75
*
70
76
* @param options serialization options for this specific view
71
77
* @param isInitialSnapshot indicates whether or not this is the first snapshot for the listener
@@ -79,15 +85,16 @@ MessageView getSubView(BarrageSubscriptionOptions options, boolean isInitialSnap
79
85
boolean reverseViewport , @ Nullable RowSet keyspaceViewport , BitSet subscribedColumns );
80
86
81
87
/**
82
- * Obtain a Full-Snapshot View of this StreamGenerator that can be sent to a single requestor.
88
+ * Obtain a Full-Snapshot {@link MessageView} of this {@code BarrageMessageWriter} that can be sent to a single
89
+ * requestor.
83
90
*
84
91
* @param options serialization options for this specific view
85
92
* @return a MessageView filtered by the snapshot properties that can be sent to that requestor
86
93
*/
87
94
MessageView getSnapshotView (BarrageSnapshotOptions options );
88
95
89
96
/**
90
- * Obtain a View of this StreamGenerator that can be sent to a single requestor.
97
+ * Obtain a {@link MessageView} of this {@code BarrageMessageWriter} that can be sent to a single requestor.
91
98
*
92
99
* @param options serialization options for this specific view
93
100
* @param viewport is the position-space viewport
0 commit comments