Conversation
- Simplify SPSCReceiver.recv() to return bytearray copies for straightforward usage - Dramatically simplify ManagedBuffer class to only include view() method and essential functionality - Keep buffer pool optimization focused on streaming scenarios where it provides most value - Add comprehensive SPSC buffer implementation specification (spsc_buf_impl.md) - Create internal buffer module (kioto/internal/buffer.py) with BufferPool and ManagedBuffer - Update tests to reflect simplified API and remove unused method tests - Achieve clean separation: simple copy semantics for recv(), zero-copy optimization for streaming - Reduce ManagedBuffer complexity by ~60% while maintaining all actual functionality
- Move SlotQueue, _PutSlot, and _GetSlot classes from kioto/streams/impl.py to kioto/internal/buffer.py - Update imports in streams implementation to use internal module - Consolidate internal infrastructure components in single module - Maintain all existing functionality and API compatibility - All 126 tests continue to pass with no regressions
- Create kioto/internal/queue.py for async queue utilities - Move SlotQueue and helper classes from buffer.py to queue.py for proper separation of concerns - Update streams/impl.py import to use queue module instead of buffer module - Buffer module now exclusively contains buffer pool and managed buffer classes - Queue module now exclusively contains async queue implementations - All 126 tests continue to pass with proper module organization
- Replace 'assert b"test" in owned or b"data" in owned' with 'assert owned == b"test data"'
- Replace 'assert chunk_bytes[0] in [ord("h"), ord(" ")]' with 'assert chunk_bytes == b"hello wo"'
- Replace 'assert b"persistent" in all_data or b"data" in all_data' with 'assert all_data == b"persistentdata"'
- Remove non-deterministic 'or' conditions from test assertions
- Use exact expected values based on deterministic buffer chunking behavior
- All 126 tests continue to pass with more precise verification
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #21 +/- ##
==========================================
- Coverage 87.55% 87.36% -0.20%
==========================================
Files 20 22 +2
Lines 1278 1266 -12
Branches 158 160 +2
==========================================
- Hits 1119 1106 -13
+ Misses 109 108 -1
- Partials 50 52 +2
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the BorrowedSlice that was previously returned from the SPSCReceiverStream with a memoryview from a BufferPool. The previous implementation had the limitation that each borrow was invalidated on the subsequent call to anext. This prevented the stream from being used with combinators like chunks/ready_chunks.
Additionally the rest of the api was updated to yield bytearrays instead of bytes objects, this makes it possible to build arrays/tensors in libraries that expect a mutable buffer object.