feat(hydro_lang): add Stream::weaken_consistency() and cluster_with_consistency()#2926
Closed
jhellerstein wants to merge 1 commit into
Closed
feat(hydro_lang): add Stream::weaken_consistency() and cluster_with_consistency()#2926jhellerstein wants to merge 1 commit into
jhellerstein wants to merge 1 commit into
Conversation
12a6f18 to
49303cb
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new API surface in hydro_lang for working with consistency-typed clusters/streams, intended as building blocks for upcoming consistency label analysis.
Changes:
- Adds
Stream::weaken_consistency()to drop a stream’s consistency guarantees in the type system. - Adds
FlowBuilder::cluster_with_consistency<C, Con>()to create aClusterlocation with an explicit consistency type parameter.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
hydro_lang/src/live_collections/stream/mod.rs |
Adds a weaken_consistency method on Stream (currently duplicated in-file). |
hydro_lang/src/compile/builder.rs |
Adds cluster_with_consistency to build clusters with an explicit consistency type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+524
to
+537
| /// Drop the consistency guarantee from this stream's location. | ||
| /// | ||
| /// Weakens the consistency guarantee of this stream (e.g., going from | ||
| /// `EventualConsistency` to `NoConsistency`). No IR node is inserted — | ||
| /// enforcing the direction is safe. No IR node is inserted. | ||
| pub fn weaken_consistency(self) -> Stream<T, L::DropConsistency, B, O, R> | ||
| where | ||
| L: Location<'a>, | ||
| { | ||
| Stream::new( | ||
| self.location.drop_consistency(), | ||
| self.ir_node.replace(HydroNode::Placeholder), | ||
| ) | ||
| } |
49303cb to
ed4d130
Compare
…ster_with_consistency() - Stream::drop_consistency(): safely forgets a consistency guarantee (e.g. EventualConsistency → NoConsistency). Purely type-level, no IR node inserted. Useful when replication strategies need to return streams on NoConsistency clusters after using broadcast_closed internally. - FlowBuilder::cluster_with_consistency<C, Con>(): creates a cluster with an explicit consistency guarantee (e.g. EventualConsistency) rather than the default NoConsistency.
ed4d130 to
f713343
Compare
Contributor
Author
|
Folded into #2927 |
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.
Adds two utility methods for working with consistency-typed clusters:
Stream::weaken_consistency(): Weakens the consistency guarantee of a stream (e.g., going fromEventualConsistencytoNoConsistency), with the type system enforcing the direction is safe. No IR node is inserted. Follows the same pattern asweaken_ordering()andweaken_retries(). Useful when a stream produced bybroadcast_closedneeds to flow through APIs that expectNoConsistency.FlowBuilder::cluster_with_consistency<C, Con>(): Creates a cluster with an explicit consistency type parameter (e.g.EventualConsistency), rather than defaulting toNoConsistency.These are building blocks for the consistency label analysis in the next PR.