51
51
*/
52
52
public final class ChunkWriter implements Closeable {
53
53
private LongMap <Constants > pools = new LongMap <>();
54
- private final Deque <CheckPointEvent > checkPoints = new ArrayDeque <>();
54
+ private final Deque <CheckpointEvent > checkpoints = new ArrayDeque <>();
55
55
private final Path destination ;
56
56
private final RecordingInput input ;
57
57
private final RecordingOutput output ;
58
58
private final Predicate <RecordedEvent > filter ;
59
59
60
60
private long chunkStartPosition ;
61
61
private boolean chunkComplete ;
62
- private long lastCheckPoint ;
62
+ private long lastCheckpoint ;
63
63
64
64
public ChunkWriter (Path source , Path destination , Predicate <RecordedEvent > filter ) throws IOException {
65
65
this .destination = destination ;
@@ -78,9 +78,9 @@ Constants getPool(Type type) {
78
78
return pool ;
79
79
}
80
80
81
- public CheckPointEvent newCheckPointEvent (long startPosition ) {
82
- CheckPointEvent event = new CheckPointEvent (this , startPosition );
83
- checkPoints .add (event );
81
+ public CheckpointEvent newCheckpointEvent (long startPosition ) {
82
+ CheckpointEvent event = new CheckpointEvent (this , startPosition );
83
+ checkpoints .add (event );
84
84
return event ;
85
85
}
86
86
@@ -120,16 +120,16 @@ public void writeEvent(long startPosition, long endPosition) throws IOException
120
120
121
121
// Write check point events before a position
122
122
private void writeCheckpointEvents (long before ) throws IOException {
123
- CheckPointEvent cp = checkPoints .peek ();
123
+ CheckpointEvent cp = checkpoints .peek ();
124
124
while (cp != null && cp .getStartPosition () < before ) {
125
- checkPoints .poll ();
125
+ checkpoints .poll ();
126
126
long delta = 0 ;
127
- if (lastCheckPoint != 0 ) {
128
- delta = lastCheckPoint - output .position ();
127
+ if (lastCheckpoint != 0 ) {
128
+ delta = lastCheckpoint - output .position ();
129
129
}
130
- lastCheckPoint = output .position ();
130
+ lastCheckpoint = output .position ();
131
131
write (cp , delta );
132
- cp = checkPoints .peek ();
132
+ cp = checkpoints .peek ();
133
133
}
134
134
}
135
135
@@ -174,10 +174,10 @@ public void endChunk(ChunkHeader header) throws IOException {
174
174
writeCheckpointEvents (Long .MAX_VALUE );
175
175
long metadata = output .position ();
176
176
writeMetadataEvent (header );
177
- updateHeader (output .position (), lastCheckPoint , metadata );
177
+ updateHeader (output .position (), lastCheckpoint , metadata );
178
178
pools = new LongMap <>();
179
179
chunkComplete = true ;
180
- lastCheckPoint = 0 ;
180
+ lastCheckpoint = 0 ;
181
181
}
182
182
183
183
private void writeMetadataEvent (ChunkHeader header ) throws IOException {
@@ -190,7 +190,7 @@ private void writeMetadataEvent(ChunkHeader header) throws IOException {
190
190
}
191
191
}
192
192
193
- private void write (CheckPointEvent event , long delta ) throws IOException {
193
+ private void write (CheckpointEvent event , long delta ) throws IOException {
194
194
input .position (event .getStartPosition ());
195
195
long startPosition = output .position ();
196
196
@@ -205,7 +205,7 @@ private void write(CheckPointEvent event, long delta) throws IOException {
205
205
206
206
// Write even if touched pools are zero, checkpoint works as sync point
207
207
output .writeLong (event .touchedPools ()); // Pool count
208
- for (CheckPointPool pool : event .getPools ()) {
208
+ for (CheckpointPool pool : event .getPools ()) {
209
209
if (pool .isTouched ()) {
210
210
output .writeLong (pool .getTypeId ());
211
211
output .writeLong (pool .getTouchedCount ());
0 commit comments