Skip to content

Get stream offset samples#206

Merged
kjnilsson merged 11 commits intomainfrom
stream_offset_landmarks
Mar 18, 2026
Merged

Get stream offset samples#206
kjnilsson merged 11 commits intomainfrom
stream_offset_landmarks

Conversation

@MarcialRosales
Copy link
Contributor

@MarcialRosales MarcialRosales commented Jan 28, 2026

Introduces samples/2 on osiris_log: it walks the index and returns offset–timestamp samples for a list of fractions. Each fraction is in [0.0, 1.0]: 0.0 is the first message offset, 1.0 the last; values in between pick positions linearly along that range.

Used by the stream browser to render an offset bar with offset and timestamp at each landmark. The user can attach to a stream by dragging the control in the bar to the offsets they wish. Having landmarks helps the user jump to a specific offset or timestamp.

@MarcialRosales MarcialRosales self-assigned this Jan 28, 2026
@MarcialRosales MarcialRosales force-pushed the stream_offset_landmarks branch from f73a0d6 to 9fa9c3f Compare February 11, 2026 09:21
@MarcialRosales MarcialRosales marked this pull request as ready for review February 11, 2026 10:27
@MarcialRosales MarcialRosales force-pushed the stream_offset_landmarks branch from 16a9737 to 56d9665 Compare March 5, 2026 15:38
@MarcialRosales MarcialRosales requested a review from kjnilsson March 5, 2026 15:40
@MarcialRosales MarcialRosales changed the title Stream offset landmarks Get stream offset landmarks Mar 5, 2026
- Reuse existing scaning functions
- Specify -via argments- the exact offset percentiles
(between 0.0 and 1.0).
- Use samples rather than landmarks
@MarcialRosales MarcialRosales changed the title Get stream offset landmarks Get stream offset samples Mar 6, 2026
Rather than  using binary search and open/close
on each seek attempt, instead we are going to
determine which index files are going to be
required and for each index file, which sample
offsets we need to seek for.
Then we use the existing (linear-search) function
idx_skip_search with an accumulator function with
the sample offsets served from the index file.
If the 3 samples resides on a single index, it requires
one open/close operation plus N reads, where N
is proportional to the size of the index.
a) it leverages idx_skip_search
b) it adds a callback function to idx_skip_search that
is able to find several offsets in one scan
a) it leverages idx_skip_search
b) it adds a callback function to idx_skip_search that
is able to find several offsets in one scan
@MarcialRosales MarcialRosales force-pushed the stream_offset_landmarks branch from 8a46b48 to 9a0ece8 Compare March 18, 2026 08:06
- rename main function to samples
- return {error, any()} if an IO occurs
- always return offset for intermediate fractions rather than
the chunk_id they belong to
- expanded test coverage
@kjnilsson kjnilsson merged commit 9a76b69 into main Mar 18, 2026
4 checks passed
@kjnilsson kjnilsson deleted the stream_offset_landmarks branch March 18, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants