Skip to content

Commit 2e74c9c

Browse files
committed
Rename committed_offset field to committed_chk_id
1 parent 6f7ffc3 commit 2e74c9c

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/osiris_writer.erl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
data_listeners = [] :: [{pid(), osiris:offset()}],
7878
offset_listeners = [] ::
7979
[{pid(), osiris:offset(), mfa() | undefined}],
80-
committed_offset = -1 :: osiris:offset()}). %% committed chunk ID
80+
committed_chk_id = -1 :: osiris:offset()}). %% committed chunk ID
8181

8282
-opaque state() :: #?MODULE{}.
8383

@@ -259,15 +259,15 @@ handle_continue(#{name := Name,
259259
replicas = Replicas,
260260
directory = Dir,
261261
counter = CntRef},
262-
committed_offset = LastChunkId,
262+
committed_chk_id = LastChunkId,
263263
replica_state = maps:from_list([{R, {0, {0, -1, 0}}} || R <- Replicas]),
264264
log = Log,
265265
tracking = Trk}}.
266266

267267
handle_batch(Commands,
268268
#?MODULE{cfg = #cfg{counter = Cnt} = Cfg,
269269
duplicates = Dupes0,
270-
committed_offset = ChkId0,
270+
committed_chk_id = ChkId0,
271271
tracking = Trk0} =
272272
State0) ->
273273

@@ -327,7 +327,7 @@ handle_batch(Commands,
327327
counters:put(Cnt, ?C_COMMITTED_CHUNK_ID, ChkId),
328328
counters:put(Cnt, ?C_COMMITTED_OFFSET, LastOffset),
329329
Pending = notify_writers(P, ChkId, Cfg),
330-
State2#?MODULE{committed_offset = ChkId,
330+
State2#?MODULE{committed_chk_id = ChkId,
331331
duplicates = RemDupes,
332332
pending_corrs = Pending};
333333
false ->
@@ -359,7 +359,7 @@ format_status(#?MODULE{cfg = #cfg{name = Name,
359359
replica_state = ReplicaState,
360360
data_listeners = DataListeners,
361361
offset_listeners = OffsetListeners,
362-
committed_offset = CommittedOffset}) ->
362+
committed_chk_id = CommittedChunkId}) ->
363363
#{name => Name,
364364
external_reference => ExtRef,
365365
replica_nodes => Replicas,
@@ -370,7 +370,7 @@ format_status(#?MODULE{cfg = #cfg{name = Name,
370370
num_pending_correlations => queue:len(PendingCorrs),
371371
num_data_listeners => length(DataListeners),
372372
num_offset_listeners => length(OffsetListeners),
373-
committed_offset => CommittedOffset
373+
committed_chunk_id => CommittedChunkId
374374
}.
375375

376376
%% Internal
@@ -513,8 +513,8 @@ handle_command({call, From, get_reader_context},
513513
name = Name,
514514
directory = Dir,
515515
counter = CntRef},
516-
log = Log,
517-
committed_offset = COffs} =
516+
committed_chk_id = CChkId,
517+
log = Log} =
518518
State,
519519
Records,
520520
Replies,
@@ -526,7 +526,8 @@ handle_command({call, From, get_reader_context},
526526
{reply, From,
527527
#{dir => Dir,
528528
name => Name,
529-
committed_offset => max(0, COffs),
529+
committed_chunk_id => max(0, CChkId),
530+
committed_offset => max(0, osiris_log:committed_offset(Log)),
530531
shared => Shared,
531532
reference => Ref,
532533
readers_counter_fun => fun(Inc) -> counters:add(CntRef, ?C_READERS, Inc) end
@@ -589,7 +590,7 @@ notify_data_listeners(#?MODULE{log = Seg, data_listeners = L0} =
589590
notify_offset_listeners(#?MODULE{cfg =
590591
#cfg{reference = Ref,
591592
event_formatter = EvtFmt},
592-
committed_offset = COffs,
593+
committed_chk_id = COffs,
593594
offset_listeners = L0} =
594595
State) ->
595596
{Notify, L} =

0 commit comments

Comments
 (0)