Skip to content

Commit fb3ec9c

Browse files
committed
exported type fix
1 parent 3adf615 commit fb3ec9c

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/osiris_log.erl

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@
351351
-type offset_entry() :: {offset(), osiris:entry()}.
352352
-type offset_spec() :: osiris:offset_spec().
353353
-type retention_spec() :: osiris:retention_spec().
354+
-type chunk_iterator() :: osiris_log_read:chunk_iterator().
354355
-type header_map() ::
355356
#{chunk_id => offset(),
356357
epoch => epoch(),
@@ -758,15 +759,6 @@ counters_ref(#?MODULE{cfg = #cfg{counter = C}}) ->
758759
read_header(State) ->
759760
osiris_log_read:read_header(State).
760761

761-
-record(iterator, {fd :: file:io_device(),
762-
next_offset :: offset(),
763-
%% entries left
764-
num_left :: non_neg_integer(),
765-
%% any trailing data from last read
766-
%% we try to capture at least the size of the next record
767-
data :: undefined | binary(),
768-
next_record_pos :: non_neg_integer()}).
769-
-opaque chunk_iterator() :: #iterator{}.
770762
-define(REC_MATCH_SIMPLE(Len, Rem),
771763
<<0:1, Len:31/unsigned, Rem/binary>>).
772764
-define(REC_MATCH_SUBBATCH(CompType, NumRec, UncompLen, Len, Rem),
@@ -781,21 +773,21 @@ read_header(State) ->
781773

782774

783775
-spec chunk_iterator(state()) ->
784-
{ok, header_map(), chunk_iterator(), state()} |
776+
{ok, header_map(), osiris_log_read:chunk_iterator(), state()} |
785777
{end_of_stream, state()} |
786778
{error, {invalid_chunk_header, term()}}.
787779
chunk_iterator(State) ->
788780
chunk_iterator(State, 1).
789781

790782
-spec chunk_iterator(state(), pos_integer() | all) ->
791-
{ok, header_map(), chunk_iterator(), state()} |
783+
{ok, header_map(), osiris_log_read:chunk_iterator(), state()} |
792784
{end_of_stream, state()} |
793785
{error, {invalid_chunk_header, term()}}.
794786
chunk_iterator(State, CreditHint) ->
795787
osiris_log_read:chunk_iterator(State, CreditHint).
796788

797-
-spec iterator_next(chunk_iterator()) ->
798-
end_of_chunk | {offset_entry(), chunk_iterator()}.
789+
-spec iterator_next(osiris_log_read:chunk_iterator()) ->
790+
end_of_chunk | {offset_entry(), osiris_log_read:chunk_iterator()}.
799791
iterator_next(Iter) ->
800792
osiris_log_read:iterator_next(Iter).
801793

src/osiris_log_read.erl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ chunk_id_range_from_idx_files(FstIdxFile, LstIdxFile) ->
405405

406406
chunk_location_for_timestamp(Idx, Ts) ->
407407
%% TODO: optimise using skip search approach
408+
%%TODO GEN_IO SOLUTION
408409
Fd = open_index_read(Idx),
409410
%% scan index file for nearest timestamp
410411
{ChunkId, _Timestamp, _Epoch, FilePos} = timestamp_idx_scan(Fd, Ts),
@@ -579,6 +580,8 @@ build_seg_info(IdxFile) ->
579580
build_segment_info(SegFile, LastChunkPos, IdxFile) ->
580581
{ok, Fd} = osiris_log:open(SegFile, [read, binary, raw]),
581582
%% we don't want to read blocks into page cache we are unlikely to need
583+
584+
%%TODO GEN_IO SOLUTION
582585
_ = file:advise(Fd, 0, 0, random),
583586
case file:pread(Fd, ?LOG_HEADER_SIZE, ?HEADER_SIZE_B) of
584587
eof ->
@@ -1128,6 +1131,7 @@ truncate_to(_Name, _Range, [], IdxFiles) ->
11281131
[begin ok = delete_segment_from_index(I) end || I <- IdxFiles],
11291132
[];
11301133
truncate_to(Name, RemoteRange, [{E, ChId} | NextEOs], IdxFiles) ->
1134+
%%TODO GEN_IO SOLUTION
11311135
case find_segment_for_offset(ChId, IdxFiles) of
11321136
{Result, _} when Result == not_found orelse
11331137
Result == end_of_log ->

0 commit comments

Comments
 (0)