Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peb iterator #34

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

peb iterator #34

wants to merge 8 commits into from

Conversation

frairon
Copy link
Contributor

@frairon frairon commented May 31, 2024

This PR creates a disk-based ringbuffer updated by a kafka topic


func (r *DiskTail[T]) Iterate(ctx context.Context, skipDuplicates bool, stats *IterStats, handler func(item *Item[T]) HandleResult) error {
if stats == nil {
stats = &IterStats{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locking on these stats doesn't make much sense? They're not visible to the caller.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would you suggest? Hide the stats behind an interface so in case it's not needed it won'T do anything? I don't want to have ifs everywhere just to check if the stats were provided..

@frairon frairon force-pushed the peb-iterator branch 6 times, most recently from 785a995 to fcfb727 Compare January 15, 2025 10:45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not call it example_test.go since its not run via go test. Maybe either move that to an examples folder or create a runnable example and put into cmd/disktail_example/main.go.

if err != nil {
return fmt.Errorf("error creating iterator: %w", err)
}
r.store.NewBatch()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we ignore the returned Batch, can be removed probably

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, my bad, wanted to try something and forgot to remove the code. It's gone :)

@frairon frairon force-pushed the peb-iterator branch 6 times, most recently from cb75a33 to 7992213 Compare January 21, 2025 08:56
@frairon frairon force-pushed the peb-iterator branch 2 times, most recently from 3f28190 to 929e3a2 Compare January 30, 2025 09:55
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.

3 participants