Refactor streaming interfaces and protocols to support new features #641
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.
Description
This is a refactor of the interfaces and protocols in
proxystore.streamto support these two high-level features:Storewhich is useful for small objects or shims that want to do their own data management.To achieve these goals, the following changes were made:
PublisherandSubscriberare now union types ofEventPublisher | MessagePublisherandEventSubscriber | MessageSubscriber, respectively.StreamProducerandStreamConsumerare compatible with both types of shim protocols.EventPublisher/EventSubscribersend/receiveEventBatchobjects directly so they can implement more granular control over transfer, serialization, etc. This will be useful for @ValHayot's mofka integration.MessagePublisher/MessageSubscriberare equivalent to the old protocols; they send/receive already serialized byte-string messages. These are easier to implement, and represent the exisitng shims provided inproxystore.stream.shims.NewObjectEventandNewObjectKeyEvent.NewObjectEventcontains the data and metadata directly in the event.NewObjectKeyEventcontains the metadata and the key corresponding to an object in aStore.StreamProducerwas configured to separate metadata and data using aStore. Topics with an associatedStorewill produceNewObjectKeyEventand topics without an associateStore(or defaultStore) will produceNewObjectEvent.The following breaking changes were made:
storesparameter ofStoreProduceris now keyword-only.Publisher/Subscribershims will need to update their method signatures (Publisher.send()is nowMessagePublisher.send_message()andMessageSubscribermust implementnext_message()).Note that the
proxystore.streammodule is marked as experimental so breaking changes in patch versions is acceptable.Fixes N/A
Type of Change
Testing
Expanded unit tests to cover new configurations.
Pull Request Checklist
Please confirm the PR meets the following requirements.
pre-commit(e.g., mypy, ruff, etc.).