Skip to content

Conversation

@shonfeder
Copy link
Contributor

@shonfeder shonfeder commented Jun 28, 2025

This will allow reusing the batching logic in the Eio client. As a followup, we should refactor the ocurl client to use the same batcher.

Most changes here are purely mechanical, and just a matter of relocating the batching logic into its own module. Tho a few small cleanups were added:

  • Internally, the Batch logic is specialized to storing lists of lists its element type, which allows us to move the list flattening logic into the pop logic, rather than having to handle this in the clients. This specialization is justified because this is not a general purpose batching data-structure, but already highly specialized to our particular application.
  • I removed an unused intermediary push function that returned a bool, and renamed push' to push.
  • I Moved the one bit of global state mutation that incremented the n_dropped counter out of the batcher, instead having the push function return a value to report if dropping occurred, which the client can then handle as needed.

This PR does not reuse the new Batch module for the ocurl client, but you can see what that would look like in my exploratory branch if your curious :)

I have tested this locally against on top of the branch for #96, and the exact same signals are produced.

This will allow resuing the batching logic in the Eio client.
As a followup, we should refactor the ocurl client to use the same
batcher.
@shonfeder shonfeder requested a review from c-cube as a code owner June 28, 2025 01:55
Copy link
Member

@c-cube c-cube left a comment

Choose a reason for hiding this comment

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

I think it's great! There's a couple small nitpicks but this is going to be much nicer (and factored)!

Since we need to traverse the elements added to count up the new size,
we can use that pass to add the elements onto our FIFO queue, and then
drain the queue in one last pass to reverse. IIUC, this should give us
liner complexity of the batch retrieval.
@shonfeder shonfeder requested a review from c-cube July 1, 2025 02:57
@shonfeder
Copy link
Contributor Author

Thanks for the helpful review! Should be ready for a second look! I've re-tested it against #96 locally.

Copy link
Member

@c-cube c-cube left a comment

Choose a reason for hiding this comment

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

Looks good!

@c-cube c-cube merged commit 841d223 into imandra-ai:main Jul 1, 2025
4 checks passed
@shonfeder shonfeder mentioned this pull request Jul 11, 2025
3 tasks
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