diff --git a/.github/workflows/template.yml b/.github/workflows/template.yml index 431935e730e6..531d18a98e3e 100644 --- a/.github/workflows/template.yml +++ b/.github/workflows/template.yml @@ -96,7 +96,7 @@ jobs: fi test_hydroflow_plus: - name: Test hydroflow_plus + name: Test hydro_lang if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} timeout-minutes: 10 needs: pre_job @@ -117,7 +117,7 @@ jobs: uses: cargo-generate/cargo-generate-action@v0.20.0 with: name: generated - template: template/hydroflow_plus + template: template/hydro arguments: "-d hydroflow_git=${{ github.event.pull_request.head.repo.clone_url }} -d hydroflow_branch=${{ github.event.pull_request.head.ref }}" - name: Move generated project run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77f6fe59cc41..4bd6001702fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ Relative to the repository root: * `hydroflow` is the main Hydroflow package, containing the Hydroflow runtime. It re-exports the surface syntax macros in `hydroflow_macro` and `hydroflow_lang`. The runtime is the "scheduled layer" while the surface syntax compiler is the "compiled layer". -* `hydroflow_plus` and related packages contain Hydroflow+, which is a functional syntax built on +* `hydro_lang` and related (hydro_*) packages contain Hydro, which is a functional syntax built on top of `hydroflow`. * `hydroflow_datalog` provides a datalog compiler, based on top of the Hydroflow surface syntax. * `docs` is the [Hydro.run](https://hydro.run/) website. `website_playground` contains the diff --git a/Cargo.lock b/Cargo.lock index d97a41f0818c..9b91d9b97125 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1459,6 +1459,89 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "hydro_lang" +version = "0.10.0" +dependencies = [ + "async-ssh2-lite", + "bincode", + "ctor", + "hydro_deploy", + "hydroflow", + "hydroflow_lang", + "insta", + "match_box", + "nameof", + "prettyplease", + "proc-macro-crate", + "proc-macro2", + "quote", + "sealed 0.6.0", + "serde", + "sha2", + "stageleft", + "stageleft_tool", + "syn 2.0.75", + "tokio", + "toml", + "trybuild", + "trybuild-internals-api", +] + +[[package]] +name = "hydro_std" +version = "0.10.0" +dependencies = [ + "async-ssh2-lite", + "ctor", + "hydro_deploy", + "hydro_lang", + "insta", + "stageleft", + "stageleft_tool", +] + +[[package]] +name = "hydro_test" +version = "0.0.0" +dependencies = [ + "async-ssh2-lite", + "futures", + "hydro_deploy", + "hydro_lang", + "hydro_std", + "insta", + "rand", + "serde", + "stageleft", + "stageleft_tool", + "tokio", +] + +[[package]] +name = "hydro_test_local" +version = "0.0.0" +dependencies = [ + "futures", + "hydro_lang", + "hydro_test_local_macro", + "hydroflow", + "insta", + "rand", + "stageleft", + "stageleft_tool", +] + +[[package]] +name = "hydro_test_local_macro" +version = "0.0.0" +dependencies = [ + "hydro_lang", + "rand", + "stageleft", + "stageleft_tool", +] + [[package]] name = "hydroflow" version = "0.10.0" @@ -1581,89 +1664,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "hydroflow_plus" -version = "0.10.0" -dependencies = [ - "async-ssh2-lite", - "bincode", - "ctor", - "hydro_deploy", - "hydroflow", - "hydroflow_lang", - "insta", - "match_box", - "nameof", - "prettyplease", - "proc-macro-crate", - "proc-macro2", - "quote", - "sealed 0.6.0", - "serde", - "sha2", - "stageleft", - "stageleft_tool", - "syn 2.0.75", - "tokio", - "toml", - "trybuild", - "trybuild-internals-api", -] - -[[package]] -name = "hydroflow_plus_std" -version = "0.10.0" -dependencies = [ - "async-ssh2-lite", - "ctor", - "hydro_deploy", - "hydroflow_plus", - "insta", - "stageleft", - "stageleft_tool", -] - -[[package]] -name = "hydroflow_plus_test" -version = "0.0.0" -dependencies = [ - "async-ssh2-lite", - "futures", - "hydro_deploy", - "hydroflow_plus", - "hydroflow_plus_std", - "insta", - "rand", - "serde", - "stageleft", - "stageleft_tool", - "tokio", -] - -[[package]] -name = "hydroflow_plus_test_local" -version = "0.0.0" -dependencies = [ - "futures", - "hydroflow", - "hydroflow_plus", - "hydroflow_plus_test_local_macro", - "insta", - "rand", - "stageleft", - "stageleft_tool", -] - -[[package]] -name = "hydroflow_plus_test_local_macro" -version = "0.0.0" -dependencies = [ - "hydroflow_plus", - "rand", - "stageleft", - "stageleft_tool", -] - [[package]] name = "hyper" version = "0.14.31" diff --git a/Cargo.toml b/Cargo.toml index 23491ccfe4b1..da5b718076f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,11 +13,11 @@ members = [ "hydroflow_datalog_core", "hydroflow_lang", "hydroflow_macro", - "hydroflow_plus", - "hydroflow_plus_std", - "hydroflow_plus_test", - "hydroflow_plus_test_local", - "hydroflow_plus_test_local_macro", + "hydro_lang", + "hydro_std", + "hydro_test", + "hydro_test_local", + "hydro_test_local_macro", "lattices", "lattices_macro", "multiplatform_test", diff --git a/README.md b/README.md index 34d0e833e1c2..90b16524653f 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Hydro provides a high-level language for the majority of developers called [Hydr ## Development Setup -See the [quickstart section of the Hydroflow+ book](https://hydro.run/docs/hydroflow_plus/quickstart/) for instructions on installing Rust and getting started with the Hydroflow+ template. +See the [quickstart section of the Hydroflow+ book](https://hydro.run/docs/hydro/quickstart/) for instructions on installing Rust and getting started with the Hydroflow+ template. # A New Approach to Distributed Programming There have been many frameworks and platforms for distributed programming over the years, with significant tradeoffs. These include: diff --git a/RELEASING.md b/RELEASING.md index fc7c5a87593d..88832a6e6608 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -28,7 +28,7 @@ To (dry) run the command locally to spot-check for errors and warnings: cargo smart-release --update-crates-index \ --no-changelog-preview --allow-fully-generated-changelogs \ --bump-dependencies auto --bump minor \ # or `patch`, `major`, `keep`, `auto` - hydroflow hydroflow_lang hydroflow_macro hydroflow_plus \ + hydroflow hydroflow_lang hydroflow_macro hydro_lang \ hydroflow_datalog hydroflow_datalog_core \ hydro_deploy hydro_cli hydroflow_cli_integration \ hydroflow_plus_cli_integration \ diff --git a/docs/docs/hydro/consistency.md b/docs/docs/hydro/consistency.md new file mode 100644 index 000000000000..e22702cad466 --- /dev/null +++ b/docs/docs/hydro/consistency.md @@ -0,0 +1,81 @@ +--- +sidebar_position: 3 +--- + +# Consistency and Safety +A key feature of Hydro is its integration with the Rust type system to highlight possible sources of inconsistent distributed behavior due to sources of non-determinism such as batching, timeouts, and message reordering. In this section, we'll walk through the consistency guarantees in Hydro and how to use the **`unsafe`** keyword as an escape hatch when introducing sources of non-determinism. + +:::info + +Our consistency and safety model is based on the POPL'25 paper [Flo: A Semantic Foundation for Progressive Stream Processing](https://arxiv.org/abs/2411.08274), which covers the formal details and proofs underlying this system. + +::: + +## Eventual Determinism +Hydro provides strong guarantees on **determinism**, the property that when provided the same inputs, the outputs of the program are always the same. Even when the inputs and outputs are streaming, we can use this property by looking at the **aggregate collection** (i.e. the result of collecting the elements of the stream into a finite collection). This makes it easy to build composable blocks of code without having to worry about runtime behavior such as batching or network delays. + +Because Hydro programs can involve network delay, we guarantee **eventual determinism**: given a set of streaming inputs which have arrived, the outputs of the program (which continuously change as inputs arrive) will **eventually** have the same _aggregate_ value. + +Again, by focusing on the _aggregate_ value rather than individual outputs, Hydro programs can involve concepts such as retractions (for incremental computation) while still guaranteeing determinism because the _resolved_ output (after processing retractions) will eventually be the same. + +:::note + +Much existing literature in distributed systems focuses on consistency levels such as "eventual consistency" which typically correspond to guarantees when reading the state of a _replicated_ object (or set of objects) at a _specific point_ in time. Hydro does not use such a consistency model internally, instead focusing on the values local to each distributed location _over time_. Concepts such as replication, however, can be layered on top of this model. + +::: + +## Unsafe Operations in Hydro +All **safe** APIs in Hydro (the ones you can call regularly in Rust), guarantee determinism. But oftentimes it is necessary to do something non-deterministic, like generate events at a fixed time interval or split an input into arbitrarily sized batches. + +Hydro offers APIs for such concepts behind an **`unsafe`** guard. This keyword is typically used to mark Rust functions that may not be memory-safe, but we reuse this in Hydro to mark non-deterministic APIs. + +To call such an API, the Rust compiler will ask you to wrap the call in an `unsafe` block. It is typically good practice to also include a `// SAFETY: ...` comment to explain why the non-determinism is there. + +```rust,no_run +# use hydro_lang::*; +# let flow = FlowBuilder::new(); +# let stream_inputs = flow.process::<()>().source_iter(q!([123])); +use std::time::Duration; + +unsafe { + // SAFETY: intentional non-determinism + stream_inputs + .sample_every(q!(Duration::from_secs(1))) +}.for_each(q!(|v| println!("Sample: {:?}", v))) +``` + +When writing a function with Hydro that involves `unsafe` code, it is important to be extra careful about whether the non-determinism is exposed externally. In some applications, a utility function may involve local non-determinism (such as sending retries), but not expose it outside the function (via deduplication). + +But other utilities may expose the non-determinism, in which case they should be marked `unsafe` as well. If the function is public, Rust will require you to put a `# Safety` section in its documentation explain the non-determinism. + +```rust +# use hydro_lang::*; +use std::fmt::Debug; +use std::time::Duration; + +/// ... +/// +/// # Safety +/// This function will non-deterministically print elements +/// from the stream according to a timer. +unsafe fn print_samples( + stream: Stream, Unbounded> +) { + unsafe { + // SAFETY: documented non-determinism + stream + .sample_every(q!(Duration::from_secs(1))) + }.for_each(q!(|v| println!("Sample: {:?}", v))) +} +``` + +## User-Defined Functions +Another source of potential non-determinism is user-defined functions, such as those provided to `map` or `filter`. Hydro allows for arbitrary Rust functions to be called inside these closures, so it is possible to introduce non-determinism which will not be checked by the compiler. + +In general, avoid using APIs like random number generators inside transformation functions unless that non-determinism is explicitly documented somewhere. + +:::info + +To help avoid such bugs, we are working on ways to use formal verification tools (such as [Kani](https://model-checking.github.io/kani/)) to check arbitrary Rust code for properties such as determinism and more. But this remains active research for now and is not yet available. + +::: diff --git a/docs/docs/hydro/dataflow-programming.mdx b/docs/docs/hydro/dataflow-programming.mdx new file mode 100644 index 000000000000..e4aa44b89b43 --- /dev/null +++ b/docs/docs/hydro/dataflow-programming.mdx @@ -0,0 +1,13 @@ +--- +sidebar_position: 1 +--- + +# Dataflow Programming +Hydro uses a dataflow programming model, which will be familiar if you have used APIs like Rust iterators. Instead of using RPCs or async/await to describe distributed computation, Hydro instead uses **asynchronous streams**, which represent data arriving over time. Streams can represent a series of asynchronous events (e.g. inbound network requests) or a sequence of data items. + +Programs in Hydro describe how to **transform** entire collections of data using operators such as `map` (transforming elements one by one), `fold` (aggregating elements into a single value), or `join` (combining elements from multiple streams on matching keys). + +If you are familiar with Spark, Flink or Pandas, you will find Hydro syntax familiar. However, note well that the semantics for asynchronous streams in Hydro differ significantly from bulk analytics systems like those above. In particular, Hydro uses the type system to distinguish between bounded streams (originating from finite data) and unbounded streams (originated from asynchronous input). Moreover, Hydro is designed to handle asynchronous streams of small, independent events very efficiently. + + + diff --git a/docs/docs/hydro/index.mdx b/docs/docs/hydro/index.mdx new file mode 100644 index 000000000000..e27de9c6d0ae --- /dev/null +++ b/docs/docs/hydro/index.mdx @@ -0,0 +1,16 @@ +--- +sidebar_position: 0 +--- + +# Introduction +Hydro is a high-level distributed programming framework for Rust powered by the [Hydroflow runtime](../hydroflow/index.mdx). Unlike traditional architectures such as actors or RPCs, Hydro offers _choreographic_ APIs, where expressions and functions can describe computation that takes place across many locations. It also integrates with [Hydro Deploy](../deploy/index.md) to make it easy to deploy and run Hydro programs to the cloud. + +Hydro uses a two-stage compilation approach. Hydro programs are standard Rust programs, which first run on the developer's laptop to generate a _deployment plan_. This plan is then compiled to individual binaries for each machine in the distributed system (enabling zero-overhead abstractions), and are then deployed to the cloud using the generated plan along with specifications of cloud resources. + +Hydro has been used to write a variety of high-performance distributed systems, including implementations of classic distributed protocols such as two-phase commit and Paxos. Work is ongoing to develop a distributed systems standard library that will offer these protocols and more as reusable components. + +:::caution + +The docs for Hydro are still a work in progress. If you have any questions or run into bugs, please file an issue on the [Hydroflow GitHub repository](https://github.com/hydro-project/hydroflow). + +::: diff --git a/docs/docs/hydroflow_plus/quickstart/_category_.json b/docs/docs/hydro/quickstart/_category_.json similarity index 64% rename from docs/docs/hydroflow_plus/quickstart/_category_.json rename to docs/docs/hydro/quickstart/_category_.json index 20b00e5064e9..33eda8729ab5 100644 --- a/docs/docs/hydroflow_plus/quickstart/_category_.json +++ b/docs/docs/hydro/quickstart/_category_.json @@ -3,6 +3,6 @@ "position": 2, "link": { "type": "doc", - "id": "hydroflow_plus/quickstart/index" + "id": "hydro/quickstart/index" } } diff --git a/docs/docs/hydroflow_plus/quickstart/clusters.mdx b/docs/docs/hydro/quickstart/clusters.mdx similarity index 61% rename from docs/docs/hydroflow_plus/quickstart/clusters.mdx rename to docs/docs/hydro/quickstart/clusters.mdx index 85ccee8c57df..0a25c9e20ab6 100644 --- a/docs/docs/hydroflow_plus/quickstart/clusters.mdx +++ b/docs/docs/hydro/quickstart/clusters.mdx @@ -2,12 +2,12 @@ sidebar_position: 3 --- import CodeBlock from '@theme/CodeBlock'; -import firstTenClusterSrc from '!!raw-loader!../../../../template/hydroflow_plus/src/first_ten_cluster.rs'; -import firstTenClusterExample from '!!raw-loader!../../../../template/hydroflow_plus/examples/first_ten_cluster.rs'; +import firstTenClusterSrc from '!!raw-loader!../../../../template/hydro/src/first_ten_cluster.rs'; +import firstTenClusterExample from '!!raw-loader!../../../../template/hydro/examples/first_ten_cluster.rs'; import { getLines, highlightLines, extractOutput } from '../../../src/util'; # Scaling with Clusters -So far, we have looked at distributed systems where each process is running a different piece of the compute graph -- **compute parallelism**. However, we can also use Hydroflow+ to run the same computation on multiple processes -- achieving **data parallelism** (e.g. partitioning). This is done by creating a **cluster** of processes that all run the same subgraph of code. +So far, we have looked at distributed systems where each process is running a different piece of the compute graph -- **compute parallelism**. However, we can also use Hydro to run the same computation on multiple processes -- achieving **data parallelism** (e.g. partitioning). This is done by creating a **cluster** of processes that all run the same subgraph of code. ## Dataflow with Clusters Just like we use the `Process` type to represent a virtual handle to a single node, we can use the **`Cluster`** type to represent a handle to a **set of nodes** (with size unknown at compile-time). @@ -22,7 +22,7 @@ We start by materializing a stream of numbers on the `leader`, as before. But ra :::info -There are a [variety of APIs](pathname:///rustdoc/hydroflow_plus/stream/struct.Stream.html#impl-Stream%3CT,+L,+B%3E-2) for sending data to and receiving data from clusters. For example, we `broadcast_bincode` to send copies to all members (e.g. for replication), or use `send_bincode` if we have a custom partitioning algorithm. +There are a [variety of APIs](pathname:///rustdoc/hydro/stream/struct.Stream.html#impl-Stream%3CT,+L,+B%3E-2) for sending data to and receiving data from clusters. For example, we `broadcast_bincode` to send copies to all members (e.g. for replication), or use `send_bincode` if we have a custom partitioning algorithm. ::: @@ -46,28 +46,28 @@ We can then launch the program: #shell-command-next-line cargo run --example first_ten_cluster #highlight-next-line -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 0] 0 -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 2] 4 -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 2] 12 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 0] 0 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 2] 4 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 2] 12 #highlight-next-line -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 0] 8 -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 3] 6 -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 1] 2 -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 1] 10 -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 1] 18 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 0 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 0] 8 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 3] 6 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 1] 2 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 1] 10 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 1] 18 +[hydro_template::first_ten_cluster::Leader (process 0)] 0 #highlight-next-line -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 0] 16 -[hydroflow_plus_template::first_ten_cluster::Worker (cluster 1) / 3] 14 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 8 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 16 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 2 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 10 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 18 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 4 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 12 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 6 -[hydroflow_plus_template::first_ten_cluster::Leader (process 0)] 14 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 0] 16 +[hydro_template::first_ten_cluster::Worker (cluster 1) / 3] 14 +[hydro_template::first_ten_cluster::Leader (process 0)] 8 +[hydro_template::first_ten_cluster::Leader (process 0)] 16 +[hydro_template::first_ten_cluster::Leader (process 0)] 2 +[hydro_template::first_ten_cluster::Leader (process 0)] 10 +[hydro_template::first_ten_cluster::Leader (process 0)] 18 +[hydro_template::first_ten_cluster::Leader (process 0)] 4 +[hydro_template::first_ten_cluster::Leader (process 0)] 12 +[hydro_template::first_ten_cluster::Leader (process 0)] 6 +[hydro_template::first_ten_cluster::Leader (process 0)] 14 ``` You'll notice the round-robin distribution in action here, as each cluster log is tagged with the ID of the member (e.g. `/ 0`). In our deployment, we are sending data round-robin across 4 members of the cluster, numbered `0` through `3`. Hence cluster member `0` receives values `0`, `4`, `8` (corresponding to the highlighted lines), member `1` receives values `1`, `5`, `9`, and so on. diff --git a/docs/docs/hydroflow_plus/quickstart/distributed.mdx b/docs/docs/hydro/quickstart/distributed.mdx similarity index 90% rename from docs/docs/hydroflow_plus/quickstart/distributed.mdx rename to docs/docs/hydro/quickstart/distributed.mdx index 4b958cd52c86..13429767bc87 100644 --- a/docs/docs/hydroflow_plus/quickstart/distributed.mdx +++ b/docs/docs/hydro/quickstart/distributed.mdx @@ -2,8 +2,8 @@ sidebar_position: 2 --- import CodeBlock from '@theme/CodeBlock'; -import firstTenDistSrc from '!!raw-loader!../../../../template/hydroflow_plus/src/first_ten_distributed.rs'; -import firstTenDistExample from '!!raw-loader!../../../../template/hydroflow_plus/examples/first_ten_distributed.rs'; +import firstTenDistSrc from '!!raw-loader!../../../../template/hydro/src/first_ten_distributed.rs'; +import firstTenDistExample from '!!raw-loader!../../../../template/hydro/examples/first_ten_distributed.rs'; import { getLines, extractOutput } from '../../../src/util'; # Adding Distribution @@ -13,14 +13,14 @@ We'll start by updating our dataflow function signature to take two processes (i ```rust title="src/first_ten_distributed.rs" -use hydroflow_plus::*; +use hydro::*; pub fn first_ten_distributed<'a>(p1: &Process<'a>, p2: &Process<'a>) ``` :::info -The Hydroflow+ template only contains the final version of this program. In order to follow along with the tutorial, we recommend overwriting `src/first_ten_distributed.rs` according to the following snippets. +The Hydro template only contains the final version of this program. In order to follow along with the tutorial, we recommend overwriting `src/first_ten_distributed.rs` according to the following snippets. ::: @@ -63,7 +63,7 @@ To fix this, we can use the optional type parameter on `Process`, which lets us :::info -This is the final version of our dataflow which you will find in the Hydroflow+ template. +This is the final version of our dataflow which you will find in the Hydro template. ::: diff --git a/docs/docs/hydroflow_plus/quickstart/first-dataflow.mdx b/docs/docs/hydro/quickstart/first-dataflow.mdx similarity index 56% rename from docs/docs/hydroflow_plus/quickstart/first-dataflow.mdx rename to docs/docs/hydro/quickstart/first-dataflow.mdx index 75ca4a9f5552..3e1eb5b0d26a 100644 --- a/docs/docs/hydroflow_plus/quickstart/first-dataflow.mdx +++ b/docs/docs/hydro/quickstart/first-dataflow.mdx @@ -3,28 +3,28 @@ sidebar_position: 1 --- import CodeBlock from '@theme/CodeBlock'; -import firstTenSrc from '!!raw-loader!../../../../template/hydroflow_plus/src/first_ten.rs'; -import firstTenExampleSrc from '!!raw-loader!../../../../template/hydroflow_plus/examples/first_ten.rs'; +import firstTenSrc from '!!raw-loader!../../../../template/hydro/src/first_ten.rs'; +import firstTenExampleSrc from '!!raw-loader!../../../../template/hydro/examples/first_ten.rs'; import { getLines, extractOutput } from '../../../src/util'; # Your First Dataflow -Let's look a minimal example of a Hydroflow+ program. We'll start with a simple dataflow that prints out the first 10 natural numbers. +Let's look a minimal example of a Hydro program. We'll start with a simple dataflow that prints out the first 10 natural numbers. :::tip -We recommend using the Hydroflow+ template to get started with a new project: +We recommend using the Hydro template to get started with a new project: ```bash #shell-command-next-line cargo install cargo-generate #shell-command-next-line -cargo generate gh:hydro-project/hydroflow template/hydroflow_plus +cargo generate gh:hydro-project/hydroflow template/hydro ``` ::: ## Writing a Dataflow -In Hydroflow+, streams are attached to a **location**, which is either a virtual handle to a **single machine** (the **`Process`** type) or **set of machines** (the **`Cluster`** type). A single piece of Hydroflow+ code can describe a distributed program that runs across multiple processes and clusters, each with their own local state and data. +In Hydro, streams are attached to a **location**, which is either a virtual handle to a **single machine** (the **`Process`** type) or **set of machines** (the **`Cluster`** type). A single piece of Hydro code can describe a distributed program that runs across multiple processes and clusters, each with their own local state and data. We'll write our first dataflow in `src/first_ten.rs`. This program will run on a single machine, so we take a single `&Process` parameter. We can materialize a stream on this machine using `process.source_iter` (which emits values from a static in-memory collection), and then print out the values using `for_each`. @@ -32,7 +32,7 @@ We'll write our first dataflow in `src/first_ten.rs`. This program will run on a :::caution -You'll notice that the arguments to `source_iter` and `for_each` are wrapped in `q!` macros. The top-level Hydroflow+ program (`first_ten`) is responsible for setting up the dataflow structure, whereas the `q!` macro is used to mark the Rust code that will be executed at **runtime**. Generally, runtime code in a `q!` macro is a snippet of Rust code that defines a static source of data or a closure. +You'll notice that the arguments to `source_iter` and `for_each` are wrapped in `q!` macros. The top-level Hydro program (`first_ten`) is responsible for setting up the dataflow structure, whereas the `q!` macro is used to mark the Rust code that will be executed at **runtime**. Generally, runtime code in a `q!` macro is a snippet of Rust code that defines a static source of data or a closure. If you forget to wrap a block in `q!` when that is required, you'll see an error like: ``` @@ -42,11 +42,11 @@ closure is expected to take 5 arguments, but it takes X arguments ::: ## Running the Dataflow -To run a Hydroflow+ program, we need to write some deployment configuration in `examples/first_ten.rs`. +To run a Hydro program, we need to write some deployment configuration in `examples/first_ten.rs`. :::tip -When using Hydroflow+, we will *always* place our deployment scripts in the `examples` directory. This is required because deployment is done via [Hydro Deploy](../../deploy/index.md) which is a _dev dependency_---i.e. not part of the dependencies used for generating binaries (but available to programs in the `examples` directory). +When using Hydro, we will *always* place our deployment scripts in the `examples` directory. This is required because deployment is done via [Hydro Deploy](../../deploy/index.md) which is a _dev dependency_---i.e. not part of the dependencies used for generating binaries (but available to programs in the `examples` directory). ::: @@ -54,7 +54,7 @@ When using Hydroflow+, we will *always* place our deployment scripts in the `exa First, we initialize a new [Hydro Deploy](../../deploy/index.md) deployment with `Deployment::new()`. Then, we create a `FlowBuilder` which will store the entire dataflow program and manage its compilation. -To create a `Process`, we call `flow.process()`. After the dataflow has been created (by invoking the `hydroflow_plus_template::first_ten::first_ten` function we created earlier), we must map each instantiated `Process` to a deployment target using `flow.with_process` (in this case we deploy to localhost). +To create a `Process`, we call `flow.process()`. After the dataflow has been created (by invoking the `hydro_template::first_ten::first_ten` function we created earlier), we must map each instantiated `Process` to a deployment target using `flow.with_process` (in this case we deploy to localhost). Finally, we call `flow.deploy(&mut deployment)` to provision the dataflow program on the target machine. This returns a struct with handles to the instantiated machines, which we must store in the `_nodes` variable to prevent them from being dropped. Then, we can start the dataflow program and block until `Ctrl-C` using `deployment.run_ctrl_c()`. diff --git a/docs/docs/hydroflow_plus/quickstart/index.mdx b/docs/docs/hydro/quickstart/index.mdx similarity index 66% rename from docs/docs/hydroflow_plus/quickstart/index.mdx rename to docs/docs/hydro/quickstart/index.mdx index c53a66903f61..955e1df08c53 100644 --- a/docs/docs/hydroflow_plus/quickstart/index.mdx +++ b/docs/docs/hydro/quickstart/index.mdx @@ -1,5 +1,5 @@ # Quickstart -In this tutorial, we'll walk through the basics of Hydroflow+ by building a simple dataflow that prints out the first 10 natural numbers. We'll start with a single process, then pipeline the computation, and finally distribute it across a cluster. +In this tutorial, we'll walk through the basics of Hydro by building a simple dataflow that prints out the first 10 natural numbers. We'll start with a single process, then pipeline the computation, and finally distribute it across a cluster. :::tip @@ -16,14 +16,14 @@ We recommend using VS Code with the `rust-analyzer` extension (and NOT the ::: -## Getting Started with Hydroflow+ -To get started with a new project, we'll use the Hydroflow+ template. The template comes with a simple distributed program. +## Getting Started with Hydro +To get started with a new project, we'll use the Hydro template. The template comes with a simple distributed program. ```bash #shell-command-next-line cargo install cargo-generate #shell-command-next-line -cargo generate gh:hydro-project/hydroflow template/hydroflow_plus +cargo generate gh:hydro-project/hydroflow template/hydro # Project Name: my-example-project #shell-command-next-line cd my-example-project diff --git a/docs/docs/hydro/stageleft.mdx b/docs/docs/hydro/stageleft.mdx new file mode 100644 index 000000000000..54c119394d59 --- /dev/null +++ b/docs/docs/hydro/stageleft.mdx @@ -0,0 +1,10 @@ +--- +title: Stageleft +sidebar_position: 4 +--- + +import StageleftDocs from '../../../stageleft/README.md' + +Under the hood, Hydro uses a library called Stageleft to power the `q!` macro and code generation logic. The following docs, from the Stageleft README, outline the core architecture of Stageleft. + + diff --git a/docs/docs/hydroflow/ecosystem.md b/docs/docs/hydroflow/ecosystem.md index 44199e74523b..afbc7d68ecf8 100644 --- a/docs/docs/hydroflow/ecosystem.md +++ b/docs/docs/hydroflow/ecosystem.md @@ -10,13 +10,13 @@ A rough picture of the Hydro stack is below: Working down from the top: -- [*Hydroflow+*](../hydroflow_plus) is an end-user-facing high-level [choreographic](https://en.wikipedia.org/wiki/Choreographic_programming) [dataflow](https://en.wikipedia.org/wiki/Dataflow_programming) language. Hydroflow+ is a *global* language for programming a fleet of transducers. Programmers author dataflow pipelines that start with streams of events and data, and span boundaries across multiple `process` and (scalable) `cluster` specifications. +- [*Hydro*](../hydro) is an end-user-facing high-level [choreographic](https://en.wikipedia.org/wiki/Choreographic_programming) [dataflow](https://en.wikipedia.org/wiki/Dataflow_programming) language. Hydro is a *global* language for programming a fleet of transducers. Programmers author dataflow pipelines that start with streams of events and data, and span boundaries across multiple `process` and (scalable) `cluster` specifications. -- *Hydrolysis* is a compiler that translates a global Hydroflow+ spec to multiple single-threaded Hydroflow IR programs, which collectively implement the global spec. -This compilation phase is currently a part of the Hydroflow+ codebase, but will evolve into a standalone optimizing compiler inspired by database query optimizers and [e-graphs](https://en.wikipedia.org/wiki/E-graph). +- *Hydrolysis* is a compiler that translates a global Hydro spec to multiple single-threaded Hydroflow IR programs, which collectively implement the global spec. +This compilation phase is currently a part of the Hydro codebase, but will evolve into a standalone optimizing compiler inspired by database query optimizers and [e-graphs](https://en.wikipedia.org/wiki/E-graph). - [Hydroflow IR and its compiler/runtime](https://github.com/hydro-project/hydroflow/tree/main/hydroflow) are the subject of this book. -Where Hydroflow+ is a *global* language for programming a fleet of processes, Hydroflow is a *local* language for programming a single process that participates in a distributed system. More specifically, Hydroflow is an internal representation (IR) language and runtime library that generates the low-level Rust code for an individual transducer. As a low-level IR, Hydroflow is not intended for the general-purpose programmer. For most users it is intended as a readable compiler target from Hydroflow+; advanced developers can also use it to manually program individual transducers. +Where Hydro is a *global* language for programming a fleet of processes, Hydroflow is a *local* language for programming a single process that participates in a distributed system. More specifically, Hydroflow is an internal representation (IR) language and runtime library that generates the low-level Rust code for an individual transducer. As a low-level IR, Hydroflow is not intended for the general-purpose programmer. For most users it is intended as a readable compiler target from Hydro; advanced developers can also use it to manually program individual transducers. - [HydroDeploy](../deploy) is a service for launching Hydroflow transducers on a variety of platforms. diff --git a/docs/docs/hydroflow/quickstart/index.md b/docs/docs/hydroflow/quickstart/index.md index d631fb2cefb5..891b918f04c4 100644 --- a/docs/docs/hydroflow/quickstart/index.md +++ b/docs/docs/hydroflow/quickstart/index.md @@ -3,6 +3,6 @@ This section will get you up and running with Rust and Hydroflow, and work you t :::tip -Hydroflow is the low-level IR that forms the foundation of the Hydro stack. If you're looking for a higher-level API, check out [Hydroflow+](../../hydroflow_plus/index.mdx). +Hydroflow is the low-level IR that forms the foundation of the Hydro stack. If you're looking for a higher-level API, check out [Hydro](../../hydro/index.mdx). ::: diff --git a/docs/docs/hydroflow_plus/consistency.md b/docs/docs/hydroflow_plus/consistency.md deleted file mode 100644 index 239f87efe275..000000000000 --- a/docs/docs/hydroflow_plus/consistency.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -sidebar_position: 3 ---- - -# Consistency and Safety -A key feature of Hydroflow+ is its integration with the Rust type system to highlight possible sources of inconsistent distributed behavior due to sources of non-determinism such as batching, timeouts, and message reordering. In this section, we'll walk through the consistency guarantees in Hydroflow+ and how to use the **`unsafe`** keyword as an escape hatch when introducing sources of non-determinism. - -:::info - -Our consistency and safety model is based on the POPL'25 paper [Flo: A Semantic Foundation for Progressive Stream Processing](https://arxiv.org/abs/2411.08274), which covers the formal details and proofs underlying this system. - -::: - -## Eventual Determinism -Hydroflow+ provides strong guarantees on **determinism**, the property that when provided the same inputs, the outputs of the program are always the same. Even when the inputs and outputs are streaming, we can use this property by looking at the **aggregate collection** (i.e. the result of collecting the elements of the stream into a finite collection). This makes it easy to build composable blocks of code without having to worry about runtime behavior such as batching or network delays. - -Because Hydroflow+ programs can involve network delay, we guarantee **eventual determinism**: given a set of streaming inputs which have arrived, the outputs of the program (which continuously change as inputs arrive) will **eventually** have the same _aggregate_ value. - -Again, by focusing on the _aggregate_ value rather than individual outputs, Hydroflow+ programs can involve concepts such as retractions (for incremental computation) while still guaranteeing determinism because the _resolved_ output (after processing retractions) will eventually be the same. - -:::note - -Much existing literature in distributed systems focuses on consistency levels such as "eventual consistency" which typically correspond to guarantees when reading the state of a _replicated_ object (or set of objects) at a _specific point_ in time. Hydroflow+ does not use such a consistency model internally, instead focusing on the values local to each distributed location _over time_. Concepts such as replication, however, can be layered on top of this model. - -::: - -## Unsafe Operations in Hydroflow+ -All **safe** APIs in Hydroflow+ (the ones you can call regularly in Rust), guarantee determinism. But oftentimes it is necessary to do something non-deterministic, like generate events at a fixed time interval or split an input into arbitrarily sized batches. - -Hydroflow+ offers APIs for such concepts behind an **`unsafe`** guard. This keyword is typically used to mark Rust functions that may not be memory-safe, but we reuse this in Hydroflow+ to mark non-deterministic APIs. - -To call such an API, the Rust compiler will ask you to wrap the call in an `unsafe` block. It is typically good practice to also include a `// SAFETY: ...` comment to explain why the non-determinism is there. - -```rust,no_run -# use hydroflow_plus::*; -# let flow = FlowBuilder::new(); -# let stream_inputs = flow.process::<()>().source_iter(q!([123])); -use std::time::Duration; - -unsafe { - // SAFETY: intentional non-determinism - stream_inputs - .sample_every(q!(Duration::from_secs(1))) -}.for_each(q!(|v| println!("Sample: {:?}", v))) -``` - -When writing a function with Hydroflow+ that involves `unsafe` code, it is important to be extra careful about whether the non-determinism is exposed externally. In some applications, a utility function may involve local non-determinism (such as sending retries), but not expose it outside the function (via deduplication). - -But other utilities may expose the non-determinism, in which case they should be marked `unsafe` as well. If the function is public, Rust will require you to put a `# Safety` section in its documentation explain the non-determinism. - -```rust -# use hydroflow_plus::*; -use std::fmt::Debug; -use std::time::Duration; - -/// ... -/// -/// # Safety -/// This function will non-deterministically print elements -/// from the stream according to a timer. -unsafe fn print_samples( - stream: Stream, Unbounded> -) { - unsafe { - // SAFETY: documented non-determinism - stream - .sample_every(q!(Duration::from_secs(1))) - }.for_each(q!(|v| println!("Sample: {:?}", v))) -} -``` - -## User-Defined Functions -Another source of potential non-determinism is user-defined functions, such as those provided to `map` or `filter`. Hydroflow+ allows for arbitrary Rust functions to be called inside these closures, so it is possible to introduce non-determinism which will not be checked by the compiler. - -In general, avoid using APIs like random number generators inside transformation functions unless that non-determinism is explicitly documented somewhere. - -:::info - -To help avoid such bugs, we are working on ways to use formal verification tools (such as [Kani](https://model-checking.github.io/kani/)) to check arbitrary Rust code for properties such as determinism and more. But this remains active research for now and is not yet available. - -::: diff --git a/docs/docs/hydroflow_plus/dataflow-programming.mdx b/docs/docs/hydroflow_plus/dataflow-programming.mdx deleted file mode 100644 index f88b2d389233..000000000000 --- a/docs/docs/hydroflow_plus/dataflow-programming.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Dataflow Programming -Hydroflow+ uses a dataflow programming model, which will be familiar if you have used APIs like Rust iterators. Instead of using RPCs or async/await to describe distributed computation, Hydroflow+ instead uses **asynchronous streams**, which represent data arriving over time. Streams can represent a series of asynchronous events (e.g. inbound network requests) or a sequence of data items. - -Programs in Hydroflow+ describe how to **transform** entire collections of data using operators such as `map` (transforming elements one by one), `fold` (aggregating elements into a single value), or `join` (combining elements from multiple streams on matching keys). - -If you are familiar with Spark, Flink or Pandas, you will find Hydroflow+ syntax familiar. However, note well that the semantics for asynchronous streams in Hydroflow+ differ significantly from bulk analytics systems like those above. In particular, Hydroflow+ uses the type system to distinguish between bounded streams (originating from finite data) and unbounded streams (originated from asynchronous input). Moreover, Hydroflow+ is designed to handle asynchronous streams of small, independent events very efficiently. - - - diff --git a/docs/docs/hydroflow_plus/index.mdx b/docs/docs/hydroflow_plus/index.mdx deleted file mode 100644 index c2ade3d3f6f3..000000000000 --- a/docs/docs/hydroflow_plus/index.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -sidebar_position: 0 ---- - -# Introduction -Hydroflow+ is a high-level distributed programming framework for Rust powered by the [Hydroflow runtime](../hydroflow/index.mdx). Unlike traditional architectures such as actors or RPCs, Hydroflow+ offers _choreographic_ APIs, where expressions and functions can describe computation that takes place across many locations. It also integrates with [Hydro Deploy](../deploy/index.md) to make it easy to deploy and run Hydroflow+ programs to the cloud. - -Hydroflow+ uses a two-stage compilation approach. HF+ programs are standard Rust programs, which first run on the developer's laptop to generate a _deployment plan_. This plan is then compiled to individual binaries for each machine in the distributed system (enabling zero-overhead abstractions), and are then deployed to the cloud using the generated plan along with specifications of cloud resources. - -Hydroflow+ has been used to write a variety of high-performance distributed systems, including implementations of classic distributed protocols such as two-phase commit and Paxos. Work is ongoing to develop a distributed systems standard library that will offer these protocols and more as reusable components. - -:::caution - -The docs for Hydroflow+ are still a work in progress. If you have any questions or run into bugs, please file an issue on the [Hydroflow GitHub repository](https://github.com/hydro-project/hydroflow). - -::: diff --git a/docs/docs/hydroflow_plus/stageleft.mdx b/docs/docs/hydroflow_plus/stageleft.mdx deleted file mode 100644 index 90e4a6bb01cf..000000000000 --- a/docs/docs/hydroflow_plus/stageleft.mdx +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Stageleft -sidebar_position: 4 ---- - -import StageleftDocs from '../../../stageleft/README.md' - -Under the hood, Hydroflow+ uses a library called Stageleft to power the `q!` macro and code generation logic. The following docs, from the Stageleft README, outline the core architecture of Stageleft. - - diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 846e3e20dd41..ac5fe7fa8e47 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -125,8 +125,8 @@ const config = { }, { type: 'docSidebar', - sidebarId: 'hydroflowPlusSidebar', - label: 'Hydroflow+', + sidebarId: 'hydroSidebar', + label: 'Hydro', }, { type: 'docSidebar', @@ -173,8 +173,8 @@ const config = { to: '/docs/hydroflow/', }, { - label: 'Hydroflow+', - to: '/docs/hydroflow_plus/', + label: 'Hydro', + to: '/docs/hydro/', }, { label: 'Hydro Deploy', diff --git a/docs/sidebars.js b/docs/sidebars.js index d433609f4d87..042939c241cb 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -15,7 +15,7 @@ const sidebars = { // By default, Docusaurus generates a sidebar from the docs folder structure hydroflowSidebar: [{type: 'autogenerated', dirName: 'hydroflow'}], - hydroflowPlusSidebar: [{type: 'autogenerated', dirName: 'hydroflow_plus'}], + hydroSidebar: [{type: 'autogenerated', dirName: 'hydro'}], deploySidebar: [{type: 'autogenerated', dirName: 'deploy'}], }; diff --git a/docs/src/pages/index.js b/docs/src/pages/index.js index 7b89d377e3bb..3223a4febf9c 100644 --- a/docs/src/pages/index.js +++ b/docs/src/pages/index.js @@ -26,7 +26,7 @@ export default function Home() { justifyContent: "center", flexWrap: "wrap" }}> - { - pub(super) ir: Vec, + pub(super) ir: Vec, pub(super) processes: Vec, pub(super) clusters: Vec, pub(super) used: bool, @@ -27,7 +27,7 @@ impl Drop for BuiltFlow<'_> { } } -pub(crate) fn build_inner(ir: &mut Vec) -> BTreeMap { +pub(crate) fn build_inner(ir: &mut Vec) -> BTreeMap { let mut builders = BTreeMap::new(); let mut built_tees = HashMap::new(); let mut next_stmt_id = 0; @@ -46,11 +46,11 @@ pub(crate) fn build_inner(ir: &mut Vec) -> BTreeMap BuiltFlow<'a> { - pub fn ir(&self) -> &Vec { + pub fn ir(&self) -> &Vec { &self.ir } - pub fn optimize_with(mut self, f: impl FnOnce(Vec) -> Vec) -> Self { + pub fn optimize_with(mut self, f: impl FnOnce(Vec) -> Vec) -> Self { self.used = true; BuiltFlow { ir: f(std::mem::take(&mut self.ir)), diff --git a/hydroflow_plus/src/builder/compiled.rs b/hydro_lang/src/builder/compiled.rs similarity index 95% rename from hydroflow_plus/src/builder/compiled.rs rename to hydro_lang/src/builder/compiled.rs index 5e4164e6c796..57467799498b 100644 --- a/hydroflow_plus/src/builder/compiled.rs +++ b/hydro_lang/src/builder/compiled.rs @@ -31,10 +31,10 @@ impl<'a> CompiledFlow<'a, usize> { self, id: impl QuotedWithContext<'a, usize, ()>, ) -> CompiledFlowWithId<'a> { - let hydroflow_crate = proc_macro_crate::crate_name("hydroflow_plus") - .expect("hydroflow_plus should be present in `Cargo.toml`"); + let hydroflow_crate = proc_macro_crate::crate_name("hydro_lang") + .expect("hydro_lang should be present in `Cargo.toml`"); let root = match hydroflow_crate { - proc_macro_crate::FoundCrate::Itself => quote! { hydroflow_plus::hydroflow }, + proc_macro_crate::FoundCrate::Itself => quote! { hydro_lang::hydroflow }, proc_macro_crate::FoundCrate::Name(name) => { let ident = syn::Ident::new(&name, proc_macro2::Span::call_site()); quote! { #ident::hydroflow } @@ -91,10 +91,10 @@ impl<'a, Ctx> FreeVariableWithContext for CompiledFlow<'a, ()> { type O = Hydroflow<'a>; fn to_tokens(mut self, _ctx: &Ctx) -> (Option, Option) { - let hydroflow_crate = proc_macro_crate::crate_name("hydroflow_plus") - .expect("hydroflow_plus should be present in `Cargo.toml`"); + let hydroflow_crate = proc_macro_crate::crate_name("hydro_lang") + .expect("hydro_lang should be present in `Cargo.toml`"); let root = match hydroflow_crate { - proc_macro_crate::FoundCrate::Itself => quote! { hydroflow_plus::hydroflow }, + proc_macro_crate::FoundCrate::Itself => quote! { hydro_lang::hydroflow }, proc_macro_crate::FoundCrate::Name(name) => { let ident = syn::Ident::new(&name, proc_macro2::Span::call_site()); quote! { #ident::hydroflow } diff --git a/hydroflow_plus/src/builder/deploy.rs b/hydro_lang/src/builder/deploy.rs similarity index 95% rename from hydroflow_plus/src/builder/deploy.rs rename to hydro_lang/src/builder/deploy.rs index 6e11e8935dcb..db11d7bcdd90 100644 --- a/hydroflow_plus/src/builder/deploy.rs +++ b/hydro_lang/src/builder/deploy.rs @@ -16,7 +16,7 @@ use crate::deploy::{ ClusterSpec, Deploy, ExternalSpec, IntoProcessSpec, LocalDeploy, Node, ProcessSpec, RegisterPort, }; -use crate::ir::HfPlusLeaf; +use crate::ir::HydroLeaf; use crate::location::external_process::{ ExternalBincodeSink, ExternalBincodeStream, ExternalBytesPort, }; @@ -24,7 +24,7 @@ use crate::location::{Cluster, ExternalProcess, Location, LocationId, Process}; use crate::staging_util::Invariant; pub struct DeployFlow<'a, D: LocalDeploy<'a>> { - pub(super) ir: Vec, + pub(super) ir: Vec, pub(super) nodes: HashMap, pub(super) externals: HashMap, pub(super) clusters: HashMap, @@ -42,7 +42,7 @@ impl<'a, D: LocalDeploy<'a>> Drop for DeployFlow<'a, D> { } impl<'a, D: LocalDeploy<'a>> DeployFlow<'a, D> { - pub fn ir(&self) -> &Vec { + pub fn ir(&self) -> &Vec { &self.ir } @@ -93,7 +93,7 @@ impl<'a, D: Deploy<'a>> DeployFlow<'a, D> { self.used = true; let mut seen_tees: HashMap<_, _> = HashMap::new(); - let mut flow_state_networked: Vec = std::mem::take(&mut self.ir) + let mut flow_state_networked: Vec = std::mem::take(&mut self.ir) .into_iter() .map(|leaf| { leaf.compile_network::( @@ -121,7 +121,7 @@ impl<'a, D: Deploy<'a>> DeployFlow<'a, D> { let mut extra_stmts: BTreeMap> = BTreeMap::new(); for &c_id in self.clusters.keys() { let self_id_ident = syn::Ident::new( - &format!("__hydroflow_plus_cluster_self_id_{}", c_id), + &format!("__hydro_lang_cluster_self_id_{}", c_id), Span::call_site(), ); let self_id_expr = D::cluster_self_id(env).splice_untyped(); @@ -134,7 +134,7 @@ impl<'a, D: Deploy<'a>> DeployFlow<'a, D> { for other_location in 0..all_locations_count { let other_id_ident = syn::Ident::new( - &format!("__hydroflow_plus_cluster_ids_{}", c_id), + &format!("__hydro_lang_cluster_ids_{}", c_id), Span::call_site(), ); let other_id_expr = D::cluster_ids(env, c_id).splice_untyped(); @@ -156,7 +156,7 @@ impl<'a, D: Deploy<'a, CompileEnv = ()>> DeployFlow<'a, D> { self.used = true; let mut seen_tees_instantiate: HashMap<_, _> = HashMap::new(); - let mut flow_state_networked: Vec = std::mem::take(&mut self.ir) + let mut flow_state_networked: Vec = std::mem::take(&mut self.ir) .into_iter() .map(|leaf| { leaf.compile_network::( diff --git a/hydroflow_plus/src/builder/mod.rs b/hydro_lang/src/builder/mod.rs similarity index 97% rename from hydroflow_plus/src/builder/mod.rs rename to hydro_lang/src/builder/mod.rs index 5bda46deab72..894fb99a714b 100644 --- a/hydroflow_plus/src/builder/mod.rs +++ b/hydro_lang/src/builder/mod.rs @@ -11,7 +11,7 @@ use stageleft::*; #[cfg(feature = "build")] use crate::deploy::{ClusterSpec, Deploy, ExternalSpec, IntoProcessSpec, LocalDeploy}; -use crate::ir::HfPlusLeaf; +use crate::ir::HydroLeaf; use crate::location::{Cluster, ExternalProcess, Process}; use crate::staging_util::Invariant; @@ -26,7 +26,7 @@ pub struct FlowStateInner { /// Tracks the leaves of the dataflow IR. This is referenced by /// `Stream` and `HfCycle` to build the IR. The inner option will /// be set to `None` when this builder is finalized. - pub(crate) leaves: Option>, + pub(crate) leaves: Option>, /// Counter for generating unique external output identifiers. pub(crate) next_external_out: usize, @@ -116,7 +116,7 @@ impl<'a> FlowBuilder<'a> { #[cfg(feature = "build")] pub fn optimize_with( self, - f: impl FnOnce(Vec) -> Vec, + f: impl FnOnce(Vec) -> Vec, ) -> built::BuiltFlow<'a> { self.finalize().optimize_with(f) } diff --git a/hydroflow_plus/src/cycle.rs b/hydro_lang/src/cycle.rs similarity index 100% rename from hydroflow_plus/src/cycle.rs rename to hydro_lang/src/cycle.rs diff --git a/hydroflow_plus/src/deploy/deploy_graph.rs b/hydro_lang/src/deploy/deploy_graph.rs similarity index 97% rename from hydroflow_plus/src/deploy/deploy_graph.rs rename to hydro_lang/src/deploy/deploy_graph.rs index a69332167d5e..60423153c23b 100644 --- a/hydroflow_plus/src/deploy/deploy_graph.rs +++ b/hydro_lang/src/deploy/deploy_graph.rs @@ -62,7 +62,7 @@ impl<'a> Deploy<'a> for HydroDeploy { let p1_port = p1_port.as_str(); let p2_port = p2_port.as_str(); deploy_o2o( - RuntimeData::new("__hydroflow_plus_trybuild_cli"), + RuntimeData::new("__hydro_lang_trybuild_cli"), p1_port, p2_port, ) @@ -108,7 +108,7 @@ impl<'a> Deploy<'a> for HydroDeploy { let p1_port = p1_port.as_str(); let c2_port = c2_port.as_str(); deploy_o2m( - RuntimeData::new("__hydroflow_plus_trybuild_cli"), + RuntimeData::new("__hydro_lang_trybuild_cli"), p1_port, c2_port, ) @@ -164,7 +164,7 @@ impl<'a> Deploy<'a> for HydroDeploy { let c1_port = c1_port.as_str(); let p2_port = p2_port.as_str(); deploy_m2o( - RuntimeData::new("__hydroflow_plus_trybuild_cli"), + RuntimeData::new("__hydro_lang_trybuild_cli"), c1_port, p2_port, ) @@ -216,7 +216,7 @@ impl<'a> Deploy<'a> for HydroDeploy { let c1_port = c1_port.as_str(); let c2_port = c2_port.as_str(); deploy_m2m( - RuntimeData::new("__hydroflow_plus_trybuild_cli"), + RuntimeData::new("__hydro_lang_trybuild_cli"), c1_port, c2_port, ) @@ -277,7 +277,7 @@ impl<'a> Deploy<'a> for HydroDeploy { let p1_port = p1_port.as_str(); let p2_port = p2_port.as_str(); deploy_e2o( - RuntimeData::new("__hydroflow_plus_trybuild_cli"), + RuntimeData::new("__hydro_lang_trybuild_cli"), p1_port, p2_port, ) @@ -327,7 +327,7 @@ impl<'a> Deploy<'a> for HydroDeploy { let p1_port = p1_port.as_str(); let p2_port = p2_port.as_str(); deploy_o2e( - RuntimeData::new("__hydroflow_plus_trybuild_cli"), + RuntimeData::new("__hydro_lang_trybuild_cli"), p1_port, p2_port, ) @@ -371,14 +371,11 @@ impl<'a> Deploy<'a> for HydroDeploy { _env: &Self::CompileEnv, of_cluster: usize, ) -> impl QuotedWithContext<'a, &'a Vec, ()> + Copy + 'a { - cluster_members( - RuntimeData::new("__hydroflow_plus_trybuild_cli"), - of_cluster, - ) + cluster_members(RuntimeData::new("__hydro_lang_trybuild_cli"), of_cluster) } fn cluster_self_id(_env: &Self::CompileEnv) -> impl QuotedWithContext<'a, u32, ()> + Copy + 'a { - cluster_self_id(RuntimeData::new("__hydroflow_plus_trybuild_cli")) + cluster_self_id(RuntimeData::new("__hydro_lang_trybuild_cli")) } } diff --git a/hydroflow_plus/src/deploy/in_memory_graph.rs b/hydro_lang/src/deploy/in_memory_graph.rs similarity index 100% rename from hydroflow_plus/src/deploy/in_memory_graph.rs rename to hydro_lang/src/deploy/in_memory_graph.rs diff --git a/hydroflow_plus/src/deploy/macro_runtime.rs b/hydro_lang/src/deploy/macro_runtime.rs similarity index 100% rename from hydroflow_plus/src/deploy/macro_runtime.rs rename to hydro_lang/src/deploy/macro_runtime.rs diff --git a/hydroflow_plus/src/deploy/mod.rs b/hydro_lang/src/deploy/mod.rs similarity index 100% rename from hydroflow_plus/src/deploy/mod.rs rename to hydro_lang/src/deploy/mod.rs diff --git a/hydroflow_plus/src/deploy/trybuild.rs b/hydro_lang/src/deploy/trybuild.rs similarity index 90% rename from hydroflow_plus/src/deploy/trybuild.rs rename to hydro_lang/src/deploy/trybuild.rs index 85bda16b4de3..2a725a322614 100644 --- a/hydroflow_plus/src/deploy/trybuild.rs +++ b/hydro_lang/src/deploy/trybuild.rs @@ -93,7 +93,7 @@ pub fn compile_graph_trybuild(graph: HydroflowGraph, extra_stmts: Vec let mut diagnostics = Vec::new(); let tokens = partitioned_graph.as_code( - "e! { hydroflow_plus::hydroflow }, + "e! { hydro_lang::hydroflow }, true, quote!(), &mut diagnostics, @@ -101,20 +101,20 @@ pub fn compile_graph_trybuild(graph: HydroflowGraph, extra_stmts: Vec let source_ast: syn::File = syn::parse_quote! { #![allow(unused_imports, unused_crate_dependencies, missing_docs, non_snake_case)] - use hydroflow_plus::*; + use hydro_lang::*; #[allow(unused)] - fn __hfplus_runtime<'a>(__hydroflow_plus_trybuild_cli: &'a hydroflow_plus::hydroflow::util::deploy::DeployPorts) -> hydroflow_plus::hydroflow::scheduled::graph::Hydroflow<'a> { + fn __hydro_runtime<'a>(__hydro_lang_trybuild_cli: &'a hydro_lang::hydroflow::util::deploy::DeployPorts) -> hydro_lang::hydroflow::scheduled::graph::Hydroflow<'a> { #(#extra_stmts)* #tokens } #[tokio::main] async fn main() { - let ports = hydroflow_plus::hydroflow::util::deploy::init_no_ack_start().await; - let flow = __hfplus_runtime(&ports); + let ports = hydro_lang::hydroflow::util::deploy::init_no_ack_start().await; + let flow = __hydro_runtime(&ports); println!("ack start"); - hydroflow_plus::hydroflow::util::deploy::launch_flow(flow).await; + hydro_lang::hydroflow::util::deploy::launch_flow(flow).await; } }; source_ast @@ -158,10 +158,10 @@ pub fn create_trybuild( .collect(); let crate_name = source_manifest.package.name.clone(); - let project_dir = path!(target_dir / "hfplus_trybuild" / crate_name /); + let project_dir = path!(target_dir / "hydro_trybuild" / crate_name /); fs::create_dir_all(&project_dir)?; - let project_name = format!("{}-hfplus-trybuild", crate_name); + let project_name = format!("{}-hydro-trybuild", crate_name); let mut manifest = Runner::make_manifest( &workspace, &project_name, @@ -235,7 +235,7 @@ pub fn create_trybuild( Ok(( project.dir.as_ref().into(), - path!(project.target_dir / "hfplus_trybuild"), + path!(project.target_dir / "hydro_trybuild"), project.features, )) } diff --git a/hydroflow_plus/src/deploy/trybuild_rewriters.rs b/hydro_lang/src/deploy/trybuild_rewriters.rs similarity index 100% rename from hydroflow_plus/src/deploy/trybuild_rewriters.rs rename to hydro_lang/src/deploy/trybuild_rewriters.rs diff --git a/hydroflow_plus/src/deploy_runtime.rs b/hydro_lang/src/deploy_runtime.rs similarity index 100% rename from hydroflow_plus/src/deploy_runtime.rs rename to hydro_lang/src/deploy_runtime.rs diff --git a/hydroflow_plus/src/ir.rs b/hydro_lang/src/ir.rs similarity index 85% rename from hydroflow_plus/src/ir.rs rename to hydro_lang/src/ir.rs index 6534850a7ce2..a0e20bd678fa 100644 --- a/hydroflow_plus/src/ir.rs +++ b/hydro_lang/src/ir.rs @@ -60,36 +60,36 @@ impl Debug for DebugInstantiate { } } -/// A source in a Hydroflow+ graph, where data enters the graph. +/// A source in a Hydro graph, where data enters the graph. #[derive(Debug)] -pub enum HfPlusSource { +pub enum HydroSource { Stream(DebugExpr), ExternalNetwork(), Iter(DebugExpr), Spin(), } -/// An leaf in a Hydroflow+ graph, which is an pipeline that doesn't emit +/// An leaf in a Hydro graph, which is an pipeline that doesn't emit /// any downstream values. Traversals over the dataflow graph and /// generating Hydroflow IR start from leaves. #[derive(Debug)] -pub enum HfPlusLeaf { +pub enum HydroLeaf { ForEach { f: DebugExpr, - input: Box, + input: Box, }, DestSink { sink: DebugExpr, - input: Box, + input: Box, }, CycleSink { ident: syn::Ident, location_kind: LocationId, - input: Box, + input: Box, }, } -impl HfPlusLeaf { +impl HydroLeaf { #[cfg(feature = "build")] pub fn compile_network<'a, D: Deploy<'a>>( self, @@ -98,7 +98,7 @@ impl HfPlusLeaf { nodes: &HashMap, clusters: &HashMap, externals: &HashMap, - ) -> HfPlusLeaf { + ) -> HydroLeaf { self.transform_children( |n, s| { n.compile_network::(compile_env, s, nodes, clusters, externals); @@ -107,7 +107,7 @@ impl HfPlusLeaf { ) } - pub fn connect_network(self, seen_tees: &mut SeenTees) -> HfPlusLeaf { + pub fn connect_network(self, seen_tees: &mut SeenTees) -> HydroLeaf { self.transform_children( |n, s| { n.connect_network(s); @@ -118,25 +118,25 @@ impl HfPlusLeaf { pub fn transform_children( self, - mut transform: impl FnMut(&mut HfPlusNode, &mut SeenTees), + mut transform: impl FnMut(&mut HydroNode, &mut SeenTees), seen_tees: &mut SeenTees, - ) -> HfPlusLeaf { + ) -> HydroLeaf { match self { - HfPlusLeaf::ForEach { f, mut input } => { + HydroLeaf::ForEach { f, mut input } => { transform(&mut input, seen_tees); - HfPlusLeaf::ForEach { f, input } + HydroLeaf::ForEach { f, input } } - HfPlusLeaf::DestSink { sink, mut input } => { + HydroLeaf::DestSink { sink, mut input } => { transform(&mut input, seen_tees); - HfPlusLeaf::DestSink { sink, input } + HydroLeaf::DestSink { sink, input } } - HfPlusLeaf::CycleSink { + HydroLeaf::CycleSink { ident, location_kind, mut input, } => { transform(&mut input, seen_tees); - HfPlusLeaf::CycleSink { + HydroLeaf::CycleSink { ident, location_kind, input, @@ -149,11 +149,11 @@ impl HfPlusLeaf { pub fn emit( &self, graph_builders: &mut BTreeMap, - built_tees: &mut HashMap<*const RefCell, (syn::Ident, usize)>, + built_tees: &mut HashMap<*const RefCell, (syn::Ident, usize)>, next_stmt_id: &mut usize, ) { match self { - HfPlusLeaf::ForEach { f, input } => { + HydroLeaf::ForEach { f, input } => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -165,7 +165,7 @@ impl HfPlusLeaf { }); } - HfPlusLeaf::DestSink { sink, input } => { + HydroLeaf::DestSink { sink, input } => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -177,7 +177,7 @@ impl HfPlusLeaf { }); } - HfPlusLeaf::CycleSink { + HydroLeaf::CycleSink { ident, location_kind, input, @@ -208,7 +208,7 @@ impl HfPlusLeaf { } } -type PrintedTees = RefCell, usize>)>>; +type PrintedTees = RefCell, usize>)>>; thread_local! { static PRINTED_TEES: PrintedTees = const { RefCell::new(None) }; } @@ -228,7 +228,7 @@ pub fn dbg_dedup_tee(f: impl FnOnce() -> T) -> T { }) } -pub struct TeeNode(pub Rc>); +pub struct TeeNode(pub Rc>); impl Debug for TeeNode { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -239,7 +239,7 @@ impl Debug for TeeNode { if let Some(printed_tees_mut) = printed_tees_mut { if let Some(existing) = printed_tees_mut .1 - .get(&(self.0.as_ref() as *const RefCell)) + .get(&(self.0.as_ref() as *const RefCell)) { write!(f, "", existing) } else { @@ -247,7 +247,7 @@ impl Debug for TeeNode { printed_tees_mut.0 += 1; printed_tees_mut .1 - .insert(self.0.as_ref() as *const RefCell, next_id); + .insert(self.0.as_ref() as *const RefCell, next_id); drop(printed_tees_mut_borrow); write!(f, ": ", next_id)?; Debug::fmt(&self.0.borrow(), f) @@ -261,14 +261,14 @@ impl Debug for TeeNode { } } -/// An intermediate node in a Hydroflow+ graph, which consumes data +/// An intermediate node in a Hydro graph, which consumes data /// from upstream nodes and emits data to downstream nodes. #[derive(Debug)] -pub enum HfPlusNode { +pub enum HydroNode { Placeholder, Source { - source: HfPlusSource, + source: HydroSource, location_kind: LocationId, }, @@ -281,65 +281,65 @@ pub enum HfPlusNode { inner: TeeNode, }, - Persist(Box), - Unpersist(Box), - Delta(Box), + Persist(Box), + Unpersist(Box), + Delta(Box), - Chain(Box, Box), - CrossProduct(Box, Box), - CrossSingleton(Box, Box), - Join(Box, Box), - Difference(Box, Box), - AntiJoin(Box, Box), + Chain(Box, Box), + CrossProduct(Box, Box), + CrossSingleton(Box, Box), + Join(Box, Box), + Difference(Box, Box), + AntiJoin(Box, Box), Map { f: DebugExpr, - input: Box, + input: Box, }, FlatMap { f: DebugExpr, - input: Box, + input: Box, }, Filter { f: DebugExpr, - input: Box, + input: Box, }, FilterMap { f: DebugExpr, - input: Box, + input: Box, }, - DeferTick(Box), + DeferTick(Box), Enumerate { is_static: bool, - input: Box, + input: Box, }, Inspect { f: DebugExpr, - input: Box, + input: Box, }, - Unique(Box), + Unique(Box), - Sort(Box), + Sort(Box), Fold { init: DebugExpr, acc: DebugExpr, - input: Box, + input: Box, }, FoldKeyed { init: DebugExpr, acc: DebugExpr, - input: Box, + input: Box, }, Reduce { f: DebugExpr, - input: Box, + input: Box, }, ReduceKeyed { f: DebugExpr, - input: Box, + input: Box, }, Network { @@ -350,13 +350,13 @@ pub enum HfPlusNode { serialize_fn: Option, instantiate_fn: DebugInstantiate, deserialize_fn: Option, - input: Box, + input: Box, }, } -pub type SeenTees = HashMap<*const RefCell, Rc>>; +pub type SeenTees = HashMap<*const RefCell, Rc>>; -impl<'a> HfPlusNode { +impl<'a> HydroNode { #[cfg(feature = "build")] pub fn compile_network>( &mut self, @@ -371,7 +371,7 @@ impl<'a> HfPlusNode { seen_tees, ); - if let HfPlusNode::Network { + if let HydroNode::Network { from_location, from_key, to_location, @@ -401,7 +401,7 @@ impl<'a> HfPlusNode { pub fn connect_network(&mut self, seen_tees: &mut SeenTees) { self.transform_children(|n, s| n.connect_network(s), seen_tees); - if let HfPlusNode::Network { instantiate_fn, .. } = self { + if let HydroNode::Network { instantiate_fn, .. } = self { match instantiate_fn { DebugInstantiate::Building() => panic!("network not built"), @@ -414,7 +414,7 @@ impl<'a> HfPlusNode { pub fn transform_bottom_up( &mut self, - mut transform: impl FnMut(&mut HfPlusNode, &mut C) + Copy, + mut transform: impl FnMut(&mut HydroNode, &mut C) + Copy, seen_tees: &mut SeenTees, ctx: &mut C, ) { @@ -426,109 +426,109 @@ impl<'a> HfPlusNode { #[inline(always)] pub fn transform_children( &mut self, - mut transform: impl FnMut(&mut HfPlusNode, &mut SeenTees), + mut transform: impl FnMut(&mut HydroNode, &mut SeenTees), seen_tees: &mut SeenTees, ) { match self { - HfPlusNode::Placeholder => { + HydroNode::Placeholder => { panic!(); } - HfPlusNode::Source { .. } => {} + HydroNode::Source { .. } => {} - HfPlusNode::CycleSource { .. } => {} + HydroNode::CycleSource { .. } => {} - HfPlusNode::Tee { inner } => { + HydroNode::Tee { inner } => { if let Some(transformed) = - seen_tees.get(&(inner.0.as_ref() as *const RefCell)) + seen_tees.get(&(inner.0.as_ref() as *const RefCell)) { *inner = TeeNode(transformed.clone()); } else { - let transformed_cell = Rc::new(RefCell::new(HfPlusNode::Placeholder)); + let transformed_cell = Rc::new(RefCell::new(HydroNode::Placeholder)); seen_tees.insert( - inner.0.as_ref() as *const RefCell, + inner.0.as_ref() as *const RefCell, transformed_cell.clone(), ); - let mut orig = inner.0.replace(HfPlusNode::Placeholder); + let mut orig = inner.0.replace(HydroNode::Placeholder); transform(&mut orig, seen_tees); *transformed_cell.borrow_mut() = orig; *inner = TeeNode(transformed_cell); } } - HfPlusNode::Persist(inner) => transform(inner.as_mut(), seen_tees), - HfPlusNode::Unpersist(inner) => transform(inner.as_mut(), seen_tees), - HfPlusNode::Delta(inner) => transform(inner.as_mut(), seen_tees), + HydroNode::Persist(inner) => transform(inner.as_mut(), seen_tees), + HydroNode::Unpersist(inner) => transform(inner.as_mut(), seen_tees), + HydroNode::Delta(inner) => transform(inner.as_mut(), seen_tees), - HfPlusNode::Chain(left, right) => { + HydroNode::Chain(left, right) => { transform(left.as_mut(), seen_tees); transform(right.as_mut(), seen_tees); } - HfPlusNode::CrossProduct(left, right) => { + HydroNode::CrossProduct(left, right) => { transform(left.as_mut(), seen_tees); transform(right.as_mut(), seen_tees); } - HfPlusNode::CrossSingleton(left, right) => { + HydroNode::CrossSingleton(left, right) => { transform(left.as_mut(), seen_tees); transform(right.as_mut(), seen_tees); } - HfPlusNode::Join(left, right) => { + HydroNode::Join(left, right) => { transform(left.as_mut(), seen_tees); transform(right.as_mut(), seen_tees); } - HfPlusNode::Difference(left, right) => { + HydroNode::Difference(left, right) => { transform(left.as_mut(), seen_tees); transform(right.as_mut(), seen_tees); } - HfPlusNode::AntiJoin(left, right) => { + HydroNode::AntiJoin(left, right) => { transform(left.as_mut(), seen_tees); transform(right.as_mut(), seen_tees); } - HfPlusNode::Map { input, .. } => { + HydroNode::Map { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::FlatMap { input, .. } => { + HydroNode::FlatMap { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::Filter { input, .. } => { + HydroNode::Filter { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::FilterMap { input, .. } => { + HydroNode::FilterMap { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::Sort(input) => { + HydroNode::Sort(input) => { transform(input.as_mut(), seen_tees); } - HfPlusNode::DeferTick(input) => { + HydroNode::DeferTick(input) => { transform(input.as_mut(), seen_tees); } - HfPlusNode::Enumerate { input, .. } => { + HydroNode::Enumerate { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::Inspect { input, .. } => { + HydroNode::Inspect { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::Unique(input) => { + HydroNode::Unique(input) => { transform(input.as_mut(), seen_tees); } - HfPlusNode::Fold { input, .. } => { + HydroNode::Fold { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::FoldKeyed { input, .. } => { + HydroNode::FoldKeyed { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::Reduce { input, .. } => { + HydroNode::Reduce { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::ReduceKeyed { input, .. } => { + HydroNode::ReduceKeyed { input, .. } => { transform(input.as_mut(), seen_tees); } - HfPlusNode::Network { input, .. } => { + HydroNode::Network { input, .. } => { transform(input.as_mut(), seen_tees); } } @@ -538,15 +538,15 @@ impl<'a> HfPlusNode { pub fn emit( &self, graph_builders: &mut BTreeMap, - built_tees: &mut HashMap<*const RefCell, (syn::Ident, usize)>, + built_tees: &mut HashMap<*const RefCell, (syn::Ident, usize)>, next_stmt_id: &mut usize, ) -> (syn::Ident, usize) { match self { - HfPlusNode::Placeholder => { + HydroNode::Placeholder => { panic!() } - HfPlusNode::Persist(inner) => { + HydroNode::Persist(inner) => { let (inner_ident, location) = inner.emit(graph_builders, built_tees, next_stmt_id); let persist_id = *next_stmt_id; @@ -563,11 +563,11 @@ impl<'a> HfPlusNode { (persist_ident, location) } - HfPlusNode::Unpersist(_) => { + HydroNode::Unpersist(_) => { panic!("Unpersist is a marker node and should have been optimized away. This is likely a compiler bug.") } - HfPlusNode::Delta(inner) => { + HydroNode::Delta(inner) => { let (inner_ident, location) = inner.emit(graph_builders, built_tees, next_stmt_id); let delta_id = *next_stmt_id; @@ -584,7 +584,7 @@ impl<'a> HfPlusNode { (delta_ident, location) } - HfPlusNode::Source { + HydroNode::Source { source, location_kind, } => { @@ -595,7 +595,7 @@ impl<'a> HfPlusNode { LocationId::ExternalProcess(id) => id, }; - if let HfPlusSource::ExternalNetwork() = source { + if let HydroSource::ExternalNetwork() = source { (syn::Ident::new("DUMMY", Span::call_site()), *location_id) } else { let source_id = *next_stmt_id; @@ -605,23 +605,23 @@ impl<'a> HfPlusNode { syn::Ident::new(&format!("stream_{}", source_id), Span::call_site()); let source_stmt = match source { - HfPlusSource::Stream(expr) => { + HydroSource::Stream(expr) => { parse_quote! { #source_ident = source_stream(#expr); } } - HfPlusSource::ExternalNetwork() => { + HydroSource::ExternalNetwork() => { unreachable!() } - HfPlusSource::Iter(expr) => { + HydroSource::Iter(expr) => { parse_quote! { #source_ident = source_iter(#expr); } } - HfPlusSource::Spin() => { + HydroSource::Spin() => { parse_quote! { #source_ident = spin(); } @@ -637,7 +637,7 @@ impl<'a> HfPlusNode { } } - HfPlusNode::CycleSource { + HydroNode::CycleSource { ident, location_kind, } => { @@ -651,8 +651,8 @@ impl<'a> HfPlusNode { (ident.clone(), *location_id) } - HfPlusNode::Tee { inner } => { - if let Some(ret) = built_tees.get(&(inner.0.as_ref() as *const RefCell)) + HydroNode::Tee { inner } => { + if let Some(ret) = built_tees.get(&(inner.0.as_ref() as *const RefCell)) { ret.clone() } else { @@ -674,7 +674,7 @@ impl<'a> HfPlusNode { }); built_tees.insert( - inner.0.as_ref() as *const RefCell, + inner.0.as_ref() as *const RefCell, (tee_ident.clone(), inner_location_id), ); @@ -682,7 +682,7 @@ impl<'a> HfPlusNode { } } - HfPlusNode::Chain(left, right) => { + HydroNode::Chain(left, right) => { let (left_ident, left_location_id) = left.emit(graph_builders, built_tees, next_stmt_id); let (right_ident, right_location_id) = @@ -715,7 +715,7 @@ impl<'a> HfPlusNode { (chain_ident, left_location_id) } - HfPlusNode::CrossSingleton(left, right) => { + HydroNode::CrossSingleton(left, right) => { let (left_ident, left_location_id) = left.emit(graph_builders, built_tees, next_stmt_id); let (right_ident, right_location_id) = @@ -748,27 +748,27 @@ impl<'a> HfPlusNode { (cross_ident, left_location_id) } - HfPlusNode::CrossProduct(..) | HfPlusNode::Join(..) => { - let operator: syn::Ident = if matches!(self, HfPlusNode::CrossProduct(..)) { + HydroNode::CrossProduct(..) | HydroNode::Join(..) => { + let operator: syn::Ident = if matches!(self, HydroNode::CrossProduct(..)) { parse_quote!(cross_join_multiset) } else { parse_quote!(join_multiset) }; - let (HfPlusNode::CrossProduct(left, right) | HfPlusNode::Join(left, right)) = self + let (HydroNode::CrossProduct(left, right) | HydroNode::Join(left, right)) = self else { unreachable!() }; - let (left_inner, left_was_persist) = - if let HfPlusNode::Persist(left) = left.as_ref() { - (left, true) - } else { - (left, false) - }; + let (left_inner, left_was_persist) = if let HydroNode::Persist(left) = left.as_ref() + { + (left, true) + } else { + (left, false) + }; let (right_inner, right_was_persist) = - if let HfPlusNode::Persist(right) = right.as_ref() { + if let HydroNode::Persist(right) = right.as_ref() { (right, true) } else { (right, false) @@ -826,21 +826,19 @@ impl<'a> HfPlusNode { (stream_ident, left_location_id) } - HfPlusNode::Difference(..) | HfPlusNode::AntiJoin(..) => { - let operator: syn::Ident = if matches!(self, HfPlusNode::Difference(..)) { + HydroNode::Difference(..) | HydroNode::AntiJoin(..) => { + let operator: syn::Ident = if matches!(self, HydroNode::Difference(..)) { parse_quote!(difference_multiset) } else { parse_quote!(anti_join_multiset) }; - let (HfPlusNode::Difference(left, right) | HfPlusNode::AntiJoin(left, right)) = - self + let (HydroNode::Difference(left, right) | HydroNode::AntiJoin(left, right)) = self else { unreachable!() }; - let (right, right_was_persist) = if let HfPlusNode::Persist(right) = right.as_ref() - { + let (right, right_was_persist) = if let HydroNode::Persist(right) = right.as_ref() { (right, true) } else { (right, false) @@ -885,7 +883,7 @@ impl<'a> HfPlusNode { (stream_ident, left_location_id) } - HfPlusNode::Map { f, input } => { + HydroNode::Map { f, input } => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -902,7 +900,7 @@ impl<'a> HfPlusNode { (map_ident, input_location_id) } - HfPlusNode::FlatMap { f, input } => { + HydroNode::FlatMap { f, input } => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -920,7 +918,7 @@ impl<'a> HfPlusNode { (flat_map_ident, input_location_id) } - HfPlusNode::Filter { f, input } => { + HydroNode::Filter { f, input } => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -938,7 +936,7 @@ impl<'a> HfPlusNode { (filter_ident, input_location_id) } - HfPlusNode::FilterMap { f, input } => { + HydroNode::FilterMap { f, input } => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -956,7 +954,7 @@ impl<'a> HfPlusNode { (filter_map_ident, input_location_id) } - HfPlusNode::Sort(input) => { + HydroNode::Sort(input) => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -973,7 +971,7 @@ impl<'a> HfPlusNode { (sort_ident, input_location_id) } - HfPlusNode::DeferTick(input) => { + HydroNode::DeferTick(input) => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -991,7 +989,7 @@ impl<'a> HfPlusNode { (defer_tick_ident, input_location_id) } - HfPlusNode::Enumerate { is_static, input } => { + HydroNode::Enumerate { is_static, input } => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -1016,7 +1014,7 @@ impl<'a> HfPlusNode { (enumerate_ident, input_location_id) } - HfPlusNode::Inspect { f, input } => { + HydroNode::Inspect { f, input } => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -1034,7 +1032,7 @@ impl<'a> HfPlusNode { (inspect_ident, input_location_id) } - HfPlusNode::Unique(input) => { + HydroNode::Unique(input) => { let (input_ident, input_location_id) = input.emit(graph_builders, built_tees, next_stmt_id); @@ -1052,21 +1050,20 @@ impl<'a> HfPlusNode { (unique_ident, input_location_id) } - HfPlusNode::Fold { .. } | HfPlusNode::FoldKeyed { .. } => { - let operator: syn::Ident = if matches!(self, HfPlusNode::Fold { .. }) { + HydroNode::Fold { .. } | HydroNode::FoldKeyed { .. } => { + let operator: syn::Ident = if matches!(self, HydroNode::Fold { .. }) { parse_quote!(fold) } else { parse_quote!(fold_keyed) }; - let (HfPlusNode::Fold { init, acc, input } - | HfPlusNode::FoldKeyed { init, acc, input }) = self + let (HydroNode::Fold { init, acc, input } + | HydroNode::FoldKeyed { init, acc, input }) = self else { unreachable!() }; - let (input, input_was_persist) = if let HfPlusNode::Persist(input) = input.as_ref() - { + let (input, input_was_persist) = if let HydroNode::Persist(input) = input.as_ref() { (input, true) } else { (input, false) @@ -1095,20 +1092,19 @@ impl<'a> HfPlusNode { (fold_ident, input_location_id) } - HfPlusNode::Reduce { .. } | HfPlusNode::ReduceKeyed { .. } => { - let operator: syn::Ident = if matches!(self, HfPlusNode::Reduce { .. }) { + HydroNode::Reduce { .. } | HydroNode::ReduceKeyed { .. } => { + let operator: syn::Ident = if matches!(self, HydroNode::Reduce { .. }) { parse_quote!(reduce) } else { parse_quote!(reduce_keyed) }; - let (HfPlusNode::Reduce { f, input } | HfPlusNode::ReduceKeyed { f, input }) = self + let (HydroNode::Reduce { f, input } | HydroNode::ReduceKeyed { f, input }) = self else { unreachable!() }; - let (input, input_was_persist) = if let HfPlusNode::Persist(input) = input.as_ref() - { + let (input, input_was_persist) = if let HydroNode::Persist(input) = input.as_ref() { (input, true) } else { (input, false) @@ -1137,7 +1133,7 @@ impl<'a> HfPlusNode { (reduce_ident, input_location_id) } - HfPlusNode::Network { + HydroNode::Network { from_location: _, from_key: _, to_location, diff --git a/hydroflow_plus/src/lib.rs b/hydro_lang/src/lib.rs similarity index 100% rename from hydroflow_plus/src/lib.rs rename to hydro_lang/src/lib.rs diff --git a/hydroflow_plus/src/location/can_send.rs b/hydro_lang/src/location/can_send.rs similarity index 100% rename from hydroflow_plus/src/location/can_send.rs rename to hydro_lang/src/location/can_send.rs diff --git a/hydroflow_plus/src/location/cluster/cluster_id.rs b/hydro_lang/src/location/cluster/cluster_id.rs similarity index 100% rename from hydroflow_plus/src/location/cluster/cluster_id.rs rename to hydro_lang/src/location/cluster/cluster_id.rs diff --git a/hydroflow_plus/src/location/cluster/mod.rs b/hydro_lang/src/location/cluster/mod.rs similarity index 96% rename from hydroflow_plus/src/location/cluster/mod.rs rename to hydro_lang/src/location/cluster/mod.rs index 6d2b71cc3622..884633bedc85 100644 --- a/hydroflow_plus/src/location/cluster/mod.rs +++ b/hydro_lang/src/location/cluster/mod.rs @@ -86,7 +86,7 @@ impl<'a, C: 'a, Ctx> FreeVariableWithContext for ClusterIds<'a, C> { Self: Sized, { let ident = syn::Ident::new( - &format!("__hydroflow_plus_cluster_ids_{}", self.id), + &format!("__hydro_lang_cluster_ids_{}", self.id), Span::call_site(), ); let root = get_this_crate(); @@ -128,7 +128,7 @@ where }; let ident = syn::Ident::new( - &format!("__hydroflow_plus_cluster_self_id_{}", cluster_id), + &format!("__hydro_lang_cluster_self_id_{}", cluster_id), Span::call_site(), ); let root = get_this_crate(); diff --git a/hydroflow_plus/src/location/external_process.rs b/hydro_lang/src/location/external_process.rs similarity index 91% rename from hydroflow_plus/src/location/external_process.rs rename to hydro_lang/src/location/external_process.rs index 26a559001d39..4cc5db7b5bab 100644 --- a/hydroflow_plus/src/location/external_process.rs +++ b/hydro_lang/src/location/external_process.rs @@ -6,7 +6,7 @@ use serde::Serialize; use super::{Location, LocationId, NoTick}; use crate::builder::FlowState; -use crate::ir::{HfPlusNode, HfPlusSource}; +use crate::ir::{HydroNode, HydroSource}; use crate::staging_util::Invariant; use crate::{Stream, Unbounded}; @@ -110,7 +110,7 @@ impl<'a, P> ExternalProcess<'a, P> { }, Stream::new( to.clone(), - HfPlusNode::Persist(Box::new(HfPlusNode::Network { + HydroNode::Persist(Box::new(HydroNode::Network { from_location: LocationId::ExternalProcess(self.id), from_key: Some(next_external_port_id), to_location: to.id(), @@ -118,8 +118,8 @@ impl<'a, P> ExternalProcess<'a, P> { serialize_fn: None, instantiate_fn: crate::ir::DebugInstantiate::Building(), deserialize_fn: Some(deser_expr.into()), - input: Box::new(HfPlusNode::Source { - source: HfPlusSource::ExternalNetwork(), + input: Box::new(HydroNode::Source { + source: HydroSource::ExternalNetwork(), location_kind: LocationId::ExternalProcess(self.id), }), })), @@ -146,7 +146,7 @@ impl<'a, P> ExternalProcess<'a, P> { }, Stream::new( to.clone(), - HfPlusNode::Persist(Box::new(HfPlusNode::Network { + HydroNode::Persist(Box::new(HydroNode::Network { from_location: LocationId::ExternalProcess(self.id), from_key: Some(next_external_port_id), to_location: to.id(), @@ -154,8 +154,8 @@ impl<'a, P> ExternalProcess<'a, P> { serialize_fn: None, instantiate_fn: crate::ir::DebugInstantiate::Building(), deserialize_fn: Some(crate::stream::deserialize_bincode::(None).into()), - input: Box::new(HfPlusNode::Source { - source: HfPlusSource::ExternalNetwork(), + input: Box::new(HydroNode::Source { + source: HydroSource::ExternalNetwork(), location_kind: LocationId::ExternalProcess(self.id), }), })), diff --git a/hydroflow_plus/src/location/mod.rs b/hydro_lang/src/location/mod.rs similarity index 91% rename from hydroflow_plus/src/location/mod.rs rename to hydro_lang/src/location/mod.rs index 2cdf637ebcd9..7745b20fca2f 100644 --- a/hydroflow_plus/src/location/mod.rs +++ b/hydro_lang/src/location/mod.rs @@ -9,7 +9,7 @@ use stageleft::{q, QuotedWithContext}; use super::builder::FlowState; use crate::cycle::{CycleCollection, ForwardRef, ForwardRefMarker}; -use crate::ir::{HfPlusNode, HfPlusSource}; +use crate::ir::{HydroNode, HydroSource}; use crate::{Singleton, Stream, Unbounded}; pub mod external_process; @@ -88,8 +88,8 @@ pub trait Location<'a>: Clone { { Stream::new( self.clone(), - HfPlusNode::Persist(Box::new(HfPlusNode::Source { - source: HfPlusSource::Spin(), + HydroNode::Persist(Box::new(HydroNode::Source { + source: HydroSource::Spin(), location_kind: self.id(), })), ) @@ -106,8 +106,8 @@ pub trait Location<'a>: Clone { Stream::new( self.clone(), - HfPlusNode::Persist(Box::new(HfPlusNode::Source { - source: HfPlusSource::Stream(e.into()), + HydroNode::Persist(Box::new(HydroNode::Source { + source: HydroSource::Stream(e.into()), location_kind: self.id(), })), ) @@ -126,8 +126,8 @@ pub trait Location<'a>: Clone { Stream::new( self.clone(), - HfPlusNode::Persist(Box::new(HfPlusNode::Source { - source: HfPlusSource::Iter(e.into()), + HydroNode::Persist(Box::new(HydroNode::Source { + source: HydroSource::Iter(e.into()), location_kind: self.id(), })), ) @@ -151,12 +151,10 @@ pub trait Location<'a>: Clone { // so that it grows every tick Singleton::new( self.clone(), - HfPlusNode::Persist(Box::new(HfPlusNode::Persist(Box::new( - HfPlusNode::Source { - source: HfPlusSource::Iter(e.into()), - location_kind: self.id(), - }, - )))), + HydroNode::Persist(Box::new(HydroNode::Persist(Box::new(HydroNode::Source { + source: HydroSource::Iter(e.into()), + location_kind: self.id(), + })))), ) } diff --git a/hydroflow_plus/src/location/process.rs b/hydro_lang/src/location/process.rs similarity index 100% rename from hydroflow_plus/src/location/process.rs rename to hydro_lang/src/location/process.rs diff --git a/hydroflow_plus/src/location/tick.rs b/hydro_lang/src/location/tick.rs similarity index 98% rename from hydroflow_plus/src/location/tick.rs rename to hydro_lang/src/location/tick.rs index 7d23bec7fe08..f161fc170b42 100644 --- a/hydroflow_plus/src/location/tick.rs +++ b/hydro_lang/src/location/tick.rs @@ -10,7 +10,7 @@ use crate::cycle::{ CycleCollection, CycleCollectionWithInitial, DeferTick, ForwardRef, ForwardRefMarker, TickCycle, TickCycleMarker, }; -use crate::ir::{HfPlusNode, HfPlusSource}; +use crate::ir::{HydroNode, HydroSource}; use crate::{Bounded, Optional, Singleton, Stream}; #[sealed] @@ -135,8 +135,8 @@ impl<'a, L: Location<'a>> Tick { Optional::new( self.clone(), - HfPlusNode::Source { - source: HfPlusSource::Iter(e.into()), + HydroNode::Source { + source: HydroSource::Iter(e.into()), location_kind: self.l.id(), }, ) diff --git a/hydroflow_plus/src/optional.rs b/hydro_lang/src/optional.rs similarity index 85% rename from hydroflow_plus/src/optional.rs rename to hydro_lang/src/optional.rs index 6d422d14d5bd..f686c3927b7b 100644 --- a/hydroflow_plus/src/optional.rs +++ b/hydro_lang/src/optional.rs @@ -8,7 +8,7 @@ use syn::parse_quote; use crate::builder::FLOW_USED_MESSAGE; use crate::cycle::{CycleCollection, CycleComplete, DeferTick, ForwardRefMarker, TickCycleMarker}; -use crate::ir::{HfPlusLeaf, HfPlusNode, HfPlusSource, TeeNode}; +use crate::ir::{HydroLeaf, HydroNode, HydroSource, TeeNode}; use crate::location::tick::{NoTimestamp, Timestamped}; use crate::location::{check_matching_location, LocationId, NoTick}; use crate::singleton::ZipResult; @@ -17,13 +17,13 @@ use crate::{Bounded, Location, Singleton, Stream, Tick, Unbounded}; pub struct Optional { pub(crate) location: L, - pub(crate) ir_node: RefCell, + pub(crate) ir_node: RefCell, _phantom: PhantomData<(T, L, B)>, } impl<'a, T, L: Location<'a>, B> Optional { - pub(crate) fn new(location: L, ir_node: HfPlusNode) -> Self { + pub(crate) fn new(location: L, ir_node: HydroNode) -> Self { Optional { location, ir_node: RefCell::new(ir_node), @@ -55,7 +55,7 @@ impl<'a, T, L: Location<'a>> CycleCollection<'a, TickCycleMarker> let location_id = location.id(); Optional::new( location, - HfPlusNode::CycleSource { + HydroNode::CycleSource { ident, location_kind: location_id, }, @@ -76,7 +76,7 @@ impl<'a, T, L: Location<'a>> CycleComplete<'a, TickCycleMarker> for Optional> CycleCollection<'a, ForwardRefMarker> let location_id = location.id(); Optional::new( location, - HfPlusNode::CycleSource { + HydroNode::CycleSource { ident, location_kind: location_id, }, @@ -114,7 +114,7 @@ impl<'a, T, L: Location<'a>> CycleComplete<'a, ForwardRefMarker> for Optional + NoTick, B> CycleCollection<'a, ForwardRefMarker> let location_id = location.id(); Optional::new( location, - HfPlusNode::Persist(Box::new(HfPlusNode::CycleSource { + HydroNode::Persist(Box::new(HydroNode::CycleSource { ident, location_kind: location_id, })), @@ -152,10 +152,10 @@ impl<'a, T, L: Location<'a> + NoTick, B> CycleComplete<'a, ForwardRefMarker> for .leaves .as_mut() .expect(FLOW_USED_MESSAGE) - .push(HfPlusLeaf::CycleSink { + .push(HydroLeaf::CycleSink { ident, location_kind: self.location_kind(), - input: Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), + input: Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), }); } } @@ -174,17 +174,17 @@ impl<'a, T, L: Location<'a>, B> From> for Optional { impl<'a, T: Clone, L: Location<'a>, B> Clone for Optional { fn clone(&self) -> Self { - if !matches!(self.ir_node.borrow().deref(), HfPlusNode::Tee { .. }) { - let orig_ir_node = self.ir_node.replace(HfPlusNode::Placeholder); - *self.ir_node.borrow_mut() = HfPlusNode::Tee { + if !matches!(self.ir_node.borrow().deref(), HydroNode::Tee { .. }) { + let orig_ir_node = self.ir_node.replace(HydroNode::Placeholder); + *self.ir_node.borrow_mut() = HydroNode::Tee { inner: TeeNode(Rc::new(RefCell::new(orig_ir_node))), }; } - if let HfPlusNode::Tee { inner } = self.ir_node.borrow().deref() { + if let HydroNode::Tee { inner } = self.ir_node.borrow().deref() { Optional { location: self.location.clone(), - ir_node: HfPlusNode::Tee { + ir_node: HydroNode::Tee { inner: TeeNode(inner.0.clone()), } .into(), @@ -201,7 +201,7 @@ impl<'a, T, L: Location<'a>, B> Optional { let f = f.splice_fn1_ctx(&self.location).into(); Optional::new( self.location, - HfPlusNode::Map { + HydroNode::Map { f, input: Box::new(self.ir_node.into_inner()), }, @@ -215,7 +215,7 @@ impl<'a, T, L: Location<'a>, B> Optional { let f = f.splice_fn1_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::FlatMap { + HydroNode::FlatMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -229,7 +229,7 @@ impl<'a, T, L: Location<'a>, B> Optional { let f = f.splice_fn1_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::FlatMap { + HydroNode::FlatMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -257,7 +257,7 @@ impl<'a, T, L: Location<'a>, B> Optional { let f = f.splice_fn1_borrow_ctx(&self.location).into(); Optional::new( self.location, - HfPlusNode::Filter { + HydroNode::Filter { f, input: Box::new(self.ir_node.into_inner()), }, @@ -271,7 +271,7 @@ impl<'a, T, L: Location<'a>, B> Optional { let f = f.splice_fn1_ctx(&self.location).into(); Optional::new( self.location, - HfPlusNode::FilterMap { + HydroNode::FilterMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -284,15 +284,15 @@ impl<'a, T, L: Location<'a>, B> Optional { if L::is_top_level() { Optional::new( self.location, - HfPlusNode::Persist(Box::new(HfPlusNode::Chain( - Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), - Box::new(HfPlusNode::Unpersist(Box::new(other.ir_node.into_inner()))), + HydroNode::Persist(Box::new(HydroNode::Chain( + Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), + Box::new(HydroNode::Unpersist(Box::new(other.ir_node.into_inner()))), ))), ) } else { Optional::new( self.location, - HfPlusNode::Chain( + HydroNode::Chain( Box::new(self.ir_node.into_inner()), Box::new(other.ir_node.into_inner()), ), @@ -310,15 +310,15 @@ impl<'a, T, L: Location<'a>, B> Optional { if L::is_top_level() { Optional::new( self.location, - HfPlusNode::Persist(Box::new(HfPlusNode::CrossSingleton( - Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), - Box::new(HfPlusNode::Unpersist(Box::new(other.ir_node.into_inner()))), + HydroNode::Persist(Box::new(HydroNode::CrossSingleton( + Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), + Box::new(HydroNode::Unpersist(Box::new(other.ir_node.into_inner()))), ))), ) } else { Optional::new( self.location, - HfPlusNode::CrossSingleton( + HydroNode::CrossSingleton( Box::new(self.ir_node.into_inner()), Box::new(other.ir_node.into_inner()), ), @@ -332,15 +332,15 @@ impl<'a, T, L: Location<'a>, B> Optional { if L::is_top_level() { Singleton::new( self.location, - HfPlusNode::Persist(Box::new(HfPlusNode::Chain( - Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), - Box::new(HfPlusNode::Unpersist(Box::new(other.ir_node.into_inner()))), + HydroNode::Persist(Box::new(HydroNode::Chain( + Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), + Box::new(HydroNode::Unpersist(Box::new(other.ir_node.into_inner()))), ))), ) } else { Singleton::new( self.location, - HfPlusNode::Chain( + HydroNode::Chain( Box::new(self.ir_node.into_inner()), Box::new(other.ir_node.into_inner()), ), @@ -353,16 +353,13 @@ impl<'a, T, L: Location<'a>, B> Optional { T: Clone, { let none: syn::Expr = parse_quote!([::std::option::Option::None]); - let core_ir = HfPlusNode::Persist(Box::new(HfPlusNode::Source { - source: HfPlusSource::Iter(none.into()), + let core_ir = HydroNode::Persist(Box::new(HydroNode::Source { + source: HydroSource::Iter(none.into()), location_kind: self.location.id().root().clone(), })); let none_singleton = if L::is_top_level() { - Singleton::new( - self.location.clone(), - HfPlusNode::Persist(Box::new(core_ir)), - ) + Singleton::new(self.location.clone(), HydroNode::Persist(Box::new(core_ir))) } else { Singleton::new(self.location.clone(), core_ir) }; @@ -413,7 +410,7 @@ impl<'a, T, L: Location<'a> + NoTick, B> Optional, B> { pub unsafe fn latest_tick(self) -> Optional, Bounded> { Optional::new( self.location.tick, - HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner())), + HydroNode::Unpersist(Box::new(self.ir_node.into_inner())), ) } @@ -488,7 +485,7 @@ impl<'a, T, L: Location<'a>> Optional, Bounded> { Timestamped { tick: self.location, }, - HfPlusNode::Persist(Box::new(self.ir_node.into_inner())), + HydroNode::Persist(Box::new(self.ir_node.into_inner())), ) } @@ -497,28 +494,28 @@ impl<'a, T, L: Location<'a>> Optional, Bounded> { Timestamped { tick: self.location, }, - HfPlusNode::Persist(Box::new(self.ir_node.into_inner())), + HydroNode::Persist(Box::new(self.ir_node.into_inner())), ) } pub fn defer_tick(self) -> Optional, Bounded> { Optional::new( self.location, - HfPlusNode::DeferTick(Box::new(self.ir_node.into_inner())), + HydroNode::DeferTick(Box::new(self.ir_node.into_inner())), ) } pub fn persist(self) -> Stream, Bounded> { Stream::new( self.location, - HfPlusNode::Persist(Box::new(self.ir_node.into_inner())), + HydroNode::Persist(Box::new(self.ir_node.into_inner())), ) } pub fn delta(self) -> Optional, Bounded> { Optional::new( self.location, - HfPlusNode::Delta(Box::new(self.ir_node.into_inner())), + HydroNode::Delta(Box::new(self.ir_node.into_inner())), ) } } diff --git a/hydroflow_plus/src/rewrites/mod.rs b/hydro_lang/src/rewrites/mod.rs similarity index 100% rename from hydroflow_plus/src/rewrites/mod.rs rename to hydro_lang/src/rewrites/mod.rs diff --git a/hydroflow_plus/src/rewrites/persist_pullup.rs b/hydro_lang/src/rewrites/persist_pullup.rs similarity index 59% rename from hydroflow_plus/src/rewrites/persist_pullup.rs rename to hydro_lang/src/rewrites/persist_pullup.rs index d15784ed4585..49a0e9c44183 100644 --- a/hydroflow_plus/src/rewrites/persist_pullup.rs +++ b/hydro_lang/src/rewrites/persist_pullup.rs @@ -4,71 +4,71 @@ use std::collections::HashSet; use crate::ir::*; fn persist_pullup_node( - node: &mut HfPlusNode, - persist_pulled_tees: &mut HashSet<*const RefCell>, + node: &mut HydroNode, + persist_pulled_tees: &mut HashSet<*const RefCell>, ) { *node = match_box::match_box! { - match std::mem::replace(node, HfPlusNode::Placeholder) { - HfPlusNode::Unpersist(mb!(* HfPlusNode::Persist(mb!(* behind_persist)))) => behind_persist, + match std::mem::replace(node, HydroNode::Placeholder) { + HydroNode::Unpersist(mb!(* HydroNode::Persist(mb!(* behind_persist)))) => behind_persist, - HfPlusNode::Delta(mb!(* HfPlusNode::Persist(mb!(* behind_persist)))) => behind_persist, + HydroNode::Delta(mb!(* HydroNode::Persist(mb!(* behind_persist)))) => behind_persist, - HfPlusNode::Tee { inner } => { - if persist_pulled_tees.contains(&(inner.0.as_ref() as *const RefCell)) { - HfPlusNode::Persist(Box::new(HfPlusNode::Tee { + HydroNode::Tee { inner } => { + if persist_pulled_tees.contains(&(inner.0.as_ref() as *const RefCell)) { + HydroNode::Persist(Box::new(HydroNode::Tee { inner: TeeNode(inner.0.clone()), })) - } else if matches!(*inner.0.borrow(), HfPlusNode::Persist(_)) { - persist_pulled_tees.insert(inner.0.as_ref() as *const RefCell); - if let HfPlusNode::Persist(behind_persist) = - inner.0.replace(HfPlusNode::Placeholder) + } else if matches!(*inner.0.borrow(), HydroNode::Persist(_)) { + persist_pulled_tees.insert(inner.0.as_ref() as *const RefCell); + if let HydroNode::Persist(behind_persist) = + inner.0.replace(HydroNode::Placeholder) { *inner.0.borrow_mut() = *behind_persist; } else { unreachable!() } - HfPlusNode::Persist(Box::new(HfPlusNode::Tee { + HydroNode::Persist(Box::new(HydroNode::Tee { inner: TeeNode(inner.0.clone()), })) } else { - HfPlusNode::Tee { inner } + HydroNode::Tee { inner } } } - HfPlusNode::Map { + HydroNode::Map { f, - input: mb!(* HfPlusNode::Persist(behind_persist)), - } => HfPlusNode::Persist(Box::new(HfPlusNode::Map { + input: mb!(* HydroNode::Persist(behind_persist)), + } => HydroNode::Persist(Box::new(HydroNode::Map { f, input: behind_persist, })), - HfPlusNode::FilterMap { + HydroNode::FilterMap { f, - input: mb!(* HfPlusNode::Persist(behind_persist)), - } => HfPlusNode::Persist(Box::new(HfPlusNode::FilterMap { + input: mb!(* HydroNode::Persist(behind_persist)), + } => HydroNode::Persist(Box::new(HydroNode::FilterMap { f, input: behind_persist, })), - HfPlusNode::FlatMap { + HydroNode::FlatMap { f, - input: mb!(* HfPlusNode::Persist(behind_persist)), - } => HfPlusNode::Persist(Box::new(HfPlusNode::FlatMap { + input: mb!(* HydroNode::Persist(behind_persist)), + } => HydroNode::Persist(Box::new(HydroNode::FlatMap { f, input: behind_persist, })), - HfPlusNode::Filter { + HydroNode::Filter { f, - input: mb!(* HfPlusNode::Persist(behind_persist)), - } => HfPlusNode::Persist(Box::new(HfPlusNode::Filter { + input: mb!(* HydroNode::Persist(behind_persist)), + } => HydroNode::Persist(Box::new(HydroNode::Filter { f, input: behind_persist, })), - HfPlusNode::Network { + HydroNode::Network { from_location, from_key, to_location, @@ -76,9 +76,9 @@ fn persist_pullup_node( serialize_fn, instantiate_fn, deserialize_fn, - input: mb!(* HfPlusNode::Persist(behind_persist)), + input: mb!(* HydroNode::Persist(behind_persist)), .. - } => HfPlusNode::Persist(Box::new(HfPlusNode::Network { + } => HydroNode::Persist(Box::new(HydroNode::Network { from_location, from_key, to_location, @@ -89,29 +89,29 @@ fn persist_pullup_node( input: behind_persist, })), - HfPlusNode::Chain(mb!(* HfPlusNode::Persist(left)), mb!(* HfPlusNode::Persist(right))) => { - HfPlusNode::Persist(Box::new(HfPlusNode::Chain(left, right))) + HydroNode::Chain(mb!(* HydroNode::Persist(left)), mb!(* HydroNode::Persist(right))) => { + HydroNode::Persist(Box::new(HydroNode::Chain(left, right))) } - HfPlusNode::CrossProduct(mb!(* HfPlusNode::Persist(left)), mb!(* HfPlusNode::Persist(right))) => { - HfPlusNode::Persist(Box::new(HfPlusNode::Delta(Box::new( - HfPlusNode::CrossProduct( - Box::new(HfPlusNode::Persist(left)), - Box::new(HfPlusNode::Persist(right)), + HydroNode::CrossProduct(mb!(* HydroNode::Persist(left)), mb!(* HydroNode::Persist(right))) => { + HydroNode::Persist(Box::new(HydroNode::Delta(Box::new( + HydroNode::CrossProduct( + Box::new(HydroNode::Persist(left)), + Box::new(HydroNode::Persist(right)), ), )))) } - HfPlusNode::Join(mb!(* HfPlusNode::Persist(left)), mb!(* HfPlusNode::Persist(right))) => { - HfPlusNode::Persist(Box::new(HfPlusNode::Delta(Box::new(HfPlusNode::Join( - Box::new(HfPlusNode::Persist(left)), - Box::new(HfPlusNode::Persist(right)), + HydroNode::Join(mb!(* HydroNode::Persist(left)), mb!(* HydroNode::Persist(right))) => { + HydroNode::Persist(Box::new(HydroNode::Delta(Box::new(HydroNode::Join( + Box::new(HydroNode::Persist(left)), + Box::new(HydroNode::Persist(right)), ))))) } - HfPlusNode::Unique(mb!(* HfPlusNode::Persist(inner))) => { - HfPlusNode::Persist(Box::new(HfPlusNode::Delta(Box::new(HfPlusNode::Unique( - Box::new(HfPlusNode::Persist(inner)), + HydroNode::Unique(mb!(* HydroNode::Persist(inner))) => { + HydroNode::Persist(Box::new(HydroNode::Delta(Box::new(HydroNode::Unique( + Box::new(HydroNode::Persist(inner)), ))))) } @@ -120,7 +120,7 @@ fn persist_pullup_node( }; } -pub fn persist_pullup(ir: Vec) -> Vec { +pub fn persist_pullup(ir: Vec) -> Vec { let mut seen_tees = Default::default(); let mut persist_pulled_tees = Default::default(); ir.into_iter() diff --git a/hydroflow_plus/src/rewrites/profiler.rs b/hydro_lang/src/rewrites/profiler.rs similarity index 94% rename from hydroflow_plus/src/rewrites/profiler.rs rename to hydro_lang/src/rewrites/profiler.rs index 379952a54dac..e25b815b4a59 100644 --- a/hydroflow_plus/src/rewrites/profiler.rs +++ b/hydro_lang/src/rewrites/profiler.rs @@ -16,7 +16,7 @@ fn quoted_any_fn<'a, F: Fn(&usize) + 'a, Q: IntoQuotedMut<'a, F, ()>>(q: Q) -> Q /// Add a profiling node before each node to count the cardinality of its input fn add_profiling_node<'a>( - node: &mut HfPlusNode, + node: &mut HydroNode, counters: RuntimeData<&'a RefCell>>, counter_queue: RuntimeData<&'a RefCell>>, id: &mut u32, @@ -29,8 +29,8 @@ fn add_profiling_node<'a>( |node, seen_tees| add_profiling_node(node, counters, counter_queue, id, seen_tees), seen_tees, ); - let orig_node = std::mem::replace(node, HfPlusNode::Placeholder); - *node = HfPlusNode::Inspect { + let orig_node = std::mem::replace(node, HydroNode::Placeholder); + *node = HydroNode::Inspect { f: quoted_any_fn(q!({ // Put counters on queue counter_queue @@ -50,10 +50,10 @@ fn add_profiling_node<'a>( /// Count the cardinality of each input and periodically output to a file pub fn profiling<'a>( - ir: Vec, + ir: Vec, counters: RuntimeData<&'a RefCell>>, counter_queue: RuntimeData<&'a RefCell>>, -) -> Vec { +) -> Vec { let mut id = 0; let mut seen_tees = Default::default(); ir.into_iter() diff --git a/hydroflow_plus/src/rewrites/properties.rs b/hydro_lang/src/rewrites/properties.rs similarity index 91% rename from hydroflow_plus/src/rewrites/properties.rs rename to hydro_lang/src/rewrites/properties.rs index 2f0323ab7792..54c9334b3c73 100644 --- a/hydroflow_plus/src/rewrites/properties.rs +++ b/hydro_lang/src/rewrites/properties.rs @@ -2,7 +2,7 @@ use std::collections::HashSet; use stageleft::*; -use crate::ir::{HfPlusLeaf, HfPlusNode, SeenTees}; +use crate::ir::{HydroLeaf, HydroNode, SeenTees}; /// Structure for tracking expressions known to have particular algebraic properties. /// @@ -59,24 +59,20 @@ impl PropertyDatabase { // Dataflow graph optimization rewrite rules based on algebraic property tags // TODO add a test that verifies the space of possible graphs after rewrites is correct for each property -fn properties_optimize_node( - node: &mut HfPlusNode, - db: &PropertyDatabase, - seen_tees: &mut SeenTees, -) { +fn properties_optimize_node(node: &mut HydroNode, db: &PropertyDatabase, seen_tees: &mut SeenTees) { node.transform_children( |node, seen_tees| properties_optimize_node(node, db, seen_tees), seen_tees, ); match node { - HfPlusNode::ReduceKeyed { f, .. } if db.is_tagged_commutative(&f.0) => { + HydroNode::ReduceKeyed { f, .. } if db.is_tagged_commutative(&f.0) => { dbg!("IDENTIFIED COMMUTATIVE OPTIMIZATION for {:?}", &f); } _ => {} } } -pub fn properties_optimize(ir: Vec, db: &PropertyDatabase) -> Vec { +pub fn properties_optimize(ir: Vec, db: &PropertyDatabase) -> Vec { let mut seen_tees = Default::default(); ir.into_iter() .map(|l| { diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee-2.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee-2.snap new file mode 100644 index 000000000000..dcb22d2ce6cc --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee-2.snap @@ -0,0 +1,42 @@ +--- +source: hydro_lang/src/rewrites/persist_pullup.rs +expression: optimized.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) }), + input: Persist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 }), + input: Tee { + inner: : Source { + source: Iter( + { use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; 0 .. 10 }, + ), + location_kind: Process( + 0, + ), + }, + }, + }, + ), + }, + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) }), + input: Persist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 }), + input: Tee { + inner: : Source { + source: Iter( + { use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; 0 .. 10 }, + ), + location_kind: Process( + 0, + ), + }, + }, + }, + ), + }, +] diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee.snap new file mode 100644 index 000000000000..d960d065ddfa --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee.snap @@ -0,0 +1,58 @@ +--- +source: hydro_lang/src/rewrites/persist_pullup.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) }), + input: Unpersist( + Persist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 }), + input: Tee { + inner: : Persist( + Unpersist( + Persist( + Source { + source: Iter( + { use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; 0 .. 10 }, + ), + location_kind: Process( + 0, + ), + }, + ), + ), + ), + }, + }, + ), + ), + }, + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) }), + input: Unpersist( + Persist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 }), + input: Tee { + inner: : Persist( + Unpersist( + Persist( + Source { + source: Iter( + { use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; 0 .. 10 }, + ), + location_kind: Process( + 0, + ), + }, + ), + ), + ), + }, + }, + ), + ), + }, +] diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee@surface_graph_0.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee@surface_graph_0.snap new file mode 100644 index 000000000000..adc06b72ad06 --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_behind_tee@surface_graph_0.snap @@ -0,0 +1,20 @@ +--- +source: hydro_lang/src/rewrites/persist_pullup.rs +expression: graph.surface_syntax_string() +--- +1v1 = source_iter ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; 0 .. 10 }); +2v1 = tee (); +3v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 })); +4v1 = persist :: < 'static > (); +5v1 = for_each (stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) })); +6v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 })); +7v1 = persist :: < 'static > (); +8v1 = for_each (stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) })); + +1v1 -> 2v1; +2v1 -> 3v1; +3v1 -> 4v1; +4v1 -> 5v1; +2v1 -> 6v1; +6v1 -> 7v1; +7v1 -> 8v1; diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map-2.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map-2.snap new file mode 100644 index 000000000000..667076ada4cf --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map-2.snap @@ -0,0 +1,20 @@ +--- +source: hydro_lang/src/rewrites/persist_pullup.rs +expression: optimized.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 }), + input: Source { + source: Iter( + { use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; 0 .. 10 }, + ), + location_kind: Process( + 0, + ), + }, + }, + }, +] diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map.snap new file mode 100644 index 000000000000..bd39e1a40766 --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map.snap @@ -0,0 +1,24 @@ +--- +source: hydro_lang/src/rewrites/persist_pullup.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) }), + input: Unpersist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 }), + input: Persist( + Source { + source: Iter( + { use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; 0 .. 10 }, + ), + location_kind: Process( + 0, + ), + }, + ), + }, + ), + }, +] diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map@surface_graph_0.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map@surface_graph_0.snap new file mode 100644 index 000000000000..24fa58731b59 --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__persist_pullup__tests__persist_pullup_through_map@surface_graph_0.snap @@ -0,0 +1,10 @@ +--- +source: hydro_lang/src/rewrites/persist_pullup.rs +expression: graph.surface_syntax_string() +--- +1v1 = source_iter ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; 0 .. 10 }); +2v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | v | v + 1 })); +3v1 = for_each (stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: persist_pullup :: tests :: * ; | n | println ! ("{}" , n) })); + +1v1 -> 2v1; +2v1 -> 3v1; diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__profiler__tests__profiler_wrapping_all_operators-2.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__profiler__tests__profiler_wrapping_all_operators-2.snap new file mode 100644 index 000000000000..0416e6a9a06c --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__profiler__tests__profiler_wrapping_all_operators-2.snap @@ -0,0 +1,26 @@ +--- +source: hydro_lang/src/rewrites/profiler.rs +expression: "&pushed_down.ir()" +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: profiler :: tests :: * ; | n | println ! ("{}" , n) }), + input: Inspect { + f: { use crate :: __staged :: rewrites :: profiler :: * ; let counter_queue__free = Fake ; let counters__free = Fake ; let my_id__free = 0u32 ; { counter_queue__free . borrow () . unbounded_send ((my_id__free as usize , counters__free . borrow () [my_id__free as usize])) . unwrap () ; counters__free . borrow_mut () [my_id__free as usize] = 0 ; move | _ | { myself :: increment_counter (& mut counters__free . borrow_mut () [my_id__free as usize]) ; } } }, + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: profiler :: tests :: * ; | v | v + 1 }), + input: Inspect { + f: { use crate :: __staged :: rewrites :: profiler :: * ; let counter_queue__free = Fake ; let counters__free = Fake ; let my_id__free = 1u32 ; { counter_queue__free . borrow () . unbounded_send ((my_id__free as usize , counters__free . borrow () [my_id__free as usize])) . unwrap () ; counters__free . borrow_mut () [my_id__free as usize] = 0 ; move | _ | { myself :: increment_counter (& mut counters__free . borrow_mut () [my_id__free as usize]) ; } } }, + input: Source { + source: Iter( + { use crate :: __staged :: rewrites :: profiler :: tests :: * ; 0 .. 10 }, + ), + location_kind: Process( + 0, + ), + }, + }, + }, + }, + }, +] diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__profiler__tests__profiler_wrapping_all_operators.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__profiler__tests__profiler_wrapping_all_operators.snap new file mode 100644 index 000000000000..6e0a06f8ade3 --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__profiler__tests__profiler_wrapping_all_operators.snap @@ -0,0 +1,24 @@ +--- +source: hydro_lang/src/rewrites/profiler.rs +expression: "&built.ir()" +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , () > ({ use crate :: __staged :: rewrites :: profiler :: tests :: * ; | n | println ! ("{}" , n) }), + input: Unpersist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , i32 > ({ use crate :: __staged :: rewrites :: profiler :: tests :: * ; | v | v + 1 }), + input: Persist( + Source { + source: Iter( + { use crate :: __staged :: rewrites :: profiler :: tests :: * ; 0 .. 10 }, + ), + location_kind: Process( + 0, + ), + }, + ), + }, + ), + }, +] diff --git a/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__properties__tests__property_optimized.snap b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__properties__tests__property_optimized.snap new file mode 100644 index 000000000000..4c74a724fe9b --- /dev/null +++ b/hydro_lang/src/rewrites/snapshots/hydro_lang__rewrites__properties__tests__property_optimized.snap @@ -0,0 +1,24 @@ +--- +source: hydro_lang/src/rewrites/properties.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < (std :: string :: String , i32) , () > ({ use crate :: __staged :: rewrites :: properties :: tests :: * ; | (string , count) | println ! ("{}: {}" , string , count) }), + input: FoldKeyed { + init: stageleft :: runtime_support :: fn0_type_hint :: < i32 > ({ use crate :: __staged :: rewrites :: properties :: tests :: * ; | | 0 }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < i32 , () , () > ({ use crate :: __staged :: rewrites :: properties :: tests :: * ; | count : & mut i32 , _ | * count += 1 }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < std :: string :: String , (std :: string :: String , ()) > ({ use crate :: __staged :: rewrites :: properties :: tests :: * ; | string : String | (string , ()) }), + input: Source { + source: Iter( + { use crate :: __staged :: rewrites :: properties :: tests :: * ; vec ! [] }, + ), + location_kind: Process( + 0, + ), + }, + }, + }, + }, +] diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee-2.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee-2.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee-2.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee-2.snap diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee.snap diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee@surface_graph_0.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee@surface_graph_0.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee@surface_graph_0.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_behind_tee@surface_graph_0.snap diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map-2.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map-2.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map-2.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map-2.snap diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map.snap diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map@surface_graph_0.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map@surface_graph_0.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map@surface_graph_0.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__persist_pullup__tests__persist_pullup_through_map@surface_graph_0.snap diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__profiler__tests__profiler_wrapping_all_operators-2.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__profiler__tests__profiler_wrapping_all_operators-2.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__profiler__tests__profiler_wrapping_all_operators-2.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__profiler__tests__profiler_wrapping_all_operators-2.snap diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__profiler__tests__profiler_wrapping_all_operators.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__profiler__tests__profiler_wrapping_all_operators.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__profiler__tests__profiler_wrapping_all_operators.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__profiler__tests__profiler_wrapping_all_operators.snap diff --git a/hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__properties__tests__property_optimized.snap b/hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__properties__tests__property_optimized.snap similarity index 100% rename from hydroflow_plus/src/rewrites/snapshots/hydroflow_plus__rewrites__properties__tests__property_optimized.snap rename to hydro_lang/src/rewrites/snapshots/hydroflow_plus__rewrites__properties__tests__property_optimized.snap diff --git a/hydroflow_plus/src/runtime_context.rs b/hydro_lang/src/runtime_context.rs similarity index 100% rename from hydroflow_plus/src/runtime_context.rs rename to hydro_lang/src/runtime_context.rs diff --git a/hydroflow_plus/src/singleton.rs b/hydro_lang/src/singleton.rs similarity index 85% rename from hydroflow_plus/src/singleton.rs rename to hydro_lang/src/singleton.rs index 819b3c06dfc7..5994670ce95a 100644 --- a/hydroflow_plus/src/singleton.rs +++ b/hydro_lang/src/singleton.rs @@ -10,20 +10,20 @@ use crate::cycle::{ CycleCollection, CycleCollectionWithInitial, CycleComplete, DeferTick, ForwardRefMarker, TickCycleMarker, }; -use crate::ir::{HfPlusLeaf, HfPlusNode, TeeNode}; +use crate::ir::{HydroLeaf, HydroNode, TeeNode}; use crate::location::tick::{NoTimestamp, Timestamped}; use crate::location::{check_matching_location, Location, LocationId, NoTick, Tick}; use crate::{Bounded, Optional, Stream, Unbounded}; pub struct Singleton { pub(crate) location: L, - pub(crate) ir_node: RefCell, + pub(crate) ir_node: RefCell, _phantom: PhantomData<(T, L, B)>, } impl<'a, T, L: Location<'a>, B> Singleton { - pub(crate) fn new(location: L, ir_node: HfPlusNode) -> Self { + pub(crate) fn new(location: L, ir_node: HydroNode) -> Self { Singleton { location, ir_node: RefCell::new(ir_node), @@ -57,8 +57,8 @@ impl<'a, T, L: Location<'a>> CycleCollectionWithInitial<'a, TickCycleMarker> let location_id = location.id(); Singleton::new( location, - HfPlusNode::Chain( - Box::new(HfPlusNode::CycleSource { + HydroNode::Chain( + Box::new(HydroNode::CycleSource { ident, location_kind: location_id, }), @@ -81,7 +81,7 @@ impl<'a, T, L: Location<'a>> CycleComplete<'a, TickCycleMarker> for Singleton> CycleCollection<'a, ForwardRefMarker> let location_id = location.id(); Singleton::new( location, - HfPlusNode::CycleSource { + HydroNode::CycleSource { ident, location_kind: location_id, }, @@ -121,7 +121,7 @@ impl<'a, T, L: Location<'a>> CycleComplete<'a, ForwardRefMarker> .leaves .as_mut() .expect(FLOW_USED_MESSAGE) - .push(HfPlusLeaf::CycleSink { + .push(HydroLeaf::CycleSink { ident, location_kind: self.location_kind(), input: Box::new(self.ir_node.into_inner()), @@ -138,7 +138,7 @@ impl<'a, T, L: Location<'a> + NoTick, B> CycleCollection<'a, ForwardRefMarker> let location_id = location.id(); Singleton::new( location, - HfPlusNode::Persist(Box::new(HfPlusNode::CycleSource { + HydroNode::Persist(Box::new(HydroNode::CycleSource { ident, location_kind: location_id, })), @@ -161,27 +161,27 @@ impl<'a, T, L: Location<'a> + NoTick, B> CycleComplete<'a, ForwardRefMarker> .leaves .as_mut() .expect(FLOW_USED_MESSAGE) - .push(HfPlusLeaf::CycleSink { + .push(HydroLeaf::CycleSink { ident, location_kind: self.location_kind(), - input: Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), + input: Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), }); } } impl<'a, T: Clone, L: Location<'a>, B> Clone for Singleton { fn clone(&self) -> Self { - if !matches!(self.ir_node.borrow().deref(), HfPlusNode::Tee { .. }) { - let orig_ir_node = self.ir_node.replace(HfPlusNode::Placeholder); - *self.ir_node.borrow_mut() = HfPlusNode::Tee { + if !matches!(self.ir_node.borrow().deref(), HydroNode::Tee { .. }) { + let orig_ir_node = self.ir_node.replace(HydroNode::Placeholder); + *self.ir_node.borrow_mut() = HydroNode::Tee { inner: TeeNode(Rc::new(RefCell::new(orig_ir_node))), }; } - if let HfPlusNode::Tee { inner } = self.ir_node.borrow().deref() { + if let HydroNode::Tee { inner } = self.ir_node.borrow().deref() { Singleton { location: self.location.clone(), - ir_node: HfPlusNode::Tee { + ir_node: HydroNode::Tee { inner: TeeNode(inner.0.clone()), } .into(), @@ -198,7 +198,7 @@ impl<'a, T, L: Location<'a>, B> Singleton { let f = f.splice_fn1_ctx(&self.location).into(); Singleton::new( self.location, - HfPlusNode::Map { + HydroNode::Map { f, input: Box::new(self.ir_node.into_inner()), }, @@ -212,7 +212,7 @@ impl<'a, T, L: Location<'a>, B> Singleton { let f = f.splice_fn1_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::FlatMap { + HydroNode::FlatMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -226,7 +226,7 @@ impl<'a, T, L: Location<'a>, B> Singleton { let f = f.splice_fn1_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::FlatMap { + HydroNode::FlatMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -240,7 +240,7 @@ impl<'a, T, L: Location<'a>, B> Singleton { let f = f.splice_fn1_borrow_ctx(&self.location).into(); Optional::new( self.location, - HfPlusNode::Filter { + HydroNode::Filter { f, input: Box::new(self.ir_node.into_inner()), }, @@ -254,7 +254,7 @@ impl<'a, T, L: Location<'a>, B> Singleton { let f = f.splice_fn1_ctx(&self.location).into(); Optional::new( self.location, - HfPlusNode::FilterMap { + HydroNode::FilterMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -270,15 +270,15 @@ impl<'a, T, L: Location<'a>, B> Singleton { if L::is_top_level() { Self::make( self.location, - HfPlusNode::Persist(Box::new(HfPlusNode::CrossSingleton( - Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), - Box::new(HfPlusNode::Unpersist(Box::new(Self::other_ir_node(other)))), + HydroNode::Persist(Box::new(HydroNode::CrossSingleton( + Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), + Box::new(HydroNode::Unpersist(Box::new(Self::other_ir_node(other)))), ))), ) } else { Self::make( self.location, - HfPlusNode::CrossSingleton( + HydroNode::CrossSingleton( Box::new(self.ir_node.into_inner()), Box::new(Self::other_ir_node(other)), ), @@ -323,7 +323,7 @@ impl<'a, T, L: Location<'a> + NoTick, B> Singleton, B> { pub unsafe fn latest_tick(self) -> Singleton, Bounded> { Singleton::new( self.location.tick, - HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner())), + HydroNode::Unpersist(Box::new(self.ir_node.into_inner())), ) } @@ -398,7 +398,7 @@ impl<'a, T, L: Location<'a>> Singleton, Bounded> { Timestamped { tick: self.location, }, - HfPlusNode::Persist(Box::new(self.ir_node.into_inner())), + HydroNode::Persist(Box::new(self.ir_node.into_inner())), ) } @@ -407,28 +407,28 @@ impl<'a, T, L: Location<'a>> Singleton, Bounded> { Timestamped { tick: self.location, }, - HfPlusNode::Persist(Box::new(self.ir_node.into_inner())), + HydroNode::Persist(Box::new(self.ir_node.into_inner())), ) } pub fn defer_tick(self) -> Singleton, Bounded> { Singleton::new( self.location, - HfPlusNode::DeferTick(Box::new(self.ir_node.into_inner())), + HydroNode::DeferTick(Box::new(self.ir_node.into_inner())), ) } pub fn persist(self) -> Stream, Bounded> { Stream::new( self.location, - HfPlusNode::Persist(Box::new(self.ir_node.into_inner())), + HydroNode::Persist(Box::new(self.ir_node.into_inner())), ) } pub fn delta(self) -> Optional, Bounded> { Optional::new( self.location, - HfPlusNode::Delta(Box::new(self.ir_node.into_inner())), + HydroNode::Delta(Box::new(self.ir_node.into_inner())), ) } @@ -442,9 +442,9 @@ pub trait ZipResult<'a, Other> { type Location; fn other_location(other: &Other) -> Self::Location; - fn other_ir_node(other: Other) -> HfPlusNode; + fn other_ir_node(other: Other) -> HydroNode; - fn make(location: Self::Location, ir_node: HfPlusNode) -> Self::Out; + fn make(location: Self::Location, ir_node: HydroNode) -> Self::Out; } impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton, B>> @@ -457,11 +457,11 @@ impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton, B>) -> HfPlusNode { + fn other_ir_node(other: Singleton, B>) -> HydroNode { other.ir_node.into_inner() } - fn make(location: Timestamped, ir_node: HfPlusNode) -> Self::Out { + fn make(location: Timestamped, ir_node: HydroNode) -> Self::Out { Singleton::new(location, ir_node) } } @@ -476,11 +476,11 @@ impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Optional, B>) -> HfPlusNode { + fn other_ir_node(other: Optional, B>) -> HydroNode { other.ir_node.into_inner() } - fn make(location: Timestamped, ir_node: HfPlusNode) -> Self::Out { + fn make(location: Timestamped, ir_node: HydroNode) -> Self::Out { Optional::new(location, ir_node) } } @@ -495,11 +495,11 @@ impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton, B> other.location.clone() } - fn other_ir_node(other: Singleton, B>) -> HfPlusNode { + fn other_ir_node(other: Singleton, B>) -> HydroNode { other.ir_node.into_inner() } - fn make(location: Tick, ir_node: HfPlusNode) -> Self::Out { + fn make(location: Tick, ir_node: HydroNode) -> Self::Out { Singleton::new(location, ir_node) } } @@ -514,11 +514,11 @@ impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Optional, B>> other.location.clone() } - fn other_ir_node(other: Optional, B>) -> HfPlusNode { + fn other_ir_node(other: Optional, B>) -> HydroNode { other.ir_node.into_inner() } - fn make(location: Tick, ir_node: HfPlusNode) -> Self::Out { + fn make(location: Tick, ir_node: HydroNode) -> Self::Out { Optional::new(location, ir_node) } } diff --git a/hydroflow_plus/src/staging_util.rs b/hydro_lang/src/staging_util.rs similarity index 64% rename from hydroflow_plus/src/staging_util.rs rename to hydro_lang/src/staging_util.rs index 51c1ae2e28af..eab1dbf64bc0 100644 --- a/hydroflow_plus/src/staging_util.rs +++ b/hydro_lang/src/staging_util.rs @@ -6,10 +6,10 @@ use quote::quote; pub type Invariant<'a, D = ()> = PhantomData<(fn(&'a ()) -> &'a (), D)>; pub fn get_this_crate() -> TokenStream { - let hydroflow_crate = proc_macro_crate::crate_name("hydroflow_plus") - .expect("hydroflow_plus should be present in `Cargo.toml`"); + let hydroflow_crate = proc_macro_crate::crate_name("hydro_lang") + .expect("hydro_lang should be present in `Cargo.toml`"); match hydroflow_crate { - proc_macro_crate::FoundCrate::Itself => quote! { hydroflow_plus }, + proc_macro_crate::FoundCrate::Itself => quote! { hydro_lang }, proc_macro_crate::FoundCrate::Name(name) => { let ident = syn::Ident::new(&name, Span::call_site()); quote! { #ident } diff --git a/hydroflow_plus/src/stream.rs b/hydro_lang/src/stream.rs similarity index 92% rename from hydroflow_plus/src/stream.rs rename to hydro_lang/src/stream.rs index 163654d1a9e0..8d8e7b04bb17 100644 --- a/hydroflow_plus/src/stream.rs +++ b/hydro_lang/src/stream.rs @@ -14,7 +14,7 @@ use tokio::time::Instant; use crate::builder::FLOW_USED_MESSAGE; use crate::cycle::{CycleCollection, CycleComplete, DeferTick, ForwardRefMarker, TickCycleMarker}; -use crate::ir::{DebugInstantiate, HfPlusLeaf, HfPlusNode, TeeNode}; +use crate::ir::{DebugInstantiate, HydroLeaf, HydroNode, TeeNode}; use crate::location::cluster::CLUSTER_SELF_ID; use crate::location::external_process::{ExternalBincodeStream, ExternalBytesPort}; use crate::location::tick::{NoTimestamp, Timestamped}; @@ -69,7 +69,7 @@ impl MinOrder for NoOrder { /// or [`NoOrder`] (default is [`TotalOrder`]) pub struct Stream { location: L, - pub(crate) ir_node: RefCell, + pub(crate) ir_node: RefCell, _phantom: PhantomData<(T, L, B, Order)>, } @@ -105,7 +105,7 @@ impl<'a, T, L: Location<'a>, Order> CycleCollection<'a, TickCycleMarker> let location_id = location.id(); Stream::new( location, - HfPlusNode::CycleSource { + HydroNode::CycleSource { ident, location_kind: location_id, }, @@ -128,7 +128,7 @@ impl<'a, T, L: Location<'a>, Order> CycleComplete<'a, TickCycleMarker> .leaves .as_mut() .expect(FLOW_USED_MESSAGE) - .push(HfPlusLeaf::CycleSink { + .push(HydroLeaf::CycleSink { ident, location_kind: self.location_kind(), input: Box::new(self.ir_node.into_inner()), @@ -145,7 +145,7 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> CycleCollection<'a, ForwardRefMa let location_id = location.id(); Stream::new( location, - HfPlusNode::Persist(Box::new(HfPlusNode::CycleSource { + HydroNode::Persist(Box::new(HydroNode::CycleSource { ident, location_kind: location_id, })), @@ -168,16 +168,16 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> CycleComplete<'a, ForwardRefMark .leaves .as_mut() .expect(FLOW_USED_MESSAGE) - .push(HfPlusLeaf::CycleSink { + .push(HydroLeaf::CycleSink { ident, location_kind: self.location_kind(), - input: Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), + input: Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), }); } } impl<'a, T, L: Location<'a>, B, Order> Stream { - pub(crate) fn new(location: L, ir_node: HfPlusNode) -> Self { + pub(crate) fn new(location: L, ir_node: HydroNode) -> Self { Stream { location, ir_node: RefCell::new(ir_node), @@ -188,17 +188,17 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { impl<'a, T: Clone, L: Location<'a>, B, Order> Clone for Stream { fn clone(&self) -> Self { - if !matches!(self.ir_node.borrow().deref(), HfPlusNode::Tee { .. }) { - let orig_ir_node = self.ir_node.replace(HfPlusNode::Placeholder); - *self.ir_node.borrow_mut() = HfPlusNode::Tee { + if !matches!(self.ir_node.borrow().deref(), HydroNode::Tee { .. }) { + let orig_ir_node = self.ir_node.replace(HydroNode::Placeholder); + *self.ir_node.borrow_mut() = HydroNode::Tee { inner: TeeNode(Rc::new(RefCell::new(orig_ir_node))), }; } - if let HfPlusNode::Tee { inner } = self.ir_node.borrow().deref() { + if let HydroNode::Tee { inner } = self.ir_node.borrow().deref() { Stream { location: self.location.clone(), - ir_node: HfPlusNode::Tee { + ir_node: HydroNode::Tee { inner: TeeNode(inner.0.clone()), } .into(), @@ -218,7 +218,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { let f = f.splice_fn1_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::Map { + HydroNode::Map { f, input: Box::new(self.ir_node.into_inner()), }, @@ -239,7 +239,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { let f = f.splice_fn1_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::FlatMap { + HydroNode::FlatMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -253,7 +253,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { let f = f.splice_fn1_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::FlatMap { + HydroNode::FlatMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -281,7 +281,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { let f = f.splice_fn1_borrow_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::Filter { + HydroNode::Filter { f, input: Box::new(self.ir_node.into_inner()), }, @@ -295,7 +295,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { let f = f.splice_fn1_ctx(&self.location).into(); Stream::new( self.location, - HfPlusNode::FilterMap { + HydroNode::FilterMap { f, input: Box::new(self.ir_node.into_inner()), }, @@ -314,7 +314,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { Stream::new( self.location, - HfPlusNode::CrossSingleton( + HydroNode::CrossSingleton( Box::new(self.ir_node.into_inner()), Box::new(other.ir_node.into_inner()), ), @@ -341,7 +341,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { Stream::new( self.location, - HfPlusNode::CrossProduct( + HydroNode::CrossProduct( Box::new(self.ir_node.into_inner()), Box::new(other.ir_node.into_inner()), ), @@ -354,7 +354,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { { Stream::new( self.location, - HfPlusNode::Unique(Box::new(self.ir_node.into_inner())), + HydroNode::Unique(Box::new(self.ir_node.into_inner())), ) } @@ -366,7 +366,7 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { Stream::new( self.location, - HfPlusNode::Difference( + HydroNode::Difference( Box::new(self.ir_node.into_inner()), Box::new(other.ir_node.into_inner()), ), @@ -382,15 +382,15 @@ impl<'a, T, L: Location<'a>, B, Order> Stream { if L::is_top_level() { Stream::new( self.location, - HfPlusNode::Persist(Box::new(HfPlusNode::Inspect { + HydroNode::Persist(Box::new(HydroNode::Inspect { f, - input: Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), + input: Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), })), ) } else { Stream::new( self.location, - HfPlusNode::Inspect { + HydroNode::Inspect { f, input: Box::new(self.ir_node.into_inner()), }, @@ -423,7 +423,7 @@ where let init = init.splice_fn0_ctx(&self.location).into(); let comb = comb.splice_fn2_borrow_mut_ctx(&self.location).into(); - let mut core = HfPlusNode::Fold { + let mut core = HydroNode::Fold { init, acc: comb, input: Box::new(self.ir_node.into_inner()), @@ -433,7 +433,7 @@ where // top-level (possibly unbounded) singletons are represented as // a stream which produces all values from all ticks every tick, // so Unpersist will always give the lastest aggregation - core = HfPlusNode::Persist(Box::new(core)); + core = HydroNode::Persist(Box::new(core)); } Singleton::new(self.location, core) @@ -444,13 +444,13 @@ where comb: impl IntoQuotedMut<'a, F, L>, ) -> Optional { let f = comb.splice_fn2_borrow_mut_ctx(&self.location).into(); - let mut core = HfPlusNode::Reduce { + let mut core = HydroNode::Reduce { f, input: Box::new(self.ir_node.into_inner()), }; if L::is_top_level() { - core = HfPlusNode::Persist(Box::new(core)); + core = HydroNode::Persist(Box::new(core)); } Optional::new(self.location, core) @@ -482,13 +482,13 @@ where } }); - let mut core = HfPlusNode::Reduce { + let mut core = HydroNode::Reduce { f: wrapped.into(), input: Box::new(self.ir_node.into_inner()), }; if L::is_top_level() { - core = HfPlusNode::Persist(Box::new(core)); + core = HydroNode::Persist(Box::new(core)); } Optional::new(self.location, core) @@ -515,15 +515,15 @@ impl<'a, T, L: Location<'a>, B> Stream { if L::is_top_level() { Stream::new( self.location, - HfPlusNode::Persist(Box::new(HfPlusNode::Enumerate { + HydroNode::Persist(Box::new(HydroNode::Enumerate { is_static: true, - input: Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), + input: Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), })), ) } else { Stream::new( self.location, - HfPlusNode::Enumerate { + HydroNode::Enumerate { is_static: false, input: Box::new(self.ir_node.into_inner()), }, @@ -547,7 +547,7 @@ impl<'a, T, L: Location<'a>, B> Stream { let init = init.splice_fn0_ctx(&self.location).into(); let comb = comb.splice_fn2_borrow_mut_ctx(&self.location).into(); - let mut core = HfPlusNode::Fold { + let mut core = HydroNode::Fold { init, acc: comb, input: Box::new(self.ir_node.into_inner()), @@ -557,7 +557,7 @@ impl<'a, T, L: Location<'a>, B> Stream { // top-level (possibly unbounded) singletons are represented as // a stream which produces all values from all ticks every tick, // so Unpersist will always give the lastest aggregation - core = HfPlusNode::Persist(Box::new(core)); + core = HydroNode::Persist(Box::new(core)); } Singleton::new(self.location, core) @@ -568,13 +568,13 @@ impl<'a, T, L: Location<'a>, B> Stream { comb: impl IntoQuotedMut<'a, F, L>, ) -> Optional { let f = comb.splice_fn2_borrow_mut_ctx(&self.location).into(); - let mut core = HfPlusNode::Reduce { + let mut core = HydroNode::Reduce { f, input: Box::new(self.ir_node.into_inner()), }; if L::is_top_level() { - core = HfPlusNode::Persist(Box::new(core)); + core = HydroNode::Persist(Box::new(core)); } Optional::new(self.location, core) @@ -590,7 +590,7 @@ impl<'a, T, L: Location<'a>> Stream { Stream::new( self.location, - HfPlusNode::Chain( + HydroNode::Chain( Box::new(self.ir_node.into_inner()), Box::new(other.ir_node.into_inner()), ), @@ -623,7 +623,7 @@ impl<'a, T, L: Location<'a>, Order> Stream { { Stream::new( self.location, - HfPlusNode::Sort(Box::new(self.ir_node.into_inner())), + HydroNode::Sort(Box::new(self.ir_node.into_inner())), ) } @@ -635,7 +635,7 @@ impl<'a, T, L: Location<'a>, Order> Stream { Stream::new( self.location, - HfPlusNode::Chain( + HydroNode::Chain( Box::new(self.ir_node.into_inner()), Box::new(other.ir_node.into_inner()), ), @@ -652,7 +652,7 @@ impl<'a, K, V1, L: Location<'a>, B, Order> Stream<(K, V1), L, B, Order> { Stream::new( self.location, - HfPlusNode::Join( + HydroNode::Join( Box::new(self.ir_node.into_inner()), Box::new(n.ir_node.into_inner()), ), @@ -667,7 +667,7 @@ impl<'a, K, V1, L: Location<'a>, B, Order> Stream<(K, V1), L, B, Order> { Stream::new( self.location, - HfPlusNode::AntiJoin( + HydroNode::AntiJoin( Box::new(self.ir_node.into_inner()), Box::new(n.ir_node.into_inner()), ), @@ -686,7 +686,7 @@ impl<'a, K: Eq + Hash, V, L: Location<'a>> Stream<(K, V), Tick, Bounded> { Stream::new( self.location, - HfPlusNode::FoldKeyed { + HydroNode::FoldKeyed { init, acc: comb, input: Box::new(self.ir_node.into_inner()), @@ -702,7 +702,7 @@ impl<'a, K: Eq + Hash, V, L: Location<'a>> Stream<(K, V), Tick, Bounded> { Stream::new( self.location, - HfPlusNode::ReduceKeyed { + HydroNode::ReduceKeyed { f, input: Box::new(self.ir_node.into_inner()), }, @@ -721,7 +721,7 @@ impl<'a, K: Eq + Hash, V, L: Location<'a>, Order> Stream<(K, V), Tick, Bounde Stream::new( self.location, - HfPlusNode::FoldKeyed { + HydroNode::FoldKeyed { init, acc: comb, input: Box::new(self.ir_node.into_inner()), @@ -742,7 +742,7 @@ impl<'a, K: Eq + Hash, V, L: Location<'a>, Order> Stream<(K, V), Tick, Bounde Stream::new( self.location, - HfPlusNode::ReduceKeyed { + HydroNode::ReduceKeyed { f, input: Box::new(self.ir_node.into_inner()), }, @@ -760,7 +760,7 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> Stream, B, Ord pub unsafe fn tick_batch(self) -> Stream, Bounded, Order> { Stream::new( self.location.tick, - HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner())), + HydroNode::Unpersist(Box::new(self.ir_node.into_inner())), ) } @@ -864,8 +864,8 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> Stream { .leaves .as_mut() .expect(FLOW_USED_MESSAGE) - .push(HfPlusLeaf::ForEach { - input: Box::new(HfPlusNode::Unpersist(Box::new(self.ir_node.into_inner()))), + .push(HydroLeaf::ForEach { + input: Box::new(HydroNode::Unpersist(Box::new(self.ir_node.into_inner()))), f, }); } @@ -880,7 +880,7 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> Stream { .leaves .as_mut() .expect(FLOW_USED_MESSAGE) - .push(HfPlusLeaf::DestSink { + .push(HydroLeaf::DestSink { sink: sink.splice_typed_ctx(&self.location).into(), input: Box::new(self.ir_node.into_inner()), }); @@ -893,7 +893,7 @@ impl<'a, T, L: Location<'a>, Order> Stream, Bounded, Order> { Timestamped { tick: self.location.clone(), }, - HfPlusNode::Persist(Box::new(self.ir_node.into_inner())), + HydroNode::Persist(Box::new(self.ir_node.into_inner())), ) } @@ -903,21 +903,21 @@ impl<'a, T, L: Location<'a>, Order> Stream, Bounded, Order> { { Stream::new( self.location, - HfPlusNode::Persist(Box::new(self.ir_node.into_inner())), + HydroNode::Persist(Box::new(self.ir_node.into_inner())), ) } pub fn defer_tick(self) -> Stream, Bounded, Order> { Stream::new( self.location, - HfPlusNode::DeferTick(Box::new(self.ir_node.into_inner())), + HydroNode::DeferTick(Box::new(self.ir_node.into_inner())), ) } pub fn delta(self) -> Stream, Bounded, Order> { Stream::new( self.location, - HfPlusNode::Delta(Box::new(self.ir_node.into_inner())), + HydroNode::Delta(Box::new(self.ir_node.into_inner())), ) } } @@ -1021,7 +1021,7 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> Stream { Stream::new( other.clone(), - HfPlusNode::Network { + HydroNode::Network { from_location: self.location.root().id(), from_key: None, to_location: other.id(), @@ -1054,9 +1054,9 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> Stream { let dummy_f: syn::Expr = syn::parse_quote!(()); - leaves.push(HfPlusLeaf::ForEach { + leaves.push(HydroLeaf::ForEach { f: dummy_f.into(), - input: Box::new(HfPlusNode::Network { + input: Box::new(HydroNode::Network { from_location: self.location.root().id(), from_key: None, to_location: other.id(), @@ -1086,7 +1086,7 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> Stream { let root = get_this_crate(); Stream::new( other.clone(), - HfPlusNode::Network { + HydroNode::Network { from_location: self.location.root().id(), from_key: None, to_location: other.id(), @@ -1117,9 +1117,9 @@ impl<'a, T, L: Location<'a> + NoTick, B, Order> Stream { let dummy_f: syn::Expr = syn::parse_quote!(()); - leaves.push(HfPlusLeaf::ForEach { + leaves.push(HydroLeaf::ForEach { f: dummy_f.into(), - input: Box::new(HfPlusNode::Network { + input: Box::new(HydroNode::Network { from_location: self.location.root().id(), from_key: None, to_location: other.id(), diff --git a/hydroflow_plus/tests/compile-fail/send_bincode_lifetime.rs b/hydro_lang/tests/compile-fail/send_bincode_lifetime.rs similarity index 89% rename from hydroflow_plus/tests/compile-fail/send_bincode_lifetime.rs rename to hydro_lang/tests/compile-fail/send_bincode_lifetime.rs index efe156df077d..b5c05d3bb06a 100644 --- a/hydroflow_plus/tests/compile-fail/send_bincode_lifetime.rs +++ b/hydro_lang/tests/compile-fail/send_bincode_lifetime.rs @@ -1,4 +1,4 @@ -use hydroflow_plus::*; +use hydroflow_lang::*; struct P1 {} struct P2 {} diff --git a/hydro_lang/tests/compile-fail/send_bincode_lifetime.stderr b/hydro_lang/tests/compile-fail/send_bincode_lifetime.stderr new file mode 100644 index 000000000000..33da7df0151e --- /dev/null +++ b/hydro_lang/tests/compile-fail/send_bincode_lifetime.stderr @@ -0,0 +1,55 @@ +error: cannot find macro `q` in this scope + --> tests/compile-fail/send_bincode_lifetime.rs:7:20 + | +7 | p1.source_iter(q!(0..10)).send_bincode(p2).for_each(q!(|n| println!("{}", n))); + | ^ + | +help: consider importing one of these macros + | +1 + use hydro_lang::q; + | +1 + use stageleft::q; + | + +error: cannot find macro `q` in this scope + --> tests/compile-fail/send_bincode_lifetime.rs:7:57 + | +7 | p1.source_iter(q!(0..10)).send_bincode(p2).for_each(q!(|n| println!("{}", n))); + | ^ + | +help: consider importing one of these macros + | +1 + use hydro_lang::q; + | +1 + use stageleft::q; + | + +error[E0412]: cannot find type `Process` in this scope + --> tests/compile-fail/send_bincode_lifetime.rs:6:22 + | +6 | fn test<'a, 'b>(p1: &Process<'a, P1>, p2: &Process<'b, P2>) { + | ^^^^^^^ not found in this scope + | +help: consider importing this struct + | +1 + use hydro_lang::Process; + | + +error[E0412]: cannot find type `Process` in this scope + --> tests/compile-fail/send_bincode_lifetime.rs:6:44 + | +6 | fn test<'a, 'b>(p1: &Process<'a, P1>, p2: &Process<'b, P2>) { + | ^^^^^^^ not found in this scope + | +help: consider importing this struct + | +1 + use hydro_lang::Process; + | + +warning: unused import: `hydroflow_lang::*` + --> tests/compile-fail/send_bincode_lifetime.rs:1:5 + | +1 | use hydroflow_lang::*; + | ^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` on by default diff --git a/hydroflow_plus/tests/compile_fail.rs b/hydro_lang/tests/compile_fail.rs similarity index 100% rename from hydroflow_plus/tests/compile_fail.rs rename to hydro_lang/tests/compile_fail.rs diff --git a/hydroflow_plus_std/CHANGELOG.md b/hydro_std/CHANGELOG.md similarity index 100% rename from hydroflow_plus_std/CHANGELOG.md rename to hydro_std/CHANGELOG.md diff --git a/hydroflow_plus_std/Cargo.toml b/hydro_std/Cargo.toml similarity index 74% rename from hydroflow_plus_std/Cargo.toml rename to hydro_std/Cargo.toml index 03992c88f27f..50f61d6646ce 100644 --- a/hydroflow_plus_std/Cargo.toml +++ b/hydro_std/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "hydroflow_plus_std" +name = "hydro_std" publish = true version = "0.10.0" edition = "2021" license = "Apache-2.0" documentation = "https://docs.rs/hydroflow_plus_std/" -description = "Standard library of distributed systems building blocks for Hydroflow+" +description = "Standard library of distributed systems building blocks for Hydro" [lints] workspace = true @@ -14,14 +14,14 @@ workspace = true path = "src/lib.rs" [dependencies] -hydroflow_plus = { path = "../hydroflow_plus", version = "^0.10.0", default-features = false } +hydro_lang = { path = "../hydro_lang", version = "^0.10.0", default-features = false } stageleft = { path = "../stageleft", version = "^0.5.0" } [build-dependencies] stageleft_tool = { path = "../stageleft_tool", version = "^0.4.0" } [dev-dependencies] -hydroflow_plus = { path = "../hydroflow_plus", version = "^0.10.0" } +hydro_lang = { path = "../hydro_lang", version = "^0.10.0" } insta = "1.39" hydro_deploy = { path = "../hydro_deploy/core", version = "^0.10.0" } async-ssh2-lite = { version = "0.5.0", features = ["vendored-openssl"] } diff --git a/hydroflow_plus_std/build.rs b/hydro_std/build.rs similarity index 100% rename from hydroflow_plus_std/build.rs rename to hydro_std/build.rs diff --git a/hydroflow_plus_std/src/lib.rs b/hydro_std/src/lib.rs similarity index 79% rename from hydroflow_plus_std/src/lib.rs rename to hydro_std/src/lib.rs index fc5a2ab71fb1..624c2f33af7a 100644 --- a/hydroflow_plus_std/src/lib.rs +++ b/hydro_std/src/lib.rs @@ -8,6 +8,6 @@ pub mod request_response; mod tests { #[ctor::ctor] fn init() { - hydroflow_plus::deploy::init_test(); + hydro_lang::deploy::init_test(); } } diff --git a/hydroflow_plus_std/src/quorum.rs b/hydro_std/src/quorum.rs similarity index 99% rename from hydroflow_plus_std/src/quorum.rs rename to hydro_std/src/quorum.rs index 6788123bdda1..200173fb73ce 100644 --- a/hydroflow_plus_std/src/quorum.rs +++ b/hydro_std/src/quorum.rs @@ -1,6 +1,6 @@ use std::hash::Hash; -use hydroflow_plus::*; +use hydro_lang::*; use location::NoTick; #[expect(clippy::type_complexity, reason = "stream types with ordering")] diff --git a/hydroflow_plus_std/src/request_response.rs b/hydro_std/src/request_response.rs similarity index 98% rename from hydroflow_plus_std/src/request_response.rs rename to hydro_std/src/request_response.rs index 492c06da865e..230f1effa5a0 100644 --- a/hydroflow_plus_std/src/request_response.rs +++ b/hydro_std/src/request_response.rs @@ -1,6 +1,6 @@ use std::hash::Hash; -use hydroflow_plus::*; +use hydro_lang::*; use location::NoTick; type JoinResponses = Stream<(K, (M, V)), Timestamped, Unbounded, NoOrder>; diff --git a/hydroflow_plus_test/Cargo.toml b/hydro_test/Cargo.toml similarity index 70% rename from hydroflow_plus_test/Cargo.toml rename to hydro_test/Cargo.toml index aabdaf528a2e..1433a16d99fb 100644 --- a/hydroflow_plus_test/Cargo.toml +++ b/hydro_test/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hydroflow_plus_test" +name = "hydro_test" publish = false version = "0.0.0" edition = "2021" @@ -12,8 +12,8 @@ default = ["stageleft_devel"] stageleft_devel = [] [dependencies] -hydroflow_plus = { path = "../hydroflow_plus", version = "^0.10.0" } -hydroflow_plus_std = { path = "../hydroflow_plus_std", version = "^0.10.0" } +hydro_lang = { path = "../hydro_lang", version = "^0.10.0" } +hydro_std = { path = "../hydro_std", version = "^0.10.0" } tokio = { version = "1.29.0", features = [ "full" ] } stageleft = { path = "../stageleft", version = "^0.5.0" } rand = "0.8.0" @@ -25,6 +25,6 @@ stageleft_tool = { path = "../stageleft_tool", version = "^0.4.0" } [dev-dependencies] insta = "1.39" hydro_deploy = { path = "../hydro_deploy/core", version = "^0.10.0" } -hydroflow_plus = { path = "../hydroflow_plus", version = "^0.10.0", features = [ "deploy" ] } +hydro_lang = { path = "../hydro_lang", version = "^0.10.0", features = [ "deploy" ] } futures = "0.3.0" async-ssh2-lite = { version = "0.5.0", features = ["vendored-openssl"] } diff --git a/hydroflow_plus_test/build.rs b/hydro_test/build.rs similarity index 100% rename from hydroflow_plus_test/build.rs rename to hydro_test/build.rs diff --git a/hydroflow_plus_test/examples/compute_pi.rs b/hydro_test/examples/compute_pi.rs similarity index 89% rename from hydroflow_plus_test/examples/compute_pi.rs rename to hydro_test/examples/compute_pi.rs index 69ec6df97425..1f9de123e936 100644 --- a/hydroflow_plus_test/examples/compute_pi.rs +++ b/hydro_test/examples/compute_pi.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use hydro_deploy::gcp::GcpNetwork; use hydro_deploy::{Deployment, Host}; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; use tokio::sync::RwLock; type HostCreator = Box Arc>; @@ -38,8 +38,8 @@ async fn main() { ) }; - let builder = hydroflow_plus::FlowBuilder::new(); - let (cluster, leader) = hydroflow_plus_test::cluster::compute_pi::compute_pi(&builder, 8192); + let builder = hydro_lang::FlowBuilder::new(); + let (cluster, leader) = hydro_test::cluster::compute_pi::compute_pi(&builder, 8192); let _nodes = builder .with_process( diff --git a/hydroflow_plus_test/examples/first_ten_distributed.rs b/hydro_test/examples/first_ten_distributed.rs similarity index 92% rename from hydroflow_plus_test/examples/first_ten_distributed.rs rename to hydro_test/examples/first_ten_distributed.rs index 2963b1bc0e96..9c207cdce273 100644 --- a/hydroflow_plus_test/examples/first_ten_distributed.rs +++ b/hydro_test/examples/first_ten_distributed.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use futures::SinkExt; use hydro_deploy::gcp::GcpNetwork; use hydro_deploy::{Deployment, Host}; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; use tokio::sync::RwLock; type HostCreator = Box Arc>; @@ -39,12 +39,12 @@ async fn main() { ) }; - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let external = builder.external_process(); let p1 = builder.process(); let p2 = builder.process(); let external_port = - hydroflow_plus_test::distributed::first_ten::first_ten_distributed(&external, &p1, &p2); + hydro_test::distributed::first_ten::first_ten_distributed(&external, &p1, &p2); let nodes = builder .with_process( &p1, diff --git a/hydroflow_plus_test/examples/map_reduce.rs b/hydro_test/examples/map_reduce.rs similarity index 90% rename from hydroflow_plus_test/examples/map_reduce.rs rename to hydro_test/examples/map_reduce.rs index 960fc032277b..06684c7ada49 100644 --- a/hydroflow_plus_test/examples/map_reduce.rs +++ b/hydro_test/examples/map_reduce.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use hydro_deploy::gcp::GcpNetwork; use hydro_deploy::{Deployment, Host}; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; use tokio::sync::RwLock; type HostCreator = Box Arc>; @@ -38,8 +38,8 @@ async fn main() { ) }; - let builder = hydroflow_plus::FlowBuilder::new(); - let (leader, cluster) = hydroflow_plus_test::cluster::map_reduce::map_reduce(&builder); + let builder = hydro_lang::FlowBuilder::new(); + let (leader, cluster) = hydro_test::cluster::map_reduce::map_reduce(&builder); let _nodes = builder .with_process( &leader, diff --git a/hydroflow_plus_test/examples/paxos.rs b/hydro_test/examples/paxos.rs similarity index 82% rename from hydroflow_plus_test/examples/paxos.rs rename to hydro_test/examples/paxos.rs index 90bf86299b7a..07d24c0ba00f 100644 --- a/hydroflow_plus_test/examples/paxos.rs +++ b/hydro_test/examples/paxos.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use hydro_deploy::gcp::GcpNetwork; use hydro_deploy::{Deployment, Host}; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; use tokio::sync::RwLock; type HostCreator = Box Arc>; @@ -31,7 +31,7 @@ async fn main() { Box::new(move |_| -> Arc { localhost.clone() }) }; - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let f = 1; let num_clients = 1; let num_clients_per_node = 100; // Change based on experiment between 1, 50, 100. @@ -41,17 +41,16 @@ async fn main() { let i_am_leader_check_timeout = 10; // Sec let i_am_leader_check_timeout_delay_multiplier = 15; - let (proposers, acceptors, clients, replicas) = - hydroflow_plus_test::cluster::paxos_bench::paxos_bench( - &builder, - f, - num_clients_per_node, - median_latency_window_size, - checkpoint_frequency, - i_am_leader_send_timeout, - i_am_leader_check_timeout, - i_am_leader_check_timeout_delay_multiplier, - ); + let (proposers, acceptors, clients, replicas) = hydro_test::cluster::paxos_bench::paxos_bench( + &builder, + f, + num_clients_per_node, + median_latency_window_size, + checkpoint_frequency, + i_am_leader_send_timeout, + i_am_leader_check_timeout, + i_am_leader_check_timeout_delay_multiplier, + ); let rustflags = "-C opt-level=3 -C codegen-units=1 -C strip=none -C debuginfo=2 -C lto=off"; diff --git a/hydroflow_plus_test/examples/perf_compute_pi.rs b/hydro_test/examples/perf_compute_pi.rs similarity index 94% rename from hydroflow_plus_test/examples/perf_compute_pi.rs rename to hydro_test/examples/perf_compute_pi.rs index da9e491ec632..56364c9d58c6 100644 --- a/hydroflow_plus_test/examples/perf_compute_pi.rs +++ b/hydro_test/examples/perf_compute_pi.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use hydro_deploy::gcp::GcpNetwork; use hydro_deploy::hydroflow_crate::tracing_options::TracingOptions; use hydro_deploy::{Deployment, Host}; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; use tokio::sync::RwLock; type HostCreator = Box Arc>; @@ -41,8 +41,8 @@ async fn main() { ) }; - let builder = hydroflow_plus::FlowBuilder::new(); - let (cluster, leader) = hydroflow_plus_test::cluster::compute_pi::compute_pi(&builder, 8192); + let builder = hydro_lang::FlowBuilder::new(); + let (cluster, leader) = hydro_test::cluster::compute_pi::compute_pi(&builder, 8192); // Uncomment below, change .bin("counter_compute_pi") in order to track cardinality per operation // dbg!(builder.with_default_optimize() diff --git a/hydroflow_plus_test/examples/simple_cluster.rs b/hydro_test/examples/simple_cluster.rs similarity index 89% rename from hydroflow_plus_test/examples/simple_cluster.rs rename to hydro_test/examples/simple_cluster.rs index 05fe9ea71508..f4eb697233a5 100644 --- a/hydroflow_plus_test/examples/simple_cluster.rs +++ b/hydro_test/examples/simple_cluster.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use hydro_deploy::gcp::GcpNetwork; use hydro_deploy::{Deployment, Host}; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; use tokio::sync::RwLock; type HostCreator = Box Arc>; @@ -38,8 +38,8 @@ async fn main() { ) }; - let builder = hydroflow_plus::FlowBuilder::new(); - let (process, cluster) = hydroflow_plus_test::cluster::simple_cluster::simple_cluster(&builder); + let builder = hydro_lang::FlowBuilder::new(); + let (process, cluster) = hydro_test::cluster::simple_cluster::simple_cluster(&builder); let _nodes = builder .with_process( diff --git a/hydroflow_plus_test/examples/two_pc.rs b/hydro_test/examples/two_pc.rs similarity index 82% rename from hydroflow_plus_test/examples/two_pc.rs rename to hydro_test/examples/two_pc.rs index aa3065571cca..b8db969eda3f 100644 --- a/hydroflow_plus_test/examples/two_pc.rs +++ b/hydro_test/examples/two_pc.rs @@ -1,16 +1,16 @@ use hydro_deploy::Deployment; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; #[tokio::main] async fn main() { let mut deployment = Deployment::new(); let _localhost = deployment.Localhost(); - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let num_participants: u32 = 3; let (coordinator, participants, client) = - hydroflow_plus_test::cluster::two_pc::two_pc(&builder, num_participants); + hydro_test::cluster::two_pc::two_pc(&builder, num_participants); let _rustflags = "-C opt-level=3 -C codegen-units=1 -C strip=none -C debuginfo=2 -C lto=off"; diff --git a/hydroflow_plus_test/src/cluster/compute_pi.rs b/hydro_test/src/cluster/compute_pi.rs similarity index 93% rename from hydroflow_plus_test/src/cluster/compute_pi.rs rename to hydro_test/src/cluster/compute_pi.rs index 0eff334e7160..ae649e7c00a4 100644 --- a/hydroflow_plus_test/src/cluster/compute_pi.rs +++ b/hydro_test/src/cluster/compute_pi.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use hydroflow_plus::*; +use hydro_lang::*; pub struct Worker {} pub struct Leader {} @@ -53,12 +53,12 @@ pub fn compute_pi<'a>( #[cfg(test)] mod tests { - use hydroflow_plus::deploy::DeployRuntime; + use hydro_lang::deploy::DeployRuntime; use stageleft::RuntimeData; #[test] fn compute_pi_ir() { - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let _ = super::compute_pi(&builder, 8192); let built = builder.with_default_optimize::(); diff --git a/hydroflow_plus_test/src/cluster/many_to_many.rs b/hydro_test/src/cluster/many_to_many.rs similarity index 92% rename from hydroflow_plus_test/src/cluster/many_to_many.rs rename to hydro_test/src/cluster/many_to_many.rs index 91cda6f10ca1..7f868e0a1c5e 100644 --- a/hydroflow_plus_test/src/cluster/many_to_many.rs +++ b/hydro_test/src/cluster/many_to_many.rs @@ -1,4 +1,4 @@ -use hydroflow_plus::*; +use hydro_lang::*; pub fn many_to_many<'a>(flow: &FlowBuilder<'a>) -> Cluster<'a, ()> { let cluster = flow.cluster(); @@ -13,13 +13,13 @@ pub fn many_to_many<'a>(flow: &FlowBuilder<'a>) -> Cluster<'a, ()> { #[cfg(test)] mod tests { use hydro_deploy::Deployment; - use hydroflow_plus::deploy::DeployCrateWrapper; + use hydro_lang::deploy::DeployCrateWrapper; #[tokio::test] async fn many_to_many() { let mut deployment = Deployment::new(); - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let cluster = super::many_to_many(&builder); let built = builder.with_default_optimize(); diff --git a/hydroflow_plus_test/src/cluster/map_reduce.rs b/hydro_test/src/cluster/map_reduce.rs similarity index 93% rename from hydroflow_plus_test/src/cluster/map_reduce.rs rename to hydro_test/src/cluster/map_reduce.rs index 42d72a221881..819df581958c 100644 --- a/hydroflow_plus_test/src/cluster/map_reduce.rs +++ b/hydro_test/src/cluster/map_reduce.rs @@ -1,4 +1,4 @@ -use hydroflow_plus::*; +use hydro_lang::*; pub struct Leader {} pub struct Worker {} @@ -43,12 +43,12 @@ pub fn map_reduce<'a>(flow: &FlowBuilder<'a>) -> (Process<'a, Leader>, Cluster<' #[cfg(test)] mod tests { - use hydroflow_plus::deploy::DeployRuntime; + use hydro_lang::deploy::DeployRuntime; use stageleft::RuntimeData; #[test] fn map_reduce_ir() { - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let _ = super::map_reduce(&builder); let built = builder.with_default_optimize::(); diff --git a/hydroflow_plus_test/src/cluster/mod.rs b/hydro_test/src/cluster/mod.rs similarity index 100% rename from hydroflow_plus_test/src/cluster/mod.rs rename to hydro_test/src/cluster/mod.rs diff --git a/hydroflow_plus_test/src/cluster/paxos.rs b/hydro_test/src/cluster/paxos.rs similarity index 99% rename from hydroflow_plus_test/src/cluster/paxos.rs rename to hydro_test/src/cluster/paxos.rs index 66b28264abac..0aeee3ee45bc 100644 --- a/hydroflow_plus_test/src/cluster/paxos.rs +++ b/hydro_test/src/cluster/paxos.rs @@ -3,9 +3,9 @@ use std::fmt::Debug; use std::hash::Hash; use std::time::Duration; -use hydroflow_plus::*; -use hydroflow_plus_std::quorum::{collect_quorum, collect_quorum_with_response}; -use hydroflow_plus_std::request_response::join_responses; +use hydro_lang::*; +use hydro_std::quorum::{collect_quorum, collect_quorum_with_response}; +use hydro_std::request_response::join_responses; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; diff --git a/hydroflow_plus_test/src/cluster/paxos_bench.rs b/hydro_test/src/cluster/paxos_bench.rs similarity index 97% rename from hydroflow_plus_test/src/cluster/paxos_bench.rs rename to hydro_test/src/cluster/paxos_bench.rs index 7517bd2cc943..52f6f5ebc752 100644 --- a/hydroflow_plus_test/src/cluster/paxos_bench.rs +++ b/hydro_test/src/cluster/paxos_bench.rs @@ -2,8 +2,8 @@ use std::cell::RefCell; use std::rc::Rc; use std::time::Duration; -use hydroflow_plus::*; -use hydroflow_plus_std::quorum::collect_quorum; +use hydro_lang::*; +use hydro_std::quorum::collect_quorum; use tokio::time::Instant; use super::paxos::{Acceptor, Ballot, Proposer}; @@ -236,7 +236,7 @@ fn bench_client<'a>( .flatten_ordered() .fold_commutative( // Create window with ring buffer using vec + wraparound index - // TODO: Would be nice if I could use vec![] instead, but that doesn't work in HF+ with RuntimeData *median_latency_window_size + // TODO: Would be nice if I could use vec![] instead, but that doesn't work in Hydro with RuntimeData *median_latency_window_size q!(move || ( Rc::new(RefCell::new(Vec::::with_capacity( median_latency_window_size @@ -302,16 +302,16 @@ fn bench_client<'a>( #[cfg(test)] mod tests { - use hydroflow_plus::deploy::DeployRuntime; + use hydro_lang::deploy::DeployRuntime; use stageleft::RuntimeData; #[test] fn paxos_ir() { - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let _ = super::paxos_bench(&builder, 1, 1, 1, 1, 1, 1, 1); let built = builder.with_default_optimize::(); - hydroflow_plus::ir::dbg_dedup_tee(|| { + hydro_lang::ir::dbg_dedup_tee(|| { insta::assert_debug_snapshot!(built.ir()); }); diff --git a/hydroflow_plus_test/src/cluster/paxos_kv.rs b/hydro_test/src/cluster/paxos_kv.rs similarity index 99% rename from hydroflow_plus_test/src/cluster/paxos_kv.rs rename to hydro_test/src/cluster/paxos_kv.rs index d157d67380d1..8a072017ef83 100644 --- a/hydroflow_plus_test/src/cluster/paxos_kv.rs +++ b/hydro_test/src/cluster/paxos_kv.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::fmt::Debug; use std::hash::Hash; -use hydroflow_plus::*; +use hydro_lang::*; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; diff --git a/hydroflow_plus_test/src/cluster/simple_cluster.rs b/hydro_test/src/cluster/simple_cluster.rs similarity index 95% rename from hydroflow_plus_test/src/cluster/simple_cluster.rs rename to hydro_test/src/cluster/simple_cluster.rs index 64b7e5045f9b..51339ee72ee4 100644 --- a/hydroflow_plus_test/src/cluster/simple_cluster.rs +++ b/hydro_test/src/cluster/simple_cluster.rs @@ -1,4 +1,4 @@ -use hydroflow_plus::*; +use hydro_lang::*; pub fn decouple_cluster<'a>(flow: &FlowBuilder<'a>) -> (Cluster<'a, ()>, Cluster<'a, ()>) { let cluster1 = flow.cluster(); @@ -48,13 +48,13 @@ pub fn simple_cluster<'a>(flow: &FlowBuilder<'a>) -> (Process<'a, ()>, Cluster<' #[cfg(test)] mod tests { use hydro_deploy::Deployment; - use hydroflow_plus::deploy::DeployCrateWrapper; + use hydro_lang::deploy::DeployCrateWrapper; #[tokio::test] async fn simple_cluster() { let mut deployment = Deployment::new(); - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let (node, cluster) = super::simple_cluster(&builder); let built = builder.with_default_optimize(); @@ -111,7 +111,7 @@ mod tests { async fn decouple_process() { let mut deployment = Deployment::new(); - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let (process1, process2) = super::decouple_process(&builder); let built = builder.with_default_optimize(); @@ -133,7 +133,7 @@ mod tests { async fn decouple_cluster() { let mut deployment = Deployment::new(); - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let (cluster1, cluster2) = super::decouple_cluster(&builder); let built = builder.with_default_optimize(); diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir.snap new file mode 100644 index 000000000000..e284ea819613 --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir.snap @@ -0,0 +1,72 @@ +--- +source: hydro_test/src/cluster/compute_pi.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < (u64 , u64) , () > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | (inside , total) | { println ! ("pi: {} ({} trials)" , 4.0 * inside as f64 / total as f64 , total) ; } }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((u64 , u64) , ()) , (u64 , u64) > ({ use hydro_lang :: __staged :: optional :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Reduce { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (u64 , u64) , (u64 , u64) , () > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | (inside , total) , (inside_batch , total_batch) | { * inside += inside_batch ; * total += total_batch ; } }), + input: Persist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: compute_pi :: Worker > , (u64 , u64)) , (u64 , u64) > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 0, + ), + from_key: None, + to_location: Process( + 1, + ), + to_key: None, + serialize_fn: Some( + | data | { hydro_lang :: runtime_support :: bincode :: serialize :: < (u64 , u64) > (& data) . unwrap () . into () }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: compute_pi :: Worker > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < (u64 , u64) > (& b) . unwrap ()) }, + ), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < (u64 , u64) > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | | (0u64 , 0u64) }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (u64 , u64) , bool , () > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | (inside , total) , sample_inside | { if sample_inside { * inside += 1 ; } * total += 1 ; } }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (f64 , f64) , bool > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | (x , y) | x * x + y * y < 1.0 }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , (f64 , f64) > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | _ | rand :: random :: < (f64 , f64) > () }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , () > ({ use hydro_lang :: __staged :: location :: tick :: * ; | _ | () }), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , std :: ops :: Range < usize > > ({ use hydro_lang :: __staged :: location :: tick :: * ; let batch_size__free = { use crate :: __staged :: cluster :: compute_pi :: * ; let batch_size__free = 8192usize ; batch_size__free } ; move | _ | 0 .. batch_size__free }), + input: Source { + source: Spin, + location_kind: Cluster( + 0, + ), + }, + }, + }, + }, + }, + }, + }, + }, + ), + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < tokio :: time :: Instant , () > ({ use hydro_lang :: __staged :: optional :: * ; | _u | () }), + input: Source { + source: Stream( + { use hydro_lang :: __staged :: location :: * ; let interval__free = { use crate :: __staged :: cluster :: compute_pi :: * ; Duration :: from_secs (1) } ; tokio_stream :: wrappers :: IntervalStream :: new (tokio :: time :: interval (interval__free)) }, + ), + location_kind: Process( + 1, + ), + }, + }, + ), + }, + }, +] diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_0.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_0.snap new file mode 100644 index 000000000000..e5ff9e12f278 --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_0.snap @@ -0,0 +1,20 @@ +--- +source: hydro_test/src/cluster/compute_pi.rs +expression: ir.surface_syntax_string() +--- +1v1 = spin (); +2v1 = flat_map (stageleft :: runtime_support :: fn1_type_hint :: < () , std :: ops :: Range < usize > > ({ use hydro_lang :: __staged :: location :: tick :: * ; let batch_size__free = { use crate :: __staged :: cluster :: compute_pi :: * ; let batch_size__free = 8192usize ; batch_size__free } ; move | _ | 0 .. batch_size__free })); +3v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < usize , () > ({ use hydro_lang :: __staged :: location :: tick :: * ; | _ | () })); +4v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < () , (f64 , f64) > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | _ | rand :: random :: < (f64 , f64) > () })); +5v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < (f64 , f64) , bool > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | (x , y) | x * x + y * y < 1.0 })); +6v1 = fold :: < 'tick > (stageleft :: runtime_support :: fn0_type_hint :: < (u64 , u64) > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | | (0u64 , 0u64) }) , stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (u64 , u64) , bool , () > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | (inside , total) , sample_inside | { if sample_inside { * inside += 1 ; } * total += 1 ; } })); +7v1 = map (| data | { hydro_lang :: runtime_support :: bincode :: serialize :: < (u64 , u64) > (& data) . unwrap () . into () }); +8v1 = dest_sink ({ use hydro_lang :: __staged :: deploy_runtime :: * ; let c1_port__free = "port_0" ; let env__free = FAKE ; { env__free . port (c1_port__free) . connect_local_blocking :: < ConnectedDirect > () . into_sink () } }); + +1v1 -> 2v1; +2v1 -> 3v1; +3v1 -> 4v1; +4v1 -> 5v1; +5v1 -> 6v1; +7v1 -> 8v1; +6v1 -> 7v1; diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_1.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_1.snap new file mode 100644 index 000000000000..ffeceb160d04 --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_1.snap @@ -0,0 +1,22 @@ +--- +source: hydro_test/src/cluster/compute_pi.rs +expression: ir.surface_syntax_string() +--- +1v1 = source_stream ({ use hydro_lang :: __staged :: deploy_runtime :: * ; let env__free = FAKE ; let p2_port__free = "port_0" ; { env__free . port (p2_port__free) . connect_local_blocking :: < ConnectedTagged < ConnectedDirect > > () . into_source () } }); +2v1 = map (| res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: compute_pi :: Worker > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < (u64 , u64) > (& b) . unwrap ()) }); +3v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: compute_pi :: Worker > , (u64 , u64)) , (u64 , u64) > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b })); +4v1 = reduce :: < 'static > (stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (u64 , u64) , (u64 , u64) , () > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | (inside , total) , (inside_batch , total_batch) | { * inside += inside_batch ; * total += total_batch ; } })); +5v1 = source_stream ({ use hydro_lang :: __staged :: location :: * ; let interval__free = { use crate :: __staged :: cluster :: compute_pi :: * ; Duration :: from_secs (1) } ; tokio_stream :: wrappers :: IntervalStream :: new (tokio :: time :: interval (interval__free)) }); +6v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < tokio :: time :: Instant , () > ({ use hydro_lang :: __staged :: optional :: * ; | _u | () })); +7v1 = cross_singleton (); +8v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < ((u64 , u64) , ()) , (u64 , u64) > ({ use hydro_lang :: __staged :: optional :: * ; | (d , _signal) | d })); +9v1 = for_each (stageleft :: runtime_support :: fn1_type_hint :: < (u64 , u64) , () > ({ use crate :: __staged :: cluster :: compute_pi :: * ; | (inside , total) | { println ! ("pi: {} ({} trials)" , 4.0 * inside as f64 / total as f64 , total) ; } })); + +1v1 -> 2v1; +2v1 -> 3v1; +3v1 -> 4v1; +5v1 -> 6v1; +4v1 -> 7v1; +6v1 -> 7v1; +7v1 -> 8v1; +8v1 -> 9v1; diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__many_to_many__tests__many_to_many.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__many_to_many__tests__many_to_many.snap new file mode 100644 index 000000000000..ebf8e1ad2786 --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__many_to_many__tests__many_to_many.snap @@ -0,0 +1,37 @@ +--- +source: hydro_test/src/cluster/many_to_many.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32) , () > ({ use crate :: __staged :: cluster :: many_to_many :: * ; | n | println ! ("cluster received: {:?}" , n) }), + input: Network { + from_location: Cluster( + 0, + ), + from_key: None, + to_location: Cluster( + 0, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , i32) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < i32 > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < () > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < i32 > (& b) . unwrap ()) }, + ), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < i32 , std :: iter :: Map < std :: slice :: Iter < hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > > , _ > > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < () > > > (__hydro_lang_cluster_ids_0) } ; | b | ids__free . iter () . map (move | id | (:: std :: clone :: Clone :: clone (id) , :: std :: clone :: Clone :: clone (& b))) }), + input: Source { + source: Iter( + { use crate :: __staged :: cluster :: many_to_many :: * ; 0 .. 2 }, + ), + location_kind: Cluster( + 0, + ), + }, + }, + }, + }, +] diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir.snap new file mode 100644 index 000000000000..1d18a502c2c7 --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir.snap @@ -0,0 +1,78 @@ +--- +source: hydro_test/src/cluster/map_reduce.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < (std :: string :: String , i32) , () > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | (string , count) | println ! ("{}: {}" , string , count) }), + input: ReduceKeyed { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < i32 , i32 , () > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | total , count | * total += count }), + input: Persist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: map_reduce :: Worker > , (std :: string :: String , i32)) , (std :: string :: String , i32) > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 1, + ), + from_key: None, + to_location: Process( + 0, + ), + to_key: None, + serialize_fn: Some( + | data | { hydro_lang :: runtime_support :: bincode :: serialize :: < (std :: string :: String , i32) > (& data) . unwrap () . into () }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: map_reduce :: Worker > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < (std :: string :: String , i32) > (& b) . unwrap ()) }, + ), + input: Inspect { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < (std :: string :: String , i32) , () > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | (string , count) | println ! ("partition count: {} - {}" , string , count) }), + input: FoldKeyed { + init: stageleft :: runtime_support :: fn0_type_hint :: < i32 > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | | 0 }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < i32 , () , () > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | count , _ | * count += 1 }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < std :: string :: String , (std :: string :: String , ()) > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | string | (string , ()) }), + input: Network { + from_location: Process( + 0, + ), + from_key: None, + to_location: Cluster( + 1, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , std :: string :: String) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < std :: string :: String > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { hydro_lang :: runtime_support :: bincode :: deserialize :: < std :: string :: String > (& res . unwrap ()) . unwrap () }, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , std :: string :: String) , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: map_reduce :: Worker > , std :: string :: String) > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < hydro_test :: cluster :: map_reduce :: Worker > > > (__hydro_lang_cluster_ids_1) } ; | (i , w) | (ids__free [i % ids__free . len ()] , w) }), + input: Enumerate { + is_static: true, + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < & str , std :: string :: String > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | s | s . to_string () }), + input: Source { + source: Iter( + { use crate :: __staged :: cluster :: map_reduce :: * ; vec ! ["abc" , "abc" , "xyz" , "abc"] }, + ), + location_kind: Process( + 0, + ), + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + ), + }, + }, +] diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_0.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_0.snap new file mode 100644 index 000000000000..e45bca3cc7be --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_0.snap @@ -0,0 +1,25 @@ +--- +source: hydro_test/src/cluster/map_reduce.rs +expression: ir.surface_syntax_string() +--- +1v1 = source_iter ({ use crate :: __staged :: cluster :: map_reduce :: * ; vec ! ["abc" , "abc" , "xyz" , "abc"] }); +2v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < & str , std :: string :: String > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | s | s . to_string () })); +3v1 = enumerate :: < 'static > (); +4v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < (usize , std :: string :: String) , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: map_reduce :: Worker > , std :: string :: String) > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < hydro_test :: cluster :: map_reduce :: Worker > > > (__hydro_lang_cluster_ids_1) } ; | (i , w) | (ids__free [i % ids__free . len ()] , w) })); +5v1 = map (| (id , data) : (hydro_lang :: ClusterId < _ > , std :: string :: String) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < std :: string :: String > (& data) . unwrap () . into ()) }); +6v1 = dest_sink ({ use hydro_lang :: __staged :: deploy_runtime :: * ; let env__free = FAKE ; let p1_port__free = "port_0" ; { env__free . port (p1_port__free) . connect_local_blocking :: < ConnectedDemux < ConnectedDirect > > () . into_sink () } }); +7v1 = source_stream ({ use hydro_lang :: __staged :: deploy_runtime :: * ; let env__free = FAKE ; let p2_port__free = "port_1" ; { env__free . port (p2_port__free) . connect_local_blocking :: < ConnectedTagged < ConnectedDirect > > () . into_source () } }); +8v1 = map (| res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: map_reduce :: Worker > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < (std :: string :: String , i32) > (& b) . unwrap ()) }); +9v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: map_reduce :: Worker > , (std :: string :: String , i32)) , (std :: string :: String , i32) > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b })); +10v1 = reduce_keyed :: < 'static > (stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < i32 , i32 , () > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | total , count | * total += count })); +11v1 = for_each (stageleft :: runtime_support :: fn1_type_hint :: < (std :: string :: String , i32) , () > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | (string , count) | println ! ("{}: {}" , string , count) })); + +1v1 -> 2v1; +2v1 -> 3v1; +3v1 -> 4v1; +5v1 -> 6v1; +4v1 -> 5v1; +7v1 -> 8v1; +8v1 -> 9v1; +9v1 -> 10v1; +10v1 -> 11v1; diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_1.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_1.snap new file mode 100644 index 000000000000..b12a283a98ca --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_1.snap @@ -0,0 +1,18 @@ +--- +source: hydro_test/src/cluster/map_reduce.rs +expression: ir.surface_syntax_string() +--- +1v1 = source_stream ({ use hydro_lang :: __staged :: deploy_runtime :: * ; let c2_port__free = "port_0" ; let env__free = FAKE ; { env__free . port (c2_port__free) . connect_local_blocking :: < ConnectedDirect > () . into_source () } }); +2v1 = map (| res | { hydro_lang :: runtime_support :: bincode :: deserialize :: < std :: string :: String > (& res . unwrap ()) . unwrap () }); +3v1 = map (stageleft :: runtime_support :: fn1_type_hint :: < std :: string :: String , (std :: string :: String , ()) > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | string | (string , ()) })); +4v1 = fold_keyed :: < 'tick > (stageleft :: runtime_support :: fn0_type_hint :: < i32 > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | | 0 }) , stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < i32 , () , () > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | count , _ | * count += 1 })); +5v1 = inspect (stageleft :: runtime_support :: fn1_borrow_type_hint :: < (std :: string :: String , i32) , () > ({ use crate :: __staged :: cluster :: map_reduce :: * ; | (string , count) | println ! ("partition count: {} - {}" , string , count) })); +6v1 = map (| data | { hydro_lang :: runtime_support :: bincode :: serialize :: < (std :: string :: String , i32) > (& data) . unwrap () . into () }); +7v1 = dest_sink ({ use hydro_lang :: __staged :: deploy_runtime :: * ; let c1_port__free = "port_1" ; let env__free = FAKE ; { env__free . port (c1_port__free) . connect_local_blocking :: < ConnectedDirect > () . into_sink () } }); + +1v1 -> 2v1; +2v1 -> 3v1; +3v1 -> 4v1; +4v1 -> 5v1; +6v1 -> 7v1; +5v1 -> 6v1; diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__paxos_bench__tests__paxos_ir.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__paxos_bench__tests__paxos_ir.snap new file mode 100644 index 000000000000..ae6f6068a1fe --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__paxos_bench__tests__paxos_ir.snap @@ -0,0 +1,1588 @@ +--- +source: hydro_test/src/cluster/paxos_bench.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < & str , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | s | println ! ("{}" , s) }), + input: Source { + source: Iter( + { use crate :: __staged :: cluster :: paxos :: * ; ["Proposers say hello"] }, + ), + location_kind: Cluster( + 0, + ), + }, + }, + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < & str , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | s | println ! ("{}" , s) }), + input: Source { + source: Iter( + { use crate :: __staged :: cluster :: paxos :: * ; ["Acceptors say hello"] }, + ), + location_kind: Cluster( + 1, + ), + }, + }, + CycleSink { + ident: Ident { + sym: cycle_4, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + input: DeferTick( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , u32) , u32 > ({ use crate :: __staged :: cluster :: paxos :: * ; let CLUSTER_SELF_ID__free = hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Proposer > :: from_raw (__hydro_lang_cluster_self_id_0) ; move | (received_max_ballot , ballot_num) | { if received_max_ballot > (Ballot { num : ballot_num , proposer_id : CLUSTER_SELF_ID__free , }) { received_max_ballot . num + 1 } else { ballot_num } } }), + input: CrossSingleton( + Tee { + inner: : Chain( + Reduce { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , hydro_test :: cluster :: paxos :: Ballot , () > ({ use hydro_lang :: __staged :: stream :: * ; | curr , new | { if new > * curr { * curr = new ; } } }), + input: Persist( + Chain( + Chain( + CycleSource { + ident: Ident { + sym: cycle_1, + }, + location_kind: Cluster( + 0, + ), + }, + CycleSource { + ident: Ident { + sym: cycle_0, + }, + location_kind: Cluster( + 0, + ), + }, + ), + CycleSource { + ident: Ident { + sym: cycle_2, + }, + location_kind: Cluster( + 0, + ), + }, + ), + ), + }, + Persist( + Source { + source: Iter( + { use hydro_lang :: __staged :: location :: * ; let e__free = { use crate :: __staged :: cluster :: paxos :: * ; Ballot { num : 0 , proposer_id : ClusterId :: from_raw (0) } } ; [e__free] }, + ), + location_kind: Cluster( + 0, + ), + }, + ), + ), + }, + Tee { + inner: : Chain( + CycleSource { + ident: Ident { + sym: cycle_4, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + }, + Persist( + Source { + source: Iter( + { use hydro_lang :: __staged :: location :: * ; let e__free = { use crate :: __staged :: cluster :: paxos :: * ; 0 } ; [e__free] }, + ), + location_kind: Cluster( + 0, + ), + }, + ), + ), + }, + ), + }, + ), + }, + CycleSink { + ident: Ident { + sym: cycle_2, + }, + location_kind: Cluster( + 0, + ), + input: Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , hydro_test :: cluster :: paxos :: Ballot) , hydro_test :: cluster :: paxos :: Ballot > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 0, + ), + from_key: None, + to_location: Cluster( + 0, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , hydro_test :: cluster :: paxos :: Ballot) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < hydro_test :: cluster :: paxos :: Ballot > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Proposer > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < hydro_test :: cluster :: paxos :: Ballot > (& b) . unwrap ()) }, + ), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , std :: iter :: Map < std :: slice :: Iter < hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > > , _ > > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > > > (__hydro_lang_cluster_ids_0) } ; | b | ids__free . iter () . map (move | id | (:: std :: clone :: Clone :: clone (id) , :: std :: clone :: Clone :: clone (& b))) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , ()) , hydro_test :: cluster :: paxos :: Ballot > ({ use hydro_lang :: __staged :: optional :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , ()) , hydro_test :: cluster :: paxos :: Ballot > ({ use hydro_lang :: __staged :: singleton :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < u32 , hydro_test :: cluster :: paxos :: Ballot > ({ use crate :: __staged :: cluster :: paxos :: * ; let CLUSTER_SELF_ID__free = hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Proposer > :: from_raw (__hydro_lang_cluster_self_id_0) ; move | num | Ballot { num , proposer_id : CLUSTER_SELF_ID__free } }), + input: Tee { + inner: , + }, + }, + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , () > ({ use hydro_lang :: __staged :: singleton :: * ; | _u | () }), + input: Tee { + inner: : CycleSource { + ident: Ident { + sym: cycle_3, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + }, + }, + }, + ), + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < tokio :: time :: Instant , () > ({ use hydro_lang :: __staged :: optional :: * ; | _u | () }), + input: Source { + source: Stream( + { use hydro_lang :: __staged :: location :: * ; let interval__free = { use crate :: __staged :: cluster :: paxos :: * ; let i_am_leader_send_timeout__free = 1u64 ; Duration :: from_secs (i_am_leader_send_timeout__free) } ; tokio_stream :: wrappers :: IntervalStream :: new (tokio :: time :: interval (interval__free)) }, + ), + location_kind: Cluster( + 0, + ), + }, + }, + ), + }, + }, + }, + }, + }, + }, + CycleSink { + ident: Ident { + sym: cycle_6, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + input: DeferTick( + Difference( + FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , (usize , usize)) , core :: option :: Option < hydro_test :: cluster :: paxos :: Ballot > > ({ use hydro_std :: __staged :: quorum :: * ; let min__free = 2usize ; move | (key , (success , _error)) | if success >= min__free { Some (key) } else { None } }), + input: Tee { + inner: : FoldKeyed { + init: stageleft :: runtime_support :: fn0_type_hint :: < (usize , usize) > ({ use hydro_std :: __staged :: quorum :: * ; move | | (0 , 0) }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (usize , usize) , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot > , () > ({ use hydro_std :: __staged :: quorum :: * ; move | accum , value | { if value . is_ok () { accum . 0 += 1 ; } else { accum . 1 += 1 ; } } }), + input: Tee { + inner: : Chain( + CycleSource { + ident: Ident { + sym: cycle_5, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + }, + Tee { + inner: : Inspect { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >) , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | p1b | println ! ("Proposer received P1b: {:?}" , p1b) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Acceptor > , (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >)) , (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >) > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 1, + ), + from_key: None, + to_location: Cluster( + 0, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >)) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >) > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Acceptor > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >) > (& b) . unwrap ()) }, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((hydro_test :: cluster :: paxos :: Ballot , hydro_test :: cluster :: paxos :: Ballot) , std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > >) , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >)) > ({ use crate :: __staged :: cluster :: paxos :: * ; | ((ballot , max_ballot) , log) | (ballot . proposer_id , (ballot , if ballot == max_ballot { Ok (log) } else { Err (max_ballot) })) }), + input: CrossSingleton( + CrossSingleton( + Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , hydro_test :: cluster :: paxos :: Ballot) , hydro_test :: cluster :: paxos :: Ballot > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 0, + ), + from_key: None, + to_location: Cluster( + 1, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , hydro_test :: cluster :: paxos :: Ballot) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < hydro_test :: cluster :: paxos :: Ballot > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Proposer > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < hydro_test :: cluster :: paxos :: Ballot > (& b) . unwrap ()) }, + ), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , std :: iter :: Map < std :: slice :: Iter < hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Acceptor > > , _ > > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < hydro_test :: cluster :: paxos :: Acceptor > > > (__hydro_lang_cluster_ids_1) } ; | b | ids__free . iter () . map (move | id | (:: std :: clone :: Clone :: clone (id) , :: std :: clone :: Clone :: clone (& b))) }), + input: Inspect { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | _ | println ! ("Proposer leader expired, sending P1a") }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , ()) , hydro_test :: cluster :: paxos :: Ballot > ({ use hydro_lang :: __staged :: singleton :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Tee { + inner: , + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , () > ({ use hydro_lang :: __staged :: singleton :: * ; | _u | () }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (() , ()) , () > ({ use hydro_lang :: __staged :: optional :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (() , ()) , () > ({ use hydro_lang :: __staged :: optional :: * ; | (d , _signal) | d }), + input: CrossSingleton( + FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < core :: option :: Option < tokio :: time :: Instant > , core :: option :: Option < () > > ({ use hydro_lang :: __staged :: stream :: * ; let duration__free = { use crate :: __staged :: cluster :: paxos :: * ; let i_am_leader_check_timeout__free = 1u64 ; Duration :: from_secs (i_am_leader_check_timeout__free) } ; move | latest_received | { if let Some (latest_received) = latest_received { if Instant :: now () . duration_since (latest_received) > duration__free { Some (()) } else { None } } else { Some (()) } } }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < core :: option :: Option < tokio :: time :: Instant > > ({ use hydro_lang :: __staged :: stream :: * ; | | None }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < core :: option :: Option < tokio :: time :: Instant > , hydro_test :: cluster :: paxos :: Ballot , () > ({ use hydro_lang :: __staged :: stream :: * ; | latest , _ | { * latest = Some (Instant :: now ()) ; } }), + input: Persist( + Tee { + inner: , + }, + ), + }, + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , () > ({ use hydro_lang :: __staged :: optional :: * ; | _u | () }), + input: Filter { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < usize , bool > ({ use hydro_lang :: __staged :: optional :: * ; | c | * c == 0 }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < usize > ({ use hydro_lang :: __staged :: stream :: * ; | | 0usize }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , () , () > ({ use hydro_lang :: __staged :: stream :: * ; | count , _ | * count += 1 }), + input: Tee { + inner: , + }, + }, + }, + }, + ), + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < tokio :: time :: Instant , () > ({ use hydro_lang :: __staged :: optional :: * ; | _u | () }), + input: Source { + source: Stream( + { use hydro_lang :: __staged :: location :: * ; let delay__free = { use crate :: __staged :: cluster :: paxos :: * ; let CLUSTER_SELF_ID__free = hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Proposer > :: from_raw (__hydro_lang_cluster_self_id_0) ; let i_am_leader_check_timeout_delay_multiplier__free = 1usize ; Duration :: from_secs ((CLUSTER_SELF_ID__free . raw_id * i_am_leader_check_timeout_delay_multiplier__free as u32) . into ()) } ; let interval__free = { use crate :: __staged :: cluster :: paxos :: * ; let i_am_leader_check_timeout__free = 1u64 ; Duration :: from_secs (i_am_leader_check_timeout__free) } ; tokio_stream :: wrappers :: IntervalStream :: new (tokio :: time :: interval_at (tokio :: time :: Instant :: now () + delay__free , interval__free)) }, + ), + location_kind: Cluster( + 0, + ), + }, + }, + ), + }, + }, + ), + }, + }, + }, + }, + }, + }, + Tee { + inner: : Chain( + Reduce { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , hydro_test :: cluster :: paxos :: Ballot , () > ({ use hydro_lang :: __staged :: stream :: * ; | curr , new | { if new > * curr { * curr = new ; } } }), + input: Persist( + Inspect { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | p1a | println ! ("Acceptor received P1a: {:?}" , p1a) }), + input: Tee { + inner: , + }, + }, + ), + }, + Persist( + Source { + source: Iter( + { use hydro_lang :: __staged :: location :: * ; let e__free = { use crate :: __staged :: cluster :: paxos :: * ; Ballot { num : 0 , proposer_id : ClusterId :: from_raw (0) } } ; [e__free] }, + ), + location_kind: Cluster( + 1, + ), + }, + ), + ), + }, + ), + CycleSource { + ident: Ident { + sym: cycle_0, + }, + location_kind: Tick( + 3, + Cluster( + 1, + ), + ), + }, + ), + }, + }, + }, + }, + }, + ), + }, + }, + }, + }, + Tee { + inner: : FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , (usize , usize)) , core :: option :: Option < hydro_test :: cluster :: paxos :: Ballot > > ({ use hydro_std :: __staged :: quorum :: * ; let max__free = 3usize ; move | (key , (success , error)) | if (success + error) >= max__free { Some (key) } else { None } }), + input: Tee { + inner: , + }, + }, + }, + ), + ), + }, + CycleSink { + ident: Ident { + sym: cycle_5, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + input: DeferTick( + AntiJoin( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + ), + }, + CycleSink { + ident: Ident { + sym: cycle_3, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + input: Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (() , ()) , () > ({ use hydro_lang :: __staged :: optional :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < std :: vec :: Vec < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | _ | () }), + input: Tee { + inner: : FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((hydro_test :: cluster :: paxos :: Ballot , std :: vec :: Vec < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > >) , hydro_test :: cluster :: paxos :: Ballot) , core :: option :: Option < std :: vec :: Vec < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > > > ({ use crate :: __staged :: cluster :: paxos :: * ; move | ((quorum_ballot , quorum_accepted) , my_ballot) | if quorum_ballot == my_ballot { Some (quorum_accepted) } else { None } }), + input: CrossSingleton( + Reduce { + f: { let key_fn = stageleft :: runtime_support :: fn1_borrow_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , std :: vec :: Vec < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > >) , hydro_test :: cluster :: paxos :: Ballot > ({ use crate :: __staged :: cluster :: paxos :: * ; | t | t . 0 }) ; move | curr , new | { if key_fn (& new) > key_fn (& * curr) { * curr = new ; } } }, + input: FoldKeyed { + init: stageleft :: runtime_support :: fn0_type_hint :: < std :: vec :: Vec < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > > ({ use crate :: __staged :: cluster :: paxos :: * ; | | vec ! [] }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < std :: vec :: Vec < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > , std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | logs , log | { logs . push (log) ; } }), + input: Persist( + FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >) , core :: option :: Option < (hydro_test :: cluster :: paxos :: Ballot , std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > >) > > ({ use hydro_std :: __staged :: quorum :: * ; move | (key , res) | match res { Ok (v) => Some ((key , v)) , Err (_) => None , } }), + input: AntiJoin( + AntiJoin( + Tee { + inner: , + }, + FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , (usize , usize)) , core :: option :: Option < hydro_test :: cluster :: paxos :: Ballot > > ({ use hydro_std :: __staged :: quorum :: * ; let min__free = 2usize ; move | (key , (success , _error)) | if success < min__free { Some (key) } else { None } }), + input: Tee { + inner: , + }, + }, + ), + CycleSource { + ident: Ident { + sym: cycle_6, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + }, + ), + }, + ), + }, + }, + Tee { + inner: , + }, + ), + }, + }, + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , () > ({ use hydro_lang :: __staged :: optional :: * ; | _u | () }), + input: Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , hydro_test :: cluster :: paxos :: Ballot) , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | _ | () }), + input: Filter { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , hydro_test :: cluster :: paxos :: Ballot) , bool > ({ use crate :: __staged :: cluster :: paxos :: * ; | (received_max_ballot , cur_ballot) | * received_max_ballot <= * cur_ballot }), + input: CrossSingleton( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + }, + }, + }, + }, + ), + }, + }, + }, + CycleSink { + ident: Ident { + sym: cycle_1, + }, + location_kind: Cluster( + 0, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , hydro_test :: cluster :: paxos :: Ballot) , hydro_test :: cluster :: paxos :: Ballot > ({ use crate :: __staged :: cluster :: paxos :: * ; | (_ , ballot) | ballot }), + input: FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , core :: result :: Result < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , hydro_test :: cluster :: paxos :: Ballot >) , core :: option :: Option < (hydro_test :: cluster :: paxos :: Ballot , hydro_test :: cluster :: paxos :: Ballot) > > ({ use hydro_std :: __staged :: quorum :: * ; move | (key , res) | match res { Ok (_) => None , Err (e) => Some ((key , e)) , } }), + input: Tee { + inner: , + }, + }, + }, + }, + CycleSink { + ident: Ident { + sym: cycle_7, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + input: DeferTick( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , usize) , usize > ({ use crate :: __staged :: cluster :: paxos :: * ; | (num_payloads , base_slot) | base_slot + num_payloads }), + input: CrossSingleton( + Tee { + inner: : Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < usize > ({ use hydro_lang :: __staged :: stream :: * ; | | 0usize }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , (usize , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) , () > ({ use hydro_lang :: __staged :: stream :: * ; | count , _ | * count += 1 }), + input: Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) , usize) , (usize , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) > ({ use crate :: __staged :: cluster :: paxos :: * ; | ((index , payload) , base_slot) | (base_slot + index , payload) }), + input: CrossSingleton( + Enumerate { + is_static: false, + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , ()) , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > ({ use hydro_lang :: __staged :: stream :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 2, + ), + from_key: None, + to_location: Cluster( + 0, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos_bench :: Client > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > (& b) . unwrap ()) }, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((u32 , u32) , hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer >) , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; let CLUSTER_SELF_ID__free = hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos_bench :: Client > :: from_raw (__hydro_lang_cluster_self_id_2) ; move | ((key , value) , leader_id) | (leader_id , KvPayload { key , value : (CLUSTER_SELF_ID__free , value) }) }), + input: CrossSingleton( + CycleSource { + ident: Ident { + sym: cycle_1, + }, + location_kind: Cluster( + 2, + ), + }, + Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | ballot : Ballot | ballot . proposer_id }), + input: Reduce { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , hydro_test :: cluster :: paxos :: Ballot , () > ({ use hydro_lang :: __staged :: stream :: * ; | curr , new | { if new > * curr { * curr = new ; } } }), + input: Persist( + Inspect { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , () > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | ballot | println ! ("Client notified that leader was elected: {:?}" , ballot) }), + input: CycleSource { + ident: Ident { + sym: cycle_0, + }, + location_kind: Cluster( + 2, + ), + }, + }, + ), + }, + }, + }, + ), + }, + }, + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , () > ({ use hydro_lang :: __staged :: stream :: * ; | _u | () }), + input: Tee { + inner: , + }, + }, + ), + }, + }, + Tee { + inner: : Chain( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , usize > ({ use crate :: __staged :: cluster :: paxos :: * ; | max_slot | max_slot + 1 }), + input: Tee { + inner: : Reduce { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , usize , () > ({ use hydro_lang :: __staged :: stream :: * ; | curr , new | { if new > * curr { * curr = new ; } } }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , (usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >)) , usize > ({ use crate :: __staged :: cluster :: paxos :: * ; | (slot , _) | slot }), + input: Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , (usize , core :: option :: Option < hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > >)) , (usize , (usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >)) > ({ use crate :: __staged :: cluster :: paxos :: * ; | (slot , (count , entry)) | (slot , (count , entry . unwrap ())) }), + input: FoldKeyed { + init: stageleft :: runtime_support :: fn0_type_hint :: < (usize , core :: option :: Option < hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > >) > ({ use crate :: __staged :: cluster :: paxos :: * ; | | (0 , None) }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (usize , core :: option :: Option < hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > >) , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | curr_entry , new_entry | { if let Some (curr_entry_payload) = & mut curr_entry . 1 { let same_values = new_entry . value == curr_entry_payload . value ; let higher_ballot = new_entry . ballot > curr_entry_payload . ballot ; if same_values { curr_entry . 0 += 1 ; } if higher_ballot { curr_entry_payload . ballot = new_entry . ballot ; if ! same_values { curr_entry . 0 = 1 ; curr_entry_payload . value = new_entry . value ; } } } else { * curr_entry = (1 , Some (new_entry)) ; } } }), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > , std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > ({ use hydro_lang :: __staged :: stream :: * ; | d | d }), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < std :: vec :: Vec < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > , std :: vec :: Vec < std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > > ({ use hydro_lang :: __staged :: optional :: * ; | v | v }), + input: Tee { + inner: , + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + Chain( + CycleSource { + ident: Ident { + sym: cycle_7, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + }, + Persist( + Source { + source: Iter( + { use hydro_lang :: __staged :: location :: * ; let e__free = { use crate :: __staged :: cluster :: paxos :: * ; 0 } ; [e__free] }, + ), + location_kind: Cluster( + 0, + ), + }, + ), + ), + ), + }, + ), + }, + }, + }, + }, + Tee { + inner: , + }, + ), + }, + ), + }, + CycleSink { + ident: Ident { + sym: cycle_9, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + input: DeferTick( + Difference( + Tee { + inner: : FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , (usize , usize)) , core :: option :: Option < (usize , hydro_test :: cluster :: paxos :: Ballot) > > ({ use hydro_std :: __staged :: quorum :: * ; let min__free = 2usize ; move | (key , (success , _error)) | if success >= min__free { Some (key) } else { None } }), + input: Tee { + inner: : FoldKeyed { + init: stageleft :: runtime_support :: fn0_type_hint :: < (usize , usize) > ({ use hydro_std :: __staged :: quorum :: * ; move | | (0 , 0) }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (usize , usize) , core :: result :: Result < () , hydro_test :: cluster :: paxos :: Ballot > , () > ({ use hydro_std :: __staged :: quorum :: * ; move | accum , value | { if value . is_ok () { accum . 0 += 1 ; } else { accum . 1 += 1 ; } } }), + input: Tee { + inner: : Chain( + CycleSource { + ident: Ident { + sym: cycle_8, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + }, + Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Acceptor > , ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: result :: Result < () , hydro_test :: cluster :: paxos :: Ballot >)) , ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: result :: Result < () , hydro_test :: cluster :: paxos :: Ballot >) > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 1, + ), + from_key: None, + to_location: Cluster( + 0, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: result :: Result < () , hydro_test :: cluster :: paxos :: Ballot >)) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: result :: Result < () , hydro_test :: cluster :: paxos :: Ballot >) > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Acceptor > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: result :: Result < () , hydro_test :: cluster :: paxos :: Ballot >) > (& b) . unwrap ()) }, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , hydro_test :: cluster :: paxos :: Ballot) , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: result :: Result < () , hydro_test :: cluster :: paxos :: Ballot >)) > ({ use crate :: __staged :: cluster :: paxos :: * ; | (p2a , max_ballot) | (p2a . ballot . proposer_id , ((p2a . slot , p2a . ballot) , if p2a . ballot == max_ballot { Ok (()) } else { Err (max_ballot) })) }), + input: CrossSingleton( + Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) , hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 0, + ), + from_key: None, + to_location: Cluster( + 1, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Proposer > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > (& b) . unwrap ()) }, + ), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , std :: iter :: Map < std :: slice :: Iter < hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Acceptor > > , _ > > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < hydro_test :: cluster :: paxos :: Acceptor > > > (__hydro_lang_cluster_ids_1) } ; | b | ids__free . iter () . map (move | id | (:: std :: clone :: Clone :: clone (id) , :: std :: clone :: Clone :: clone (& b))) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) , hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > ({ use crate :: __staged :: cluster :: paxos :: * ; | ((slot , ballot) , value) | P2a { ballot , slot , value } }), + input: Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) , ()) , ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) > ({ use hydro_lang :: __staged :: stream :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Chain( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) , hydro_test :: cluster :: paxos :: Ballot) , ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) > ({ use crate :: __staged :: cluster :: paxos :: * ; | ((slot , payload) , ballot) | ((slot , ballot) , Some (payload)) }), + input: CrossSingleton( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) > ({ use crate :: __staged :: cluster :: paxos :: * ; | p2a | ((p2a . slot , p2a . ballot) , p2a . value) }), + input: Chain( + FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , (usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >)) , hydro_test :: cluster :: paxos :: Ballot) , core :: option :: Option < hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > ({ use crate :: __staged :: cluster :: paxos :: * ; let f__free = 1usize ; move | ((slot , (count , entry)) , ballot) | { if count <= f__free { Some (P2a { ballot , slot , value : entry . value , }) } else { None } } }), + input: CrossSingleton( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , hydro_test :: cluster :: paxos :: Ballot) , hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > ({ use crate :: __staged :: cluster :: paxos :: * ; | (slot , ballot) | P2a { ballot , slot , value : None } }), + input: CrossSingleton( + Difference( + FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , std :: ops :: Range < usize > > ({ use crate :: __staged :: cluster :: paxos :: * ; | max_slot | 0 .. max_slot }), + input: Tee { + inner: , + }, + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , (usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >)) , usize > ({ use crate :: __staged :: cluster :: paxos :: * ; | (slot , _) | slot }), + input: Tee { + inner: , + }, + }, + ), + Tee { + inner: , + }, + ), + }, + ), + }, + ), + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , () > ({ use hydro_lang :: __staged :: stream :: * ; | _u | () }), + input: Tee { + inner: , + }, + }, + ), + }, + }, + }, + }, + }, + }, + }, + Tee { + inner: , + }, + ), + }, + }, + }, + }, + ), + }, + }, + }, + }, + }, + Tee { + inner: : FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , (usize , usize)) , core :: option :: Option < (usize , hydro_test :: cluster :: paxos :: Ballot) > > ({ use hydro_std :: __staged :: quorum :: * ; let max__free = 3usize ; move | (key , (success , error)) | if (success + error) >= max__free { Some (key) } else { None } }), + input: Tee { + inner: , + }, + }, + }, + ), + ), + }, + CycleSink { + ident: Ident { + sym: cycle_8, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + input: DeferTick( + AntiJoin( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + ), + }, + CycleSink { + ident: Ident { + sym: cycle_10, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + input: DeferTick( + AntiJoin( + Tee { + inner: : Chain( + CycleSource { + ident: Ident { + sym: cycle_10, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + }, + Tee { + inner: , + }, + ), + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , ()) , (usize , hydro_test :: cluster :: paxos :: Ballot) > ({ use hydro_std :: __staged :: request_response :: * ; | (key , _) | key }), + input: Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , hydro_test :: cluster :: paxos :: Ballot) , ((usize , hydro_test :: cluster :: paxos :: Ballot) , ()) > ({ use crate :: __staged :: cluster :: paxos :: * ; | k | (k , ()) }), + input: Difference( + Tee { + inner: , + }, + CycleSource { + ident: Ident { + sym: cycle_9, + }, + location_kind: Tick( + 2, + Cluster( + 0, + ), + ), + }, + ), + }, + }, + }, + ), + ), + }, + CycleSink { + ident: Ident { + sym: cycle_0, + }, + location_kind: Tick( + 3, + Cluster( + 1, + ), + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (core :: option :: Option < usize > , std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > >) , std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > ({ use crate :: __staged :: cluster :: paxos :: * ; | (_ckpnt , log) | log }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < (core :: option :: Option < usize > , std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > >) > ({ use crate :: __staged :: cluster :: paxos :: * ; | | (None , HashMap :: new ()) }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (core :: option :: Option < usize > , std :: collections :: hash_map :: HashMap < usize , hydro_test :: cluster :: paxos :: LogValue < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > >) , hydro_test :: cluster :: paxos :: CheckpointOrP2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | (prev_checkpoint , log) , checkpoint_or_p2a | { match checkpoint_or_p2a { CheckpointOrP2a :: Checkpoint (new_checkpoint) => { if prev_checkpoint . map (| prev | new_checkpoint > prev) . unwrap_or (true) { for slot in (prev_checkpoint . unwrap_or (0)) .. new_checkpoint { log . remove (& slot) ; } * prev_checkpoint = Some (new_checkpoint) ; } } CheckpointOrP2a :: P2a (p2a) => { if prev_checkpoint . map (| prev | p2a . slot > prev) . unwrap_or (true) && log . get (& p2a . slot) . map (| prev_p2a : & LogValue < _ > | p2a . ballot > prev_p2a . ballot) . unwrap_or (true) { log . insert (p2a . slot , LogValue { ballot : p2a . ballot , value : p2a . value , } ,) ; } } } } }), + input: Persist( + Chain( + FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: P2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , hydro_test :: cluster :: paxos :: Ballot) , core :: option :: Option < hydro_test :: cluster :: paxos :: CheckpointOrP2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > > ({ use crate :: __staged :: cluster :: paxos :: * ; | (p2a , max_ballot) | if p2a . ballot >= max_ballot { Some (CheckpointOrP2a :: P2a (p2a)) } else { None } }), + input: CrossSingleton( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , hydro_test :: cluster :: paxos :: CheckpointOrP2a < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > ({ use crate :: __staged :: cluster :: paxos :: * ; | min_seq | CheckpointOrP2a :: Checkpoint (min_seq) }), + input: Delta( + Reduce { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , usize , () > ({ use hydro_lang :: __staged :: stream :: * ; | curr , new | { if new < * curr { * curr = new ; } } }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_kv :: Replica > , usize) , usize > ({ use crate :: __staged :: cluster :: paxos :: * ; | (_sender , seq) | seq }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_kv :: Replica > , usize) , ()) , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_kv :: Replica > , usize) > ({ use hydro_lang :: __staged :: stream :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Tee { + inner: : ReduceKeyed { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , usize , () > ({ use crate :: __staged :: cluster :: paxos :: * ; | curr_seq , seq | { if seq > * curr_seq { * curr_seq = seq ; } } }), + input: Persist( + Network { + from_location: Cluster( + 3, + ), + from_key: None, + to_location: Cluster( + 1, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , usize) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < usize > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos_kv :: Replica > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < usize > (& b) . unwrap ()) }, + ), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , std :: iter :: Map < std :: slice :: Iter < hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Acceptor > > , _ > > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < hydro_test :: cluster :: paxos :: Acceptor > > > (__hydro_lang_cluster_ids_1) } ; | b | ids__free . iter () . map (move | id | (:: std :: clone :: Clone :: clone (id) , :: std :: clone :: Clone :: clone (& b))) }), + input: CycleSource { + ident: Ident { + sym: cycle_0, + }, + location_kind: Cluster( + 3, + ), + }, + }, + }, + ), + }, + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < bool , () > ({ use hydro_lang :: __staged :: stream :: * ; | _u | () }), + input: FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , core :: option :: Option < bool > > ({ use crate :: __staged :: cluster :: paxos :: * ; let f__free = 1usize ; move | num_received | if num_received == f__free + 1 { Some (true) } else { None } }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < usize > ({ use hydro_lang :: __staged :: stream :: * ; | | 0usize }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_kv :: Replica > , usize) , () > ({ use hydro_lang :: __staged :: stream :: * ; | count , _ | * count += 1 }), + input: Tee { + inner: , + }, + }, + }, + }, + ), + }, + }, + }, + ), + }, + ), + ), + }, + }, + }, + CycleSink { + ident: Ident { + sym: cycle_0, + }, + location_kind: Cluster( + 0, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , hydro_test :: cluster :: paxos :: Ballot) , hydro_test :: cluster :: paxos :: Ballot > ({ use crate :: __staged :: cluster :: paxos :: * ; | (_ , ballot) | ballot }), + input: FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , core :: result :: Result < () , hydro_test :: cluster :: paxos :: Ballot >) , core :: option :: Option < ((usize , hydro_test :: cluster :: paxos :: Ballot) , hydro_test :: cluster :: paxos :: Ballot) > > ({ use hydro_std :: __staged :: quorum :: * ; move | (key , res) | match res { Ok (_) => None , Err (e) => Some ((key , e)) , } }), + input: Tee { + inner: , + }, + }, + }, + }, + CycleSink { + ident: Ident { + sym: cycle_1, + }, + location_kind: Tick( + 8, + Cluster( + 3, + ), + ), + input: DeferTick( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , usize) , hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | (sorted_payload , _) | { sorted_payload } }), + input: Filter { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < (hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , usize) , bool > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | (sorted_payload , highest_seq) | sorted_payload . seq > * highest_seq }), + input: CrossSingleton( + Tee { + inner: : Sort( + Chain( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) , hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 0, + ), + from_key: None, + to_location: Cluster( + 3, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) >) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Proposer > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > (& b) . unwrap ()) }, + ), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , std :: iter :: Map < std :: slice :: Iter < hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_kv :: Replica > > , _ > > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < hydro_test :: cluster :: paxos_kv :: Replica > > > (__hydro_lang_cluster_ids_3) } ; | b | ids__free . iter () . map (move | id | (:: std :: clone :: Clone :: clone (id) , :: std :: clone :: Clone :: clone (& b))) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) , hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | (slot , kv) | SequencedKv { seq : slot , kv } }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , (core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , ())) , (usize , core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > >) > ({ use crate :: __staged :: cluster :: paxos :: * ; | ((slot , _ballot) , (value , _)) | (slot , value) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((usize , hydro_test :: cluster :: paxos :: Ballot) , (core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , ())) , ((usize , hydro_test :: cluster :: paxos :: Ballot) , (core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > , ())) > ({ use hydro_std :: __staged :: request_response :: * ; | (key , (meta , resp)) | (key , (meta , resp)) }), + input: Join( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + }, + }, + }, + }, + }, + }, + CycleSource { + ident: Ident { + sym: cycle_1, + }, + location_kind: Tick( + 8, + Cluster( + 3, + ), + ), + }, + ), + ), + }, + Tee { + inner: : FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < core :: option :: Option < usize > , core :: option :: Option < usize > > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | v | v }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < core :: option :: Option < usize > > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | | None }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < core :: option :: Option < usize > , (hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , core :: option :: Option < usize >) , () > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | filled_slot , (sorted_payload , highest_seq) | { let expected_next_slot = std :: cmp :: max (filled_slot . map (| v | v + 1) . unwrap_or (0) , highest_seq . map (| v | v + 1) . unwrap_or (0) ,) ; if sorted_payload . seq == expected_next_slot { * filled_slot = Some (sorted_payload . seq) ; } } }), + input: CrossSingleton( + Tee { + inner: , + }, + Chain( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , core :: option :: Option < usize > > ({ use hydro_lang :: __staged :: optional :: * ; | v | Some (v) }), + input: CycleSource { + ident: Ident { + sym: cycle_2, + }, + location_kind: Tick( + 8, + Cluster( + 3, + ), + ), + }, + }, + Persist( + Source { + source: Iter( + [:: std :: option :: Option :: None], + ), + location_kind: Cluster( + 3, + ), + }, + ), + ), + ), + }, + }, + }, + ), + }, + }, + ), + }, + CycleSink { + ident: Ident { + sym: cycle_2, + }, + location_kind: Tick( + 8, + Cluster( + 3, + ), + ), + input: DeferTick( + Tee { + inner: : FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < (std :: collections :: hash_map :: HashMap < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , core :: option :: Option < usize >) , core :: option :: Option < usize > > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | (_kv_store , highest_seq) | highest_seq }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < (std :: collections :: hash_map :: HashMap < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , core :: option :: Option < usize >) > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | | (HashMap :: new () , None) }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (std :: collections :: hash_map :: HashMap < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , core :: option :: Option < usize >) , hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , () > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | (kv_store , last_seq) , payload | { if let Some (kv) = payload . kv { kv_store . insert (kv . key , kv . value) ; } debug_assert ! (payload . seq == (last_seq . map (| s | s + 1) . unwrap_or (0)) , "Hole in log between seq {:?} and {}" , * last_seq , payload . seq) ; * last_seq = Some (payload . seq) ; } }), + input: Persist( + Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , usize) , hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | (sorted_payload , _) | { sorted_payload } }), + input: Filter { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < (hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , usize) , bool > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | (sorted_payload , highest_seq) | sorted_payload . seq <= * highest_seq }), + input: CrossSingleton( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + }, + }, + }, + ), + }, + }, + }, + ), + }, + CycleSink { + ident: Ident { + sym: cycle_3, + }, + location_kind: Tick( + 8, + Cluster( + 3, + ), + ), + input: DeferTick( + Tee { + inner: : FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < (core :: option :: Option < usize > , usize) , core :: option :: Option < usize > > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; let checkpoint_frequency__free = 1usize ; move | (max_checkpointed_seq , new_highest_seq) | if max_checkpointed_seq . map (| m | new_highest_seq - m >= checkpoint_frequency__free) . unwrap_or (true) { Some (new_highest_seq) } else { None } }), + input: CrossSingleton( + Chain( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , core :: option :: Option < usize > > ({ use hydro_lang :: __staged :: optional :: * ; | v | Some (v) }), + input: Reduce { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , usize , () > ({ use hydro_lang :: __staged :: stream :: * ; | curr , new | { if new > * curr { * curr = new ; } } }), + input: Persist( + CycleSource { + ident: Ident { + sym: cycle_3, + }, + location_kind: Tick( + 8, + Cluster( + 3, + ), + ), + }, + ), + }, + }, + Persist( + Source { + source: Iter( + [:: std :: option :: Option :: None], + ), + location_kind: Cluster( + 3, + ), + }, + ), + ), + Tee { + inner: , + }, + ), + }, + }, + ), + }, + CycleSink { + ident: Ident { + sym: cycle_0, + }, + location_kind: Cluster( + 3, + ), + input: Tee { + inner: , + }, + }, + CycleSink { + ident: Ident { + sym: cycle_0, + }, + location_kind: Cluster( + 2, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , hydro_test :: cluster :: paxos :: Ballot) , hydro_test :: cluster :: paxos :: Ballot > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 0, + ), + from_key: None, + to_location: Cluster( + 2, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , hydro_test :: cluster :: paxos :: Ballot) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < hydro_test :: cluster :: paxos :: Ballot > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos :: Proposer > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < hydro_test :: cluster :: paxos :: Ballot > (& b) . unwrap ()) }, + ), + input: FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos :: Ballot , std :: iter :: Map < std :: slice :: Iter < hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > > , _ > > ({ use hydro_lang :: __staged :: stream :: * ; let ids__free = unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > > > (__hydro_lang_cluster_ids_2) } ; | b | ids__free . iter () . map (move | id | (:: std :: clone :: Clone :: clone (id) , :: std :: clone :: Clone :: clone (& b))) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_test :: cluster :: paxos :: Ballot , ()) , hydro_test :: cluster :: paxos :: Ballot > ({ use hydro_lang :: __staged :: singleton :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Tee { + inner: , + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , () > ({ use hydro_lang :: __staged :: singleton :: * ; | _u | () }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (() , ()) , () > ({ use hydro_lang :: __staged :: optional :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Tee { + inner: , + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , () > ({ use hydro_lang :: __staged :: optional :: * ; | _u | () }), + input: Filter { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < usize , bool > ({ use hydro_lang :: __staged :: optional :: * ; | c | * c == 0 }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < usize > ({ use hydro_lang :: __staged :: stream :: * ; | | 0usize }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , () , () > ({ use hydro_lang :: __staged :: stream :: * ; | count , _ | * count += 1 }), + input: DeferTick( + Tee { + inner: , + }, + ), + }, + }, + }, + ), + }, + }, + ), + }, + }, + }, + }, + }, + CycleSink { + ident: Ident { + sym: cycle_2, + }, + location_kind: Tick( + 0, + Cluster( + 2, + ), + ), + input: DeferTick( + AntiJoin( + Tee { + inner: : Chain( + CycleSource { + ident: Ident { + sym: cycle_2, + }, + location_kind: Tick( + 0, + Cluster( + 2, + ), + ), + }, + Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_kv :: Replica > , ((u32 , u32) , core :: result :: Result < () , () >)) , ((u32 , u32) , core :: result :: Result < () , () >) > ({ use hydro_lang :: __staged :: stream :: * ; | (_ , b) | b }), + input: Network { + from_location: Cluster( + 3, + ), + from_key: None, + to_location: Cluster( + 2, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , ((u32 , u32) , core :: result :: Result < () , () >)) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < ((u32 , u32) , core :: result :: Result < () , () >) > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos_kv :: Replica > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < ((u32 , u32) , core :: result :: Result < () , () >) > (& b) . unwrap ()) }, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , ((u32 , u32) , core :: result :: Result < () , () >)) > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | payload | (payload . value . 0 , ((payload . key , payload . value . 1) , Ok (()))) }), + input: FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: cluster :: paxos_kv :: SequencedKv < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > , core :: option :: Option < hydro_test :: cluster :: paxos_kv :: KvPayload < u32 , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos_bench :: Client > , u32) > > > ({ use crate :: __staged :: cluster :: paxos_kv :: * ; | payload | payload . kv }), + input: Tee { + inner: , + }, + }, + }, + }, + }, + }, + ), + }, + Tee { + inner: : FilterMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((u32 , u32) , (usize , usize)) , core :: option :: Option < (u32 , u32) > > ({ use hydro_std :: __staged :: quorum :: * ; let min__free = 2usize ; move | (key , (success , _error)) | if success >= min__free { Some (key) } else { None } }), + input: Tee { + inner: : FoldKeyed { + init: stageleft :: runtime_support :: fn0_type_hint :: < (usize , usize) > ({ use hydro_std :: __staged :: quorum :: * ; move | | (0 , 0) }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (usize , usize) , core :: result :: Result < () , () > , () > ({ use hydro_std :: __staged :: quorum :: * ; move | accum , value | { if value . is_ok () { accum . 0 += 1 ; } else { accum . 1 += 1 ; } } }), + input: Tee { + inner: , + }, + }, + }, + }, + }, + ), + ), + }, + CycleSink { + ident: Ident { + sym: cycle_1, + }, + location_kind: Cluster( + 2, + ), + input: Chain( + FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , std :: iter :: Map < std :: ops :: Range < usize > , _ > > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; let CLUSTER_SELF_ID__free = hydro_lang :: ClusterId :: < hydro_test :: cluster :: paxos_bench :: Client > :: from_raw (__hydro_lang_cluster_self_id_2) ; let num_clients_per_node__free = 1usize ; move | _ | (0 .. num_clients_per_node__free) . map (move | i | ((CLUSTER_SELF_ID__free . raw_id * (num_clients_per_node__free as u32)) + i as u32 , 0)) }), + input: Tee { + inner: : Reduce { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < () , () , () > ({ use hydro_lang :: __staged :: stream :: * ; | curr , new | * curr = new }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_lang :: location :: cluster :: cluster_id :: ClusterId < hydro_test :: cluster :: paxos :: Proposer > , () > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | _ | () }), + input: Delta( + Tee { + inner: , + }, + ), + }, + }, + }, + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (u32 , u32) , (u32 , u32) > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | payload | (payload . 0 , payload . 1 + 1) }), + input: Tee { + inner: : Tee { + inner: , + }, + }, + }, + ), + }, + CycleSink { + ident: Ident { + sym: cycle_3, + }, + location_kind: Tick( + 1, + Cluster( + 2, + ), + ), + input: DeferTick( + ReduceKeyed { + f: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < tokio :: time :: Instant , tokio :: time :: Instant , () > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | curr_time , new_time | { if new_time > * curr_time { * curr_time = new_time ; } } }), + input: Chain( + Chain( + Tee { + inner: : CycleSource { + ident: Ident { + sym: cycle_3, + }, + location_kind: Tick( + 1, + Cluster( + 2, + ), + ), + }, + }, + FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < tokio :: time :: Instant , std :: iter :: Map < std :: ops :: Range < usize > , _ > > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; let num_clients_per_node__free = 1usize ; move | now | (0 .. num_clients_per_node__free) . map (move | virtual_id | (virtual_id , now)) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < () , tokio :: time :: Instant > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | _ | Instant :: now () }), + input: Tee { + inner: , + }, + }, + }, + ), + Tee { + inner: : Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (u32 , u32) , (usize , tokio :: time :: Instant) > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | (key , _prev_count) | (key as usize , Instant :: now ()) }), + input: Tee { + inner: , + }, + }, + }, + ), + }, + ), + }, + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < (std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) , () > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; move | (latencies , throughput) | { let mut latencies_mut = latencies . borrow_mut () ; if latencies_mut . len () > 0 { let middle_idx = latencies_mut . len () / 2 ; let (_ , median , _) = latencies_mut . select_nth_unstable (middle_idx) ; println ! ("Median latency: {}ms" , median . as_micros () as f64 / 1000.0) ; } println ! ("Throughput: {} requests/s" , throughput) ; } }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < ((std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) , ()) , (std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) > ({ use hydro_lang :: __staged :: singleton :: * ; | (d , _signal) | d }), + input: CrossSingleton( + CrossSingleton( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) , std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | (latencies , _) | latencies }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < (std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; let median_latency_window_size__free = 1usize ; move | | (Rc :: new (RefCell :: new (Vec :: < Duration > :: with_capacity (median_latency_window_size__free))) , 0usize ,) }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < (std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) , core :: time :: Duration , () > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; let median_latency_window_size__free = 1usize ; move | (latencies , write_index) , latency | { let mut latencies_mut = latencies . borrow_mut () ; if * write_index < latencies_mut . len () { latencies_mut [* write_index] = latency ; } else { latencies_mut . push (latency) ; } * write_index = (* write_index + 1) % median_latency_window_size__free ; } }), + input: Persist( + FlatMap { + f: stageleft :: runtime_support :: fn1_type_hint :: < core :: option :: Option < core :: time :: Duration > , core :: option :: Option < core :: time :: Duration > > ({ use hydro_lang :: __staged :: stream :: * ; | d | d }), + input: Chain( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , (tokio :: time :: Instant , tokio :: time :: Instant)) , core :: option :: Option < core :: time :: Duration > > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | (_virtual_id , (prev_time , curr_time)) | Some (curr_time . duration_since (prev_time)) }), + input: Join( + Tee { + inner: , + }, + Tee { + inner: , + }, + ), + }, + DeferTick( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < tokio :: time :: Instant , core :: option :: Option < core :: time :: Duration > > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | _ | None }), + input: Tee { + inner: : Source { + source: Stream( + { use hydro_lang :: __staged :: location :: * ; let interval__free = { use crate :: __staged :: cluster :: paxos_bench :: * ; Duration :: from_secs (1) } ; tokio_stream :: wrappers :: IntervalStream :: new (tokio :: time :: interval (interval__free)) }, + ), + location_kind: Cluster( + 2, + ), + }, + }, + }, + ), + ), + }, + ), + }, + }, + Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < usize > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | | 0 }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , (usize , bool) , () > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | total , (batch_size , reset) | { if reset { * total = 0 ; } else { * total += batch_size ; } } }), + input: Persist( + Chain( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , (usize , bool) > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | batch_size | (batch_size , false) }), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (usize , ()) , usize > ({ use hydro_lang :: __staged :: singleton :: * ; | (d , _signal) | d }), + input: CrossSingleton( + Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < usize > ({ use hydro_lang :: __staged :: stream :: * ; | | 0usize }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , (u32 , u32) , () > ({ use hydro_lang :: __staged :: stream :: * ; | count , _ | * count += 1 }), + input: Tee { + inner: , + }, + }, + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < usize , () > ({ use hydro_lang :: __staged :: singleton :: * ; | _u | () }), + input: Filter { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < usize , bool > ({ use hydro_lang :: __staged :: singleton :: * ; | c | * c == 0 }), + input: Fold { + init: stageleft :: runtime_support :: fn0_type_hint :: < usize > ({ use hydro_lang :: __staged :: stream :: * ; | | 0usize }), + acc: stageleft :: runtime_support :: fn2_borrow_mut_type_hint :: < usize , tokio :: time :: Instant , () > ({ use hydro_lang :: __staged :: stream :: * ; | count , _ | * count += 1 }), + input: Tee { + inner: , + }, + }, + }, + }, + ), + }, + }, + DeferTick( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < tokio :: time :: Instant , (usize , bool) > ({ use crate :: __staged :: cluster :: paxos_bench :: * ; | _ | (0 , true) }), + input: Tee { + inner: , + }, + }, + ), + ), + ), + }, + ), + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < tokio :: time :: Instant , () > ({ use hydro_lang :: __staged :: singleton :: * ; | _u | () }), + input: Tee { + inner: , + }, + }, + ), + }, + }, +] diff --git a/hydro_test/src/cluster/snapshots/hydro_test__cluster__simple_cluster__tests__simple_cluster.snap b/hydro_test/src/cluster/snapshots/hydro_test__cluster__simple_cluster__tests__simple_cluster.snap new file mode 100644 index 000000000000..308e2cef810f --- /dev/null +++ b/hydro_test/src/cluster/snapshots/hydro_test__cluster__simple_cluster__tests__simple_cluster.snap @@ -0,0 +1,76 @@ +--- +source: hydro_test/src/cluster/simple_cluster.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32)) , () > ({ use crate :: __staged :: cluster :: simple_cluster :: * ; | (id , d) | println ! ("node received: ({}, {:?})" , id , d) }), + input: Network { + from_location: Cluster( + 1, + ), + from_key: None, + to_location: Process( + 0, + ), + to_key: None, + serialize_fn: Some( + | data | { hydro_lang :: runtime_support :: bincode :: serialize :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32) > (& data) . unwrap () . into () }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { let (id , b) = res . unwrap () ; (hydro_lang :: ClusterId :: < () > :: from_raw (id) , hydro_lang :: runtime_support :: bincode :: deserialize :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32) > (& b) . unwrap ()) }, + ), + input: Inspect { + f: stageleft :: runtime_support :: fn1_borrow_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32) , () > ({ use crate :: __staged :: cluster :: simple_cluster :: * ; let CLUSTER_SELF_ID__free = hydro_lang :: ClusterId :: < () > :: from_raw (__hydro_lang_cluster_self_id_1) ; move | n | println ! ("cluster received: {:?} (self cluster id: {})" , n , CLUSTER_SELF_ID__free) }), + input: Network { + from_location: Process( + 0, + ), + from_key: None, + to_location: Cluster( + 1, + ), + to_key: None, + serialize_fn: Some( + | (id , data) : (hydro_lang :: ClusterId < _ > , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32)) | { (id . raw_id , hydro_lang :: runtime_support :: bincode :: serialize :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32) > (& data) . unwrap () . into ()) }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { hydro_lang :: runtime_support :: bincode :: deserialize :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32) > (& res . unwrap ()) . unwrap () }, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32) , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , (hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , i32)) > ({ use crate :: __staged :: cluster :: simple_cluster :: * ; | (id , n) | (id , (id , n)) }), + input: Delta( + CrossProduct( + Persist( + Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < & hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > , hydro_lang :: location :: cluster :: cluster_id :: ClusterId < () > > ({ use crate :: __staged :: cluster :: simple_cluster :: * ; | & id | id }), + input: Source { + source: Iter( + unsafe { :: std :: mem :: transmute :: < _ , & :: std :: vec :: Vec < hydro_lang :: ClusterId < () > > > (__hydro_lang_cluster_ids_1) }, + ), + location_kind: Process( + 0, + ), + }, + }, + ), + Persist( + Source { + source: Iter( + { use crate :: __staged :: cluster :: simple_cluster :: * ; 0 .. 5 }, + ), + location_kind: Process( + 0, + ), + }, + ), + ), + ), + }, + }, + }, + }, + }, +] diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir.snap diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_0.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_0.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_0.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_0.snap diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_1.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_1.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_1.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__compute_pi__tests__compute_pi_ir@surface_graph_1.snap diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__many_to_many__tests__many_to_many.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__many_to_many__tests__many_to_many.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__many_to_many__tests__many_to_many.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__many_to_many__tests__many_to_many.snap diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir.snap diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_0.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_0.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_0.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_0.snap diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_1.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_1.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_1.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__map_reduce__tests__map_reduce_ir@surface_graph_1.snap diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__paxos_bench__tests__paxos_ir.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__paxos_bench__tests__paxos_ir.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__paxos_bench__tests__paxos_ir.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__paxos_bench__tests__paxos_ir.snap diff --git a/hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__simple_cluster__tests__simple_cluster.snap b/hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__simple_cluster__tests__simple_cluster.snap similarity index 100% rename from hydroflow_plus_test/src/cluster/snapshots/hydroflow_plus_test__cluster__simple_cluster__tests__simple_cluster.snap rename to hydro_test/src/cluster/snapshots/hydroflow_plus_test__cluster__simple_cluster__tests__simple_cluster.snap diff --git a/hydroflow_plus_test/src/cluster/two_pc.rs b/hydro_test/src/cluster/two_pc.rs similarity index 97% rename from hydroflow_plus_test/src/cluster/two_pc.rs rename to hydro_test/src/cluster/two_pc.rs index 429de9ab6337..2f1f998efd30 100644 --- a/hydroflow_plus_test/src/cluster/two_pc.rs +++ b/hydro_test/src/cluster/two_pc.rs @@ -1,5 +1,5 @@ -use hydroflow_plus::*; -use hydroflow_plus_std::quorum::collect_quorum; +use hydro_lang::*; +use hydro_std::quorum::collect_quorum; // if the variable start with p, that means current work is at the participant side. if start with c, at coordinator side. // diff --git a/hydroflow_plus_test/src/distributed/first_ten.rs b/hydro_test/src/distributed/first_ten.rs similarity index 94% rename from hydroflow_plus_test/src/distributed/first_ten.rs rename to hydro_test/src/distributed/first_ten.rs index 5099e7d4e50e..7e0723e4b2ff 100644 --- a/hydroflow_plus_test/src/distributed/first_ten.rs +++ b/hydro_test/src/distributed/first_ten.rs @@ -1,4 +1,4 @@ -use hydroflow_plus::*; +use hydro_lang::*; use location::external_process::ExternalBincodeSink; use serde::{Deserialize, Serialize}; @@ -31,13 +31,13 @@ pub fn first_ten_distributed<'a>( mod tests { use futures::SinkExt; use hydro_deploy::Deployment; - use hydroflow_plus::deploy::DeployCrateWrapper; + use hydro_lang::deploy::DeployCrateWrapper; #[tokio::test] async fn first_ten_distributed() { let mut deployment = Deployment::new(); - let builder = hydroflow_plus::FlowBuilder::new(); + let builder = hydro_lang::FlowBuilder::new(); let external = builder.external_process(); let p1 = builder.process(); let p2 = builder.process(); diff --git a/hydroflow_plus_test/src/distributed/mod.rs b/hydro_test/src/distributed/mod.rs similarity index 100% rename from hydroflow_plus_test/src/distributed/mod.rs rename to hydro_test/src/distributed/mod.rs diff --git a/hydro_test/src/distributed/snapshots/hydro_test__distributed__first_ten__tests__first_ten_distributed.snap b/hydro_test/src/distributed/snapshots/hydro_test__distributed__first_ten__tests__first_ten_distributed.snap new file mode 100644 index 000000000000..1bc38df8f750 --- /dev/null +++ b/hydro_test/src/distributed/snapshots/hydro_test__distributed__first_ten__tests__first_ten_distributed.snap @@ -0,0 +1,63 @@ +--- +source: hydro_test/src/distributed/first_ten.rs +expression: built.ir() +--- +[ + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < std :: string :: String , () > ({ use crate :: __staged :: distributed :: first_ten :: * ; | n | println ! ("hi: {:?}" , n) }), + input: Network { + from_location: ExternalProcess( + 0, + ), + from_key: Some( + 0, + ), + to_location: Process( + 1, + ), + to_key: None, + serialize_fn: None, + instantiate_fn: , + deserialize_fn: Some( + | res | { hydro_lang :: runtime_support :: bincode :: deserialize :: < std :: string :: String > (& res . unwrap ()) . unwrap () }, + ), + input: Source { + source: ExternalNetwork, + location_kind: ExternalProcess( + 0, + ), + }, + }, + }, + ForEach { + f: stageleft :: runtime_support :: fn1_type_hint :: < hydro_test :: distributed :: first_ten :: SendOverNetwork , () > ({ use crate :: __staged :: distributed :: first_ten :: * ; | n | println ! ("{}" , n . n) }), + input: Network { + from_location: Process( + 1, + ), + from_key: None, + to_location: Process( + 2, + ), + to_key: None, + serialize_fn: Some( + | data | { hydro_lang :: runtime_support :: bincode :: serialize :: < hydro_test :: distributed :: first_ten :: SendOverNetwork > (& data) . unwrap () . into () }, + ), + instantiate_fn: , + deserialize_fn: Some( + | res | { hydro_lang :: runtime_support :: bincode :: deserialize :: < hydro_test :: distributed :: first_ten :: SendOverNetwork > (& res . unwrap ()) . unwrap () }, + ), + input: Map { + f: stageleft :: runtime_support :: fn1_type_hint :: < u32 , hydro_test :: distributed :: first_ten :: SendOverNetwork > ({ use crate :: __staged :: distributed :: first_ten :: * ; | n | SendOverNetwork { n } }), + input: Source { + source: Iter( + { use crate :: __staged :: distributed :: first_ten :: * ; 0 .. 10 }, + ), + location_kind: Process( + 1, + ), + }, + }, + }, + }, +] diff --git a/hydroflow_plus_test/src/distributed/snapshots/hydroflow_plus_test__distributed__first_ten__tests__first_ten_distributed.snap b/hydro_test/src/distributed/snapshots/hydroflow_plus_test__distributed__first_ten__tests__first_ten_distributed.snap similarity index 100% rename from hydroflow_plus_test/src/distributed/snapshots/hydroflow_plus_test__distributed__first_ten__tests__first_ten_distributed.snap rename to hydro_test/src/distributed/snapshots/hydroflow_plus_test__distributed__first_ten__tests__first_ten_distributed.snap diff --git a/hydroflow_plus_test/src/lib.rs b/hydro_test/src/lib.rs similarity index 67% rename from hydroflow_plus_test/src/lib.rs rename to hydro_test/src/lib.rs index 76d9bdb33376..0054f03d4c5b 100644 --- a/hydroflow_plus_test/src/lib.rs +++ b/hydro_test/src/lib.rs @@ -6,6 +6,6 @@ pub mod distributed; #[doc(hidden)] #[stageleft::runtime] mod docs { - #[doc = include_str!("../../docs/docs/hydroflow_plus/consistency.md")] + #[doc = include_str!("../../docs/docs/hydro/consistency.md")] mod consistency {} } diff --git a/hydroflow_plus_test_local/Cargo.toml b/hydro_test_local/Cargo.toml similarity index 69% rename from hydroflow_plus_test_local/Cargo.toml rename to hydro_test_local/Cargo.toml index 60307f1002cb..a305cbf8bd0d 100644 --- a/hydroflow_plus_test_local/Cargo.toml +++ b/hydro_test_local/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hydroflow_plus_test_local" +name = "hydro_test_local" publish = false version = "0.0.0" edition = "2021" @@ -12,11 +12,11 @@ stageleft_devel = [] [dependencies] hydroflow = { path = "../hydroflow", version = "^0.10.0", default-features = false } # , features = ["debugging"] } -hydroflow_plus = { path = "../hydroflow_plus", version = "^0.10.0", features = ["build"] } +hydro_lang = { path = "../hydro_lang", version = "^0.10.0", features = ["build"] } stageleft = { path = "../stageleft", version = "^0.5.0" } rand = "0.8.0" -hydroflow_plus_test_local_macro = { path = "../hydroflow_plus_test_local_macro" } +hydro_test_local_macro = { path = "../hydro_test_local_macro" } [build-dependencies] stageleft_tool = { path = "../stageleft_tool", version = "^0.4.0" } diff --git a/hydroflow_plus_test_local/build.rs b/hydro_test_local/build.rs similarity index 100% rename from hydroflow_plus_test_local/build.rs rename to hydro_test_local/build.rs diff --git a/hydroflow_plus_test_local/src/lib.rs b/hydro_test_local/src/lib.rs similarity index 59% rename from hydroflow_plus_test_local/src/lib.rs rename to hydro_test_local/src/lib.rs index c26190f6410b..cf7c49f68bda 100644 --- a/hydroflow_plus_test_local/src/lib.rs +++ b/hydro_test_local/src/lib.rs @@ -1,4 +1,4 @@ -stageleft::stageleft_crate!(hydroflow_plus_test_local_macro); +stageleft::stageleft_crate!(hydro_test_local_macro); #[cfg(stageleft_macro)] pub(crate) mod local; diff --git a/hydroflow_plus_test_local/src/local/chat_app.rs b/hydro_test_local/src/local/chat_app.rs similarity index 97% rename from hydroflow_plus_test_local/src/local/chat_app.rs rename to hydro_test_local/src/local/chat_app.rs index b34d8e8dcecc..f81d92e6ba89 100644 --- a/hydroflow_plus_test_local/src/local/chat_app.rs +++ b/hydro_test_local/src/local/chat_app.rs @@ -1,8 +1,8 @@ +use hydro_lang::deploy::SingleProcessGraph; +use hydro_lang::hydroflow::scheduled::graph::Hydroflow; +use hydro_lang::*; use hydroflow::tokio::sync::mpsc::UnboundedSender; use hydroflow::tokio_stream::wrappers::UnboundedReceiverStream; -use hydroflow_plus::deploy::SingleProcessGraph; -use hydroflow_plus::hydroflow::scheduled::graph::Hydroflow; -use hydroflow_plus::*; use stageleft::{Quoted, RuntimeData}; #[stageleft::entry] diff --git a/hydroflow_plus_test_local/src/local/compute_pi.rs b/hydro_test_local/src/local/compute_pi.rs similarity index 91% rename from hydroflow_plus_test_local/src/local/compute_pi.rs rename to hydro_test_local/src/local/compute_pi.rs index 79ef4e3ba939..3cffccc9506c 100644 --- a/hydroflow_plus_test_local/src/local/compute_pi.rs +++ b/hydro_test_local/src/local/compute_pi.rs @@ -1,8 +1,8 @@ use std::time::Duration; -use hydroflow_plus::deploy::SingleProcessGraph; -use hydroflow_plus::hydroflow::scheduled::graph::Hydroflow; -use hydroflow_plus::*; +use hydro_lang::deploy::SingleProcessGraph; +use hydro_lang::hydroflow::scheduled::graph::Hydroflow; +use hydro_lang::*; use stageleft::{Quoted, RuntimeData}; pub fn compute_pi<'a>(flow: &FlowBuilder<'a>, batch_size: RuntimeData) -> Process<'a, ()> { diff --git a/hydroflow_plus_test_local/src/local/count_elems.rs b/hydro_test_local/src/local/count_elems.rs similarity index 92% rename from hydroflow_plus_test_local/src/local/count_elems.rs rename to hydro_test_local/src/local/count_elems.rs index 06497ea964be..f97bb3abdb09 100644 --- a/hydroflow_plus_test_local/src/local/count_elems.rs +++ b/hydro_test_local/src/local/count_elems.rs @@ -1,8 +1,8 @@ +use hydro_lang::deploy::SingleProcessGraph; +use hydro_lang::hydroflow::scheduled::graph::Hydroflow; +use hydro_lang::*; use hydroflow::tokio::sync::mpsc::UnboundedSender; use hydroflow::tokio_stream::wrappers::UnboundedReceiverStream; -use hydroflow_plus::deploy::SingleProcessGraph; -use hydroflow_plus::hydroflow::scheduled::graph::Hydroflow; -use hydroflow_plus::*; use stageleft::{Quoted, RuntimeData}; pub fn count_elems_generic<'a, T: 'a>( diff --git a/hydroflow_plus_test_local/src/local/first_ten.rs b/hydro_test_local/src/local/first_ten.rs similarity index 80% rename from hydroflow_plus_test_local/src/local/first_ten.rs rename to hydro_test_local/src/local/first_ten.rs index 2b027036e570..ff8ea851a4a0 100644 --- a/hydroflow_plus_test_local/src/local/first_ten.rs +++ b/hydro_test_local/src/local/first_ten.rs @@ -1,6 +1,6 @@ -use hydroflow_plus::deploy::SingleProcessGraph; -use hydroflow_plus::hydroflow::scheduled::graph::Hydroflow; -use hydroflow_plus::*; +use hydro_lang::deploy::SingleProcessGraph; +use hydro_lang::hydroflow::scheduled::graph::Hydroflow; +use hydro_lang::*; use stageleft::Quoted; pub fn first_ten(flow: &FlowBuilder) { diff --git a/hydroflow_plus_test_local/src/local/graph_reachability.rs b/hydro_test_local/src/local/graph_reachability.rs similarity index 95% rename from hydroflow_plus_test_local/src/local/graph_reachability.rs rename to hydro_test_local/src/local/graph_reachability.rs index c694b970a704..f715664b6efe 100644 --- a/hydroflow_plus_test_local/src/local/graph_reachability.rs +++ b/hydro_test_local/src/local/graph_reachability.rs @@ -1,8 +1,8 @@ +use hydro_lang::deploy::SingleProcessGraph; +use hydro_lang::hydroflow::scheduled::graph::Hydroflow; +use hydro_lang::*; use hydroflow::tokio::sync::mpsc::UnboundedSender; use hydroflow::tokio_stream::wrappers::UnboundedReceiverStream; -use hydroflow_plus::deploy::SingleProcessGraph; -use hydroflow_plus::hydroflow::scheduled::graph::Hydroflow; -use hydroflow_plus::*; use stageleft::{Quoted, RuntimeData}; #[stageleft::entry] diff --git a/hydroflow_plus_test_local/src/local/mod.rs b/hydro_test_local/src/local/mod.rs similarity index 100% rename from hydroflow_plus_test_local/src/local/mod.rs rename to hydro_test_local/src/local/mod.rs diff --git a/hydroflow_plus_test_local/src/local/negation.rs b/hydro_test_local/src/local/negation.rs similarity index 97% rename from hydroflow_plus_test_local/src/local/negation.rs rename to hydro_test_local/src/local/negation.rs index a44dc6505de6..cc48d9e454c9 100644 --- a/hydroflow_plus_test_local/src/local/negation.rs +++ b/hydro_test_local/src/local/negation.rs @@ -1,7 +1,7 @@ +use hydro_lang::deploy::SingleProcessGraph; +use hydro_lang::hydroflow::scheduled::graph::Hydroflow; +use hydro_lang::*; use hydroflow::tokio::sync::mpsc::UnboundedSender; -use hydroflow_plus::deploy::SingleProcessGraph; -use hydroflow_plus::hydroflow::scheduled::graph::Hydroflow; -use hydroflow_plus::*; use stageleft::{Quoted, RuntimeData}; #[stageleft::entry] diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_dot.snap new file mode 100644 index 000000000000..1e6537cc3ba4 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_dot.snap @@ -0,0 +1,43 @@ +--- +source: hydro_test_local/src/local/chat_app.rs +expression: "chat_server.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_stream(users_stream)", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) source_stream(messages)", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l std::string::String,\l std::string::String,\l >({\l use crate::__staged::local::chat_app::*;\l |s| s.to_uppercase()\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) cross_join_multiset::<'static, 'tick>()", shape=invhouse, fillcolor="#88aaff"] + n5v1 [label="(n5v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, std::string::String),\l (),\l >({\l use crate::__staged::local::chat_app::*;\l let output__free = output;\l |t| {\l output__free.send(t).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n2v1 -> n3v1 + n1v1 -> n4v1 [label="0"] + n3v1 -> n4v1 [label="1"] + n4v1 -> n5v1 + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n1v1 + n2v1 + n3v1 + n4v1 + n5v1 + subgraph "cluster_sg_1v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_1v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_1v1_var_stream_2" { + label="var stream_2" + n3v1 + } + subgraph "cluster_sg_1v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_mermaid.snap new file mode 100644 index 000000000000..2ff5a2e7633a --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_mermaid.snap @@ -0,0 +1,38 @@ +--- +source: hydro_test_local/src/local/chat_app.rs +expression: "chat_server.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"(1v1) source_stream(users_stream)"/]:::pullClass +2v1[\"(2v1) source_stream(messages)"/]:::pullClass +3v1[\"
(3v1)
map(
stageleft::runtime_support::fn1_type_hint::<
std::string::String,
std::string::String,
>({
use crate::__staged::local::chat_app::*;
|s| s.to_uppercase()
}),
)
"/]:::pullClass +4v1[\"(4v1) cross_join_multiset::<'static, 'tick>()"/]:::pullClass +5v1[/"
(5v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
(u32, std::string::String),
(),
>({
use crate::__staged::local::chat_app::*;
let output__free = output;
|t| {
output__free.send(t).unwrap();
}
}),
)
"\]:::pushClass +2v1-->3v1 +1v1-->|0|4v1 +3v1-->|1|4v1 +4v1-->5v1 +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 1v1 + 2v1 + 3v1 + 4v1 + 5v1 + subgraph sg_1v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_1v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_1v1_var_stream_2 ["var stream_2"] + 3v1 + end + subgraph sg_1v1_var_stream_3 ["var stream_3"] + 4v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_replay@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_replay@graphvis_dot.snap new file mode 100644 index 000000000000..344e49e3e20c --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_replay@graphvis_dot.snap @@ -0,0 +1,50 @@ +--- +source: hydro_test_local/src/local/chat_app.rs +expression: "chat_server.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_stream(users_stream)", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) source_stream(messages)", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l std::string::String,\l std::string::String,\l >({\l use crate::__staged::local::chat_app::*;\l |s| s.to_uppercase()\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) cross_join_multiset::<'static, 'static>()", shape=invhouse, fillcolor="#88aaff"] + n5v1 [label="(n5v1) multiset_delta()", shape=invhouse, fillcolor="#88aaff"] + n6v1 [label="(n6v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, std::string::String),\l (),\l >({\l use crate::__staged::local::chat_app::*;\l let output__free = output;\l |t| {\l output__free.send(t).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n2v1 -> n3v1 + n1v1 -> n4v1 [label="0"] + n3v1 -> n4v1 [label="1"] + n4v1 -> n5v1 + n5v1 -> n6v1 + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n1v1 + n2v1 + n3v1 + n4v1 + n5v1 + n6v1 + subgraph "cluster_sg_1v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_1v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_1v1_var_stream_2" { + label="var stream_2" + n3v1 + } + subgraph "cluster_sg_1v1_var_stream_3" { + label="var stream_3" + n4v1 + } + subgraph "cluster_sg_1v1_var_stream_4" { + label="var stream_4" + n5v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_replay@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_replay@graphvis_mermaid.snap new file mode 100644 index 000000000000..5eb266b9b432 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__chat_app__tests__chat_app_replay@graphvis_mermaid.snap @@ -0,0 +1,44 @@ +--- +source: hydro_test_local/src/local/chat_app.rs +expression: "chat_server.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"(1v1) source_stream(users_stream)"/]:::pullClass +2v1[\"(2v1) source_stream(messages)"/]:::pullClass +3v1[\"
(3v1)
map(
stageleft::runtime_support::fn1_type_hint::<
std::string::String,
std::string::String,
>({
use crate::__staged::local::chat_app::*;
|s| s.to_uppercase()
}),
)
"/]:::pullClass +4v1[\"(4v1) cross_join_multiset::<'static, 'static>()"/]:::pullClass +5v1[\"(5v1) multiset_delta()"/]:::pullClass +6v1[/"
(6v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
(u32, std::string::String),
(),
>({
use crate::__staged::local::chat_app::*;
let output__free = output;
|t| {
output__free.send(t).unwrap();
}
}),
)
"\]:::pushClass +2v1-->3v1 +1v1-->|0|4v1 +3v1-->|1|4v1 +4v1-->5v1 +5v1-->6v1 +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 1v1 + 2v1 + 3v1 + 4v1 + 5v1 + 6v1 + subgraph sg_1v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_1v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_1v1_var_stream_2 ["var stream_2"] + 3v1 + end + subgraph sg_1v1_var_stream_3 ["var stream_3"] + 4v1 + end + subgraph sg_1v1_var_stream_4 ["var stream_4"] + 5v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__count_elems__tests__count@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__count_elems__tests__count@graphvis_dot.snap new file mode 100644 index 000000000000..91fdcf2886ea --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__count_elems__tests__count@graphvis_dot.snap @@ -0,0 +1,43 @@ +--- +source: hydro_test_local/src/local/count_elems.rs +expression: "count.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_stream(input_stream)", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l usize,\l u32,\l >({\l use crate::__staged::local::count_elems::*;\l |_| 1\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) fold::<\l 'tick,\l>(\l stageleft::runtime_support::fn0_type_hint::<\l u32,\l >({\l use crate::__staged::local::count_elems::*;\l || 0\l }),\l stageleft::runtime_support::fn2_borrow_mut_type_hint::<\l u32,\l u32,\l (),\l >({\l use crate::__staged::local::count_elems::*;\l |a, b| *a += b\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::count_elems::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n5v1 [label="(n5v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n5v1 + n3v1 -> n4v1 + n5v1 -> n3v1 [color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n1v1 + n2v1 + subgraph "cluster_sg_1v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_1v1_var_stream_1" { + label="var stream_1" + n2v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n3v1 + n4v1 + subgraph "cluster_sg_2v1_var_stream_2" { + label="var stream_2" + n3v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__count_elems__tests__count@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__count_elems__tests__count@graphvis_mermaid.snap new file mode 100644 index 000000000000..f4b161273865 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__count_elems__tests__count@graphvis_mermaid.snap @@ -0,0 +1,36 @@ +--- +source: hydro_test_local/src/local/count_elems.rs +expression: "count.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"(1v1) source_stream(input_stream)"/]:::pullClass +2v1[\"
(2v1)
map(
stageleft::runtime_support::fn1_type_hint::<
usize,
u32,
>({
use crate::__staged::local::count_elems::*;
|_| 1
}),
)
"/]:::pullClass +3v1[\"
(3v1)
fold::<
'tick,
>(
stageleft::runtime_support::fn0_type_hint::<
u32,
>({
use crate::__staged::local::count_elems::*;
|| 0
}),
stageleft::runtime_support::fn2_borrow_mut_type_hint::<
u32,
u32,
(),
>({
use crate::__staged::local::count_elems::*;
|a, b| *a += b
}),
)
"/]:::pullClass +4v1[/"
(4v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::count_elems::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +5v1["(5v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->5v1 +3v1-->4v1 +5v1--x3v1; linkStyle 3 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 1v1 + 2v1 + subgraph sg_1v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_1v1_var_stream_1 ["var stream_1"] + 2v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 3v1 + 4v1 + subgraph sg_2v1_var_stream_2 ["var stream_2"] + 3v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__graph_reachability__tests__reachability@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__graph_reachability__tests__reachability@graphvis_dot.snap new file mode 100644 index 000000000000..ed64d45ba905 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__graph_reachability__tests__reachability@graphvis_dot.snap @@ -0,0 +1,136 @@ +--- +source: hydro_test_local/src/local/graph_reachability.rs +expression: "reachability.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_stream(roots)", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) chain()", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) tee()", shape=house, fillcolor="#ffff88"] + n4v1 [label="(n4v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, ()),\l >({\l use crate::__staged::local::graph_reachability::*;\l |r| (r, ())\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n5v1 [label="(n5v1) source_stream(edges)", shape=invhouse, fillcolor="#88aaff"] + n6v1 [label="(n6v1) join_multiset::<'tick, 'static>()", shape=invhouse, fillcolor="#88aaff"] + n7v1 [label="(n7v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, ((), u32)),\l u32,\l >({\l use crate::__staged::local::graph_reachability::*;\l |(_from, (_, to))| to\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n8v1 [label="(n8v1) chain()", shape=invhouse, fillcolor="#88aaff"] + n9v1 [label="(n9v1) defer_tick_lazy()", shape=invhouse, fillcolor="#88aaff"] + n10v1 [label="(n10v1) persist::<'static>()", shape=house, fillcolor="#ffff88"] + n11v1 [label="(n11v1) unique::<'tick>()", shape=house, fillcolor="#ffff88"] + n12v1 [label="(n12v1) multiset_delta()", shape=house, fillcolor="#ffff88"] + n13v1 [label="(n13v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::graph_reachability::*;\l let reached_out__free = reached_out;\l |v| {\l reached_out__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n14v1 [label="(n14v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n15v1 [label="(n15v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n16v1 [label="(n16v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n17v1 [label="(n17v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n18v1 [label="(n18v1) identity()", shape=invhouse, fillcolor="#88aaff"] + n19v1 [label="(n19v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n20v1 [label="(n20v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n14v1 + n9v1 -> n2v1 [label="1"] + n2v1 -> n3v1 + n3v1 -> n4v1 + n4v1 -> n15v1 + n5v1 -> n20v1 + n6v1 -> n7v1 + n3v1 -> n16v1 + n7v1 -> n8v1 [label="1"] + n8v1 -> n17v1 + n3v1 -> n10v1 + n10v1 -> n11v1 + n11v1 -> n12v1 + n12v1 -> n13v1 + n14v1 -> n2v1 [label="0", color=red] + n15v1 -> n6v1 [label="0"] + n16v1 -> n8v1 [label="0", color=red] + n17v1 -> n18v1 + n18v1 -> n19v1 + n19v1 -> n9v1 [color=red] + n20v1 -> n6v1 [label="1"] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n1v1 + subgraph "cluster_sg_1v1_var_stream_0" { + label="var stream_0" + n1v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 2" + n6v1 + n7v1 + n8v1 + subgraph "cluster_sg_2v1_var_stream_5" { + label="var stream_5" + n6v1 + } + subgraph "cluster_sg_2v1_var_stream_6" { + label="var stream_6" + n7v1 + } + subgraph "cluster_sg_2v1_var_stream_7" { + label="var stream_7" + n8v1 + } + } + subgraph "cluster n3v1" { + fillcolor="#dddddd" + style=filled + label = "sg_3v1\nstratum 1" + n9v1 + n2v1 + n3v1 + n4v1 + n10v1 + n11v1 + n12v1 + n13v1 + subgraph "cluster_sg_3v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_3v1_var_stream_10" { + label="var stream_10" + n11v1 + } + subgraph "cluster_sg_3v1_var_stream_11" { + label="var stream_11" + n12v1 + } + subgraph "cluster_sg_3v1_var_stream_2" { + label="var stream_2" + n3v1 + } + subgraph "cluster_sg_3v1_var_stream_3" { + label="var stream_3" + n4v1 + } + subgraph "cluster_sg_3v1_var_stream_8" { + label="var stream_8" + n9v1 + } + subgraph "cluster_sg_3v1_var_stream_9" { + label="var stream_9" + n10v1 + } + } + subgraph "cluster n4v1" { + fillcolor="#dddddd" + style=filled + label = "sg_4v1\nstratum 3" + n18v1 + } + subgraph "cluster n5v1" { + fillcolor="#dddddd" + style=filled + label = "sg_5v1\nstratum 0" + n5v1 + subgraph "cluster_sg_5v1_var_stream_4" { + label="var stream_4" + n5v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__graph_reachability__tests__reachability@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__graph_reachability__tests__reachability@graphvis_mermaid.snap new file mode 100644 index 000000000000..eecdd6c3ede5 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__graph_reachability__tests__reachability@graphvis_mermaid.snap @@ -0,0 +1,111 @@ +--- +source: hydro_test_local/src/local/graph_reachability.rs +expression: "reachability.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"(1v1) source_stream(roots)"/]:::pullClass +2v1[\"(2v1) chain()"/]:::pullClass +3v1[/"(3v1) tee()"\]:::pushClass +4v1[/"
(4v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, ()),
>({
use crate::__staged::local::graph_reachability::*;
|r| (r, ())
}),
)
"\]:::pushClass +5v1[\"(5v1) source_stream(edges)"/]:::pullClass +6v1[\"(6v1) join_multiset::<'tick, 'static>()"/]:::pullClass +7v1[\"
(7v1)
map(
stageleft::runtime_support::fn1_type_hint::<
(u32, ((), u32)),
u32,
>({
use crate::__staged::local::graph_reachability::*;
|(_from, (_, to))| to
}),
)
"/]:::pullClass +8v1[\"(8v1) chain()"/]:::pullClass +9v1[\"(9v1) defer_tick_lazy()"/]:::pullClass +10v1[/"(10v1) persist::<'static>()"\]:::pushClass +11v1[/"(11v1) unique::<'tick>()"\]:::pushClass +12v1[/"(12v1) multiset_delta()"\]:::pushClass +13v1[/"
(13v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::graph_reachability::*;
let reached_out__free = reached_out;
|v| {
reached_out__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +14v1["(14v1) handoff"]:::otherClass +15v1["(15v1) handoff"]:::otherClass +16v1["(16v1) handoff"]:::otherClass +17v1["(17v1) handoff"]:::otherClass +18v1[\"(18v1) identity()"/]:::pullClass +19v1["(19v1) handoff"]:::otherClass +20v1["(20v1) handoff"]:::otherClass +1v1-->14v1 +9v1-->|1|2v1 +2v1-->3v1 +3v1-->4v1 +4v1-->15v1 +5v1-->20v1 +6v1-->7v1 +3v1-->16v1 +7v1-->|1|8v1 +8v1-->17v1 +3v1-->10v1 +10v1-->11v1 +11v1-->12v1 +12v1-->13v1 +14v1--x|0|2v1; linkStyle 14 stroke:red +15v1-->|0|6v1 +16v1--x|0|8v1; linkStyle 16 stroke:red +17v1-->18v1 +18v1-->19v1 +19v1--o9v1; linkStyle 19 stroke:red +20v1-->|1|6v1 +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 1v1 + subgraph sg_1v1_var_stream_0 ["var stream_0"] + 1v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 2"] + 6v1 + 7v1 + 8v1 + subgraph sg_2v1_var_stream_5 ["var stream_5"] + 6v1 + end + subgraph sg_2v1_var_stream_6 ["var stream_6"] + 7v1 + end + subgraph sg_2v1_var_stream_7 ["var stream_7"] + 8v1 + end +end +subgraph sg_3v1 ["sg_3v1 stratum 1"] + 9v1 + 2v1 + 3v1 + 4v1 + 10v1 + 11v1 + 12v1 + 13v1 + subgraph sg_3v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_3v1_var_stream_10 ["var stream_10"] + 11v1 + end + subgraph sg_3v1_var_stream_11 ["var stream_11"] + 12v1 + end + subgraph sg_3v1_var_stream_2 ["var stream_2"] + 3v1 + end + subgraph sg_3v1_var_stream_3 ["var stream_3"] + 4v1 + end + subgraph sg_3v1_var_stream_8 ["var stream_8"] + 9v1 + end + subgraph sg_3v1_var_stream_9 ["var stream_9"] + 10v1 + end +end +subgraph sg_4v1 ["sg_4v1 stratum 3"] + 18v1 +end +subgraph sg_5v1 ["sg_5v1 stratum 0"] + 5v1 + subgraph sg_5v1_var_stream_4 ["var stream_4"] + 5v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_static@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_static@graphvis_dot.snap new file mode 100644 index 000000000000..c4f8f14fe2b6 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_static@graphvis_dot.snap @@ -0,0 +1,57 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::negation::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, u32),\l >({\l use crate::__staged::local::negation::*;\l |v| (v, v)\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) persist::<'static>()", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) source_iter({\l use crate::__staged::local::negation::*;\l 3..6\l})\l", shape=invhouse, fillcolor="#88aaff"] + n5v1 [label="(n5v1) anti_join_multiset::<'tick, 'static>()", shape=invhouse, fillcolor="#88aaff"] + n6v1 [label="(n6v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, u32),\l (),\l >({\l use crate::__staged::local::negation::*;\l let output__free = output;\l |v| {\l output__free.send(v.0).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n7v1 [label="(n7v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n3v1 + n3v1 -> n5v1 [label="pos"] + n4v1 -> n7v1 + n5v1 -> n6v1 + n7v1 -> n5v1 [label="neg", color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n4v1 + subgraph "cluster_sg_1v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n1v1 + n2v1 + n3v1 + n5v1 + n6v1 + subgraph "cluster_sg_2v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_2v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_2v1_var_stream_2" { + label="var stream_2" + n3v1 + } + subgraph "cluster_sg_2v1_var_stream_4" { + label="var stream_4" + n5v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_static@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_static@graphvis_mermaid.snap new file mode 100644 index 000000000000..94248f16f7df --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_static@graphvis_mermaid.snap @@ -0,0 +1,48 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::negation::*;
0..5
})
"/]:::pullClass +2v1[\"
(2v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, u32),
>({
use crate::__staged::local::negation::*;
|v| (v, v)
}),
)
"/]:::pullClass +3v1[\"(3v1) persist::<'static>()"/]:::pullClass +4v1[\"
(4v1)
source_iter({
use crate::__staged::local::negation::*;
3..6
})
"/]:::pullClass +5v1[\"(5v1) anti_join_multiset::<'tick, 'static>()"/]:::pullClass +6v1[/"
(6v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
(u32, u32),
(),
>({
use crate::__staged::local::negation::*;
let output__free = output;
|v| {
output__free.send(v.0).unwrap();
}
}),
)
"\]:::pushClass +7v1["(7v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->3v1 +3v1-->|pos|5v1 +4v1-->7v1 +5v1-->6v1 +7v1--x|neg|5v1; linkStyle 5 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 4v1 + subgraph sg_1v1_var_stream_3 ["var stream_3"] + 4v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 1v1 + 2v1 + 3v1 + 5v1 + 6v1 + subgraph sg_2v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_2v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_2v1_var_stream_2 ["var stream_2"] + 3v1 + end + subgraph sg_2v1_var_stream_4 ["var stream_4"] + 5v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_tick@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_tick@graphvis_dot.snap new file mode 100644 index 000000000000..56ddc91d010b --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_tick@graphvis_dot.snap @@ -0,0 +1,57 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::negation::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, u32),\l >({\l use crate::__staged::local::negation::*;\l |v| (v, v)\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) persist::<'static>()", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) source_iter({\l use crate::__staged::local::negation::*;\l 3..6\l})\l", shape=invhouse, fillcolor="#88aaff"] + n5v1 [label="(n5v1) anti_join_multiset::<'tick, 'tick>()", shape=invhouse, fillcolor="#88aaff"] + n6v1 [label="(n6v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, u32),\l (),\l >({\l use crate::__staged::local::negation::*;\l let output__free = output;\l |v| {\l output__free.send(v.0).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n7v1 [label="(n7v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n3v1 + n3v1 -> n5v1 [label="pos"] + n4v1 -> n7v1 + n5v1 -> n6v1 + n7v1 -> n5v1 [label="neg", color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n4v1 + subgraph "cluster_sg_1v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n1v1 + n2v1 + n3v1 + n5v1 + n6v1 + subgraph "cluster_sg_2v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_2v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_2v1_var_stream_2" { + label="var stream_2" + n3v1 + } + subgraph "cluster_sg_2v1_var_stream_4" { + label="var stream_4" + n5v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_tick@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_tick@graphvis_mermaid.snap new file mode 100644 index 000000000000..9803970631a7 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_static_tick@graphvis_mermaid.snap @@ -0,0 +1,48 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::negation::*;
0..5
})
"/]:::pullClass +2v1[\"
(2v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, u32),
>({
use crate::__staged::local::negation::*;
|v| (v, v)
}),
)
"/]:::pullClass +3v1[\"(3v1) persist::<'static>()"/]:::pullClass +4v1[\"
(4v1)
source_iter({
use crate::__staged::local::negation::*;
3..6
})
"/]:::pullClass +5v1[\"(5v1) anti_join_multiset::<'tick, 'tick>()"/]:::pullClass +6v1[/"
(6v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
(u32, u32),
(),
>({
use crate::__staged::local::negation::*;
let output__free = output;
|v| {
output__free.send(v.0).unwrap();
}
}),
)
"\]:::pushClass +7v1["(7v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->3v1 +3v1-->|pos|5v1 +4v1-->7v1 +5v1-->6v1 +7v1--x|neg|5v1; linkStyle 5 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 4v1 + subgraph sg_1v1_var_stream_3 ["var stream_3"] + 4v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 1v1 + 2v1 + 3v1 + 5v1 + 6v1 + subgraph sg_2v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_2v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_2v1_var_stream_2 ["var stream_2"] + 3v1 + end + subgraph sg_2v1_var_stream_4 ["var stream_4"] + 5v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_static@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_static@graphvis_dot.snap new file mode 100644 index 000000000000..c21d12dc48f3 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_static@graphvis_dot.snap @@ -0,0 +1,50 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::negation::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, u32),\l >({\l use crate::__staged::local::negation::*;\l |v| (v, v)\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) source_iter({\l use crate::__staged::local::negation::*;\l 3..6\l})\l", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) anti_join_multiset::<'tick, 'static>()", shape=invhouse, fillcolor="#88aaff"] + n5v1 [label="(n5v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, u32),\l (),\l >({\l use crate::__staged::local::negation::*;\l let output__free = output;\l |v| {\l output__free.send(v.0).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n6v1 [label="(n6v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n4v1 [label="pos"] + n3v1 -> n6v1 + n4v1 -> n5v1 + n6v1 -> n4v1 [label="neg", color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n3v1 + subgraph "cluster_sg_1v1_var_stream_2" { + label="var stream_2" + n3v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n1v1 + n2v1 + n4v1 + n5v1 + subgraph "cluster_sg_2v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_2v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_2v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_static@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_static@graphvis_mermaid.snap new file mode 100644 index 000000000000..3262be16d7be --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_static@graphvis_mermaid.snap @@ -0,0 +1,42 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::negation::*;
0..5
})
"/]:::pullClass +2v1[\"
(2v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, u32),
>({
use crate::__staged::local::negation::*;
|v| (v, v)
}),
)
"/]:::pullClass +3v1[\"
(3v1)
source_iter({
use crate::__staged::local::negation::*;
3..6
})
"/]:::pullClass +4v1[\"(4v1) anti_join_multiset::<'tick, 'static>()"/]:::pullClass +5v1[/"
(5v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
(u32, u32),
(),
>({
use crate::__staged::local::negation::*;
let output__free = output;
|v| {
output__free.send(v.0).unwrap();
}
}),
)
"\]:::pushClass +6v1["(6v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->|pos|4v1 +3v1-->6v1 +4v1-->5v1 +6v1--x|neg|4v1; linkStyle 4 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 3v1 + subgraph sg_1v1_var_stream_2 ["var stream_2"] + 3v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 1v1 + 2v1 + 4v1 + 5v1 + subgraph sg_2v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_2v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_2v1_var_stream_3 ["var stream_3"] + 4v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_tick@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_tick@graphvis_dot.snap new file mode 100644 index 000000000000..2837d7403ca2 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_tick@graphvis_dot.snap @@ -0,0 +1,50 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::negation::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, u32),\l >({\l use crate::__staged::local::negation::*;\l |v| (v, v)\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) source_iter({\l use crate::__staged::local::negation::*;\l 3..6\l})\l", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) anti_join_multiset::<'tick, 'tick>()", shape=invhouse, fillcolor="#88aaff"] + n5v1 [label="(n5v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, u32),\l (),\l >({\l use crate::__staged::local::negation::*;\l let output__free = output;\l |v| {\l output__free.send(v.0).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n6v1 [label="(n6v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n4v1 [label="pos"] + n3v1 -> n6v1 + n4v1 -> n5v1 + n6v1 -> n4v1 [label="neg", color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n3v1 + subgraph "cluster_sg_1v1_var_stream_2" { + label="var stream_2" + n3v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n1v1 + n2v1 + n4v1 + n5v1 + subgraph "cluster_sg_2v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_2v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_2v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_tick@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_tick@graphvis_mermaid.snap new file mode 100644 index 000000000000..c57e2ab81b07 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__anti_join_tick_tick@graphvis_mermaid.snap @@ -0,0 +1,42 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::negation::*;
0..5
})
"/]:::pullClass +2v1[\"
(2v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, u32),
>({
use crate::__staged::local::negation::*;
|v| (v, v)
}),
)
"/]:::pullClass +3v1[\"
(3v1)
source_iter({
use crate::__staged::local::negation::*;
3..6
})
"/]:::pullClass +4v1[\"(4v1) anti_join_multiset::<'tick, 'tick>()"/]:::pullClass +5v1[/"
(5v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
(u32, u32),
(),
>({
use crate::__staged::local::negation::*;
let output__free = output;
|v| {
output__free.send(v.0).unwrap();
}
}),
)
"\]:::pushClass +6v1["(6v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->|pos|4v1 +3v1-->6v1 +4v1-->5v1 +6v1--x|neg|4v1; linkStyle 4 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 3v1 + subgraph sg_1v1_var_stream_2 ["var stream_2"] + 3v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 1v1 + 2v1 + 4v1 + 5v1 + subgraph sg_2v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_2v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_2v1_var_stream_3 ["var stream_3"] + 4v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_static@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_static@graphvis_dot.snap new file mode 100644 index 000000000000..d1331867c6b8 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_static@graphvis_dot.snap @@ -0,0 +1,50 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::negation::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) persist::<'static>()", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) source_iter({\l use crate::__staged::local::negation::*;\l 3..6\l})\l", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) difference_multiset::<'tick, 'static>()", shape=invhouse, fillcolor="#88aaff"] + n5v1 [label="(n5v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::negation::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n6v1 [label="(n6v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n4v1 [label="pos"] + n3v1 -> n6v1 + n4v1 -> n5v1 + n6v1 -> n4v1 [label="neg", color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n3v1 + subgraph "cluster_sg_1v1_var_stream_2" { + label="var stream_2" + n3v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n1v1 + n2v1 + n4v1 + n5v1 + subgraph "cluster_sg_2v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_2v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_2v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_static@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_static@graphvis_mermaid.snap new file mode 100644 index 000000000000..279b4aeea0ca --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_static@graphvis_mermaid.snap @@ -0,0 +1,42 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::negation::*;
0..5
})
"/]:::pullClass +2v1[\"(2v1) persist::<'static>()"/]:::pullClass +3v1[\"
(3v1)
source_iter({
use crate::__staged::local::negation::*;
3..6
})
"/]:::pullClass +4v1[\"(4v1) difference_multiset::<'tick, 'static>()"/]:::pullClass +5v1[/"
(5v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::negation::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +6v1["(6v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->|pos|4v1 +3v1-->6v1 +4v1-->5v1 +6v1--x|neg|4v1; linkStyle 4 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 3v1 + subgraph sg_1v1_var_stream_2 ["var stream_2"] + 3v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 1v1 + 2v1 + 4v1 + 5v1 + subgraph sg_2v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_2v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_2v1_var_stream_3 ["var stream_3"] + 4v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_tick@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_tick@graphvis_dot.snap new file mode 100644 index 000000000000..6ca294309f08 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_tick@graphvis_dot.snap @@ -0,0 +1,50 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::negation::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) persist::<'static>()", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) source_iter({\l use crate::__staged::local::negation::*;\l 3..6\l})\l", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) difference_multiset::<'tick, 'tick>()", shape=invhouse, fillcolor="#88aaff"] + n5v1 [label="(n5v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::negation::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n6v1 [label="(n6v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n4v1 [label="pos"] + n3v1 -> n6v1 + n4v1 -> n5v1 + n6v1 -> n4v1 [label="neg", color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n3v1 + subgraph "cluster_sg_1v1_var_stream_2" { + label="var stream_2" + n3v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n1v1 + n2v1 + n4v1 + n5v1 + subgraph "cluster_sg_2v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_2v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_2v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_tick@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_tick@graphvis_mermaid.snap new file mode 100644 index 000000000000..d52dd519769e --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_static_tick@graphvis_mermaid.snap @@ -0,0 +1,42 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::negation::*;
0..5
})
"/]:::pullClass +2v1[\"(2v1) persist::<'static>()"/]:::pullClass +3v1[\"
(3v1)
source_iter({
use crate::__staged::local::negation::*;
3..6
})
"/]:::pullClass +4v1[\"(4v1) difference_multiset::<'tick, 'tick>()"/]:::pullClass +5v1[/"
(5v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::negation::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +6v1["(6v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->|pos|4v1 +3v1-->6v1 +4v1-->5v1 +6v1--x|neg|4v1; linkStyle 4 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 3v1 + subgraph sg_1v1_var_stream_2 ["var stream_2"] + 3v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 1v1 + 2v1 + 4v1 + 5v1 + subgraph sg_2v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_2v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_2v1_var_stream_3 ["var stream_3"] + 4v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_static@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_static@graphvis_dot.snap new file mode 100644 index 000000000000..290771fe5733 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_static@graphvis_dot.snap @@ -0,0 +1,43 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::negation::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) source_iter({\l use crate::__staged::local::negation::*;\l 3..6\l})\l", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) difference_multiset::<'tick, 'static>()", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::negation::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n5v1 [label="(n5v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n3v1 [label="pos"] + n2v1 -> n5v1 + n3v1 -> n4v1 + n5v1 -> n3v1 [label="neg", color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n2v1 + subgraph "cluster_sg_1v1_var_stream_1" { + label="var stream_1" + n2v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n1v1 + n3v1 + n4v1 + subgraph "cluster_sg_2v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_2v1_var_stream_2" { + label="var stream_2" + n3v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_static@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_static@graphvis_mermaid.snap new file mode 100644 index 000000000000..057ecf87eca6 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_static@graphvis_mermaid.snap @@ -0,0 +1,36 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::negation::*;
0..5
})
"/]:::pullClass +2v1[\"
(2v1)
source_iter({
use crate::__staged::local::negation::*;
3..6
})
"/]:::pullClass +3v1[\"(3v1) difference_multiset::<'tick, 'static>()"/]:::pullClass +4v1[/"
(4v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::negation::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +5v1["(5v1) handoff"]:::otherClass +1v1-->|pos|3v1 +2v1-->5v1 +3v1-->4v1 +5v1--x|neg|3v1; linkStyle 3 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 2v1 + subgraph sg_1v1_var_stream_1 ["var stream_1"] + 2v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 1v1 + 3v1 + 4v1 + subgraph sg_2v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_2v1_var_stream_2 ["var stream_2"] + 3v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_tick@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_tick@graphvis_dot.snap new file mode 100644 index 000000000000..a420e8341793 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_tick@graphvis_dot.snap @@ -0,0 +1,43 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::negation::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) source_iter({\l use crate::__staged::local::negation::*;\l 3..6\l})\l", shape=invhouse, fillcolor="#88aaff"] + n3v1 [label="(n3v1) difference_multiset::<'tick, 'tick>()", shape=invhouse, fillcolor="#88aaff"] + n4v1 [label="(n4v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::negation::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n5v1 [label="(n5v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n3v1 [label="pos"] + n2v1 -> n5v1 + n3v1 -> n4v1 + n5v1 -> n3v1 [label="neg", color=red] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n2v1 + subgraph "cluster_sg_1v1_var_stream_1" { + label="var stream_1" + n2v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 1" + n1v1 + n3v1 + n4v1 + subgraph "cluster_sg_2v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_2v1_var_stream_2" { + label="var stream_2" + n3v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_tick@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_tick@graphvis_mermaid.snap new file mode 100644 index 000000000000..ac3aa354d3d8 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__negation__tests__difference_tick_tick@graphvis_mermaid.snap @@ -0,0 +1,36 @@ +--- +source: hydro_test_local/src/local/negation.rs +expression: "flow.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::negation::*;
0..5
})
"/]:::pullClass +2v1[\"
(2v1)
source_iter({
use crate::__staged::local::negation::*;
3..6
})
"/]:::pullClass +3v1[\"(3v1) difference_multiset::<'tick, 'tick>()"/]:::pullClass +4v1[/"
(4v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::negation::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +5v1["(5v1) handoff"]:::otherClass +1v1-->|pos|3v1 +2v1-->5v1 +3v1-->4v1 +5v1--x|neg|3v1; linkStyle 3 stroke:red +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 2v1 + subgraph sg_1v1_var_stream_1 ["var stream_1"] + 2v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 1"] + 1v1 + 3v1 + 4v1 + subgraph sg_2v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_2v1_var_stream_2 ["var stream_2"] + 3v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join@graphvis_dot.snap new file mode 100644 index 000000000000..58d834123212 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join@graphvis_dot.snap @@ -0,0 +1,67 @@ +--- +source: hydro_test_local/src/local/teed_join.rs +expression: "joined.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_stream(input_stream)", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) tee()", shape=house, fillcolor="#ffff88"] + n3v1 [label="(n3v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, ()),\l >({\l use crate::__staged::local::teed_join::*;\l |v| (v + 1, ())\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n4v1 [label="(n4v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, ()),\l >({\l use crate::__staged::local::teed_join::*;\l |v| (v - 1, ())\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n5v1 [label="(n5v1) join_multiset::<'tick, 'tick>()", shape=invhouse, fillcolor="#88aaff"] + n6v1 [label="(n6v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, ((), ())),\l u32,\l >({\l use crate::__staged::local::teed_join::*;\l |t| t.0\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n7v3 [label="(n7v3) handoff", shape=parallelogram, fillcolor="#ddddff"] + n8v1 [label="(n8v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::teed_join::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n9v1 [label="(n9v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n3v1 + n2v1 -> n4v1 + n3v1 -> n7v3 + n4v1 -> n9v1 + n5v1 -> n6v1 + n7v3 -> n5v1 [label="0"] + n6v1 -> n8v1 + n9v1 -> n5v1 [label="1"] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n1v1 + n2v1 + n3v1 + n4v1 + subgraph "cluster_sg_1v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_1v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_1v1_var_stream_2" { + label="var stream_2" + n3v1 + } + subgraph "cluster_sg_1v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 0" + n5v1 + n6v1 + n8v1 + subgraph "cluster_sg_2v1_var_stream_4" { + label="var stream_4" + n5v1 + } + subgraph "cluster_sg_2v1_var_stream_5" { + label="var stream_5" + n6v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join@graphvis_mermaid.snap new file mode 100644 index 000000000000..7b51b6cefaa4 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join@graphvis_mermaid.snap @@ -0,0 +1,57 @@ +--- +source: hydro_test_local/src/local/teed_join.rs +expression: "joined.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"(1v1) source_stream(input_stream)"/]:::pullClass +2v1[/"(2v1) tee()"\]:::pushClass +3v1[/"
(3v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, ()),
>({
use crate::__staged::local::teed_join::*;
|v| (v + 1, ())
}),
)
"\]:::pushClass +4v1[/"
(4v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, ()),
>({
use crate::__staged::local::teed_join::*;
|v| (v - 1, ())
}),
)
"\]:::pushClass +5v1[\"(5v1) join_multiset::<'tick, 'tick>()"/]:::pullClass +6v1[\"
(6v1)
map(
stageleft::runtime_support::fn1_type_hint::<
(u32, ((), ())),
u32,
>({
use crate::__staged::local::teed_join::*;
|t| t.0
}),
)
"/]:::pullClass +7v3["(7v3) handoff"]:::otherClass +8v1[/"
(8v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::teed_join::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +9v1["(9v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->3v1 +2v1-->4v1 +3v1-->7v3 +4v1-->9v1 +5v1-->6v1 +7v3-->|0|5v1 +6v1-->8v1 +9v1-->|1|5v1 +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 1v1 + 2v1 + 3v1 + 4v1 + subgraph sg_1v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_1v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_1v1_var_stream_2 ["var stream_2"] + 3v1 + end + subgraph sg_1v1_var_stream_3 ["var stream_3"] + 4v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 0"] + 5v1 + 6v1 + 8v1 + subgraph sg_2v1_var_stream_4 ["var stream_4"] + 5v1 + end + subgraph sg_2v1_var_stream_5 ["var stream_5"] + 6v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_dot.snap new file mode 100644 index 000000000000..63d56991eb0f --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_dot.snap @@ -0,0 +1,22 @@ +--- +source: hydro_test_local/src/local/teed_join.rs +expression: "joined.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_iter({\l use crate::__staged::local::teed_join::*;\l 0..5\l})\l", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::teed_join::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n1v1 -> n2v1 + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n1v1 + n2v1 + subgraph "cluster_sg_1v1_var_stream_7" { + label="var stream_7" + n1v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_mermaid.snap new file mode 100644 index 000000000000..c6accffa6e1f --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_mermaid.snap @@ -0,0 +1,20 @@ +--- +source: hydro_test_local/src/local/teed_join.rs +expression: "joined.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"
(1v1)
source_iter({
use crate::__staged::local::teed_join::*;
0..5
})
"/]:::pullClass +2v1[/"
(2v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::teed_join::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +1v1-->2v1 +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 1v1 + 2v1 + subgraph sg_1v1_var_stream_7 ["var stream_7"] + 1v1 + end +end diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_twice@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_twice@graphvis_dot.snap new file mode 100644 index 000000000000..1054cd6d90c3 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_twice@graphvis_dot.snap @@ -0,0 +1,77 @@ +--- +source: hydro_test_local/src/local/teed_join.rs +expression: "joined.meta_graph().unwrap().to_dot(& Default :: default())" +--- +digraph { + node [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace", style=filled]; + edge [fontname="Monaco,Menlo,Consolas,"Droid Sans Mono",Inconsolata,"Courier New",monospace"]; + n1v1 [label="(n1v1) source_stream(input_stream)", shape=invhouse, fillcolor="#88aaff"] + n2v1 [label="(n2v1) tee()", shape=house, fillcolor="#ffff88"] + n3v1 [label="(n3v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, ()),\l >({\l use crate::__staged::local::teed_join::*;\l |v| (v + 1, ())\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n4v1 [label="(n4v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (u32, ()),\l >({\l use crate::__staged::local::teed_join::*;\l |v| (v - 1, ())\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n5v1 [label="(n5v1) join_multiset::<'tick, 'tick>()", shape=invhouse, fillcolor="#88aaff"] + n6v1 [label="(n6v1) map(\l stageleft::runtime_support::fn1_type_hint::<\l (u32, ((), ())),\l u32,\l >({\l use crate::__staged::local::teed_join::*;\l |t| t.0\l }),\l)\l", shape=invhouse, fillcolor="#88aaff"] + n7v1 [label="(n7v1) tee()", shape=house, fillcolor="#ffff88"] + n8v1 [label="(n8v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::teed_join::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n9v1 [label="(n9v1) for_each(\l stageleft::runtime_support::fn1_type_hint::<\l u32,\l (),\l >({\l use crate::__staged::local::teed_join::*;\l let output__free = output;\l |v| {\l output__free.send(v).unwrap();\l }\l }),\l)\l", shape=house, fillcolor="#ffff88"] + n10v1 [label="(n10v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n11v1 [label="(n11v1) handoff", shape=parallelogram, fillcolor="#ddddff"] + n1v1 -> n2v1 + n2v1 -> n3v1 + n2v1 -> n4v1 + n3v1 -> n10v1 + n4v1 -> n11v1 + n5v1 -> n6v1 + n6v1 -> n7v1 + n7v1 -> n8v1 + n7v1 -> n9v1 + n10v1 -> n5v1 [label="0"] + n11v1 -> n5v1 [label="1"] + subgraph "cluster n1v1" { + fillcolor="#dddddd" + style=filled + label = "sg_1v1\nstratum 0" + n1v1 + n2v1 + n3v1 + n4v1 + subgraph "cluster_sg_1v1_var_stream_0" { + label="var stream_0" + n1v1 + } + subgraph "cluster_sg_1v1_var_stream_1" { + label="var stream_1" + n2v1 + } + subgraph "cluster_sg_1v1_var_stream_2" { + label="var stream_2" + n3v1 + } + subgraph "cluster_sg_1v1_var_stream_3" { + label="var stream_3" + n4v1 + } + } + subgraph "cluster n2v1" { + fillcolor="#dddddd" + style=filled + label = "sg_2v1\nstratum 0" + n5v1 + n6v1 + n7v1 + n8v1 + n9v1 + subgraph "cluster_sg_2v1_var_stream_4" { + label="var stream_4" + n5v1 + } + subgraph "cluster_sg_2v1_var_stream_5" { + label="var stream_5" + n6v1 + } + subgraph "cluster_sg_2v1_var_stream_6" { + label="var stream_6" + n7v1 + } + } +} diff --git a/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_twice@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_twice@graphvis_mermaid.snap new file mode 100644 index 000000000000..bfda6cfb2068 --- /dev/null +++ b/hydro_test_local/src/local/snapshots/hydro_test_local__local__teed_join__tests__teed_join_twice@graphvis_mermaid.snap @@ -0,0 +1,66 @@ +--- +source: hydro_test_local/src/local/teed_join.rs +expression: "joined.meta_graph().unwrap().to_mermaid(& Default :: default())" +--- +%%{init:{'theme':'base','themeVariables':{'clusterBkg':'#ddd','clusterBorder':'#888'}}}%% +flowchart TD +classDef pullClass fill:#8af,stroke:#000,text-align:left,white-space:pre +classDef pushClass fill:#ff8,stroke:#000,text-align:left,white-space:pre +classDef otherClass fill:#fdc,stroke:#000,text-align:left,white-space:pre +linkStyle default stroke:#aaa +1v1[\"(1v1) source_stream(input_stream)"/]:::pullClass +2v1[/"(2v1) tee()"\]:::pushClass +3v1[/"
(3v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, ()),
>({
use crate::__staged::local::teed_join::*;
|v| (v + 1, ())
}),
)
"\]:::pushClass +4v1[/"
(4v1)
map(
stageleft::runtime_support::fn1_type_hint::<
u32,
(u32, ()),
>({
use crate::__staged::local::teed_join::*;
|v| (v - 1, ())
}),
)
"\]:::pushClass +5v1[\"(5v1) join_multiset::<'tick, 'tick>()"/]:::pullClass +6v1[\"
(6v1)
map(
stageleft::runtime_support::fn1_type_hint::<
(u32, ((), ())),
u32,
>({
use crate::__staged::local::teed_join::*;
|t| t.0
}),
)
"/]:::pullClass +7v1[/"(7v1) tee()"\]:::pushClass +8v1[/"
(8v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::teed_join::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +9v1[/"
(9v1)
for_each(
stageleft::runtime_support::fn1_type_hint::<
u32,
(),
>({
use crate::__staged::local::teed_join::*;
let output__free = output;
|v| {
output__free.send(v).unwrap();
}
}),
)
"\]:::pushClass +10v1["(10v1) handoff"]:::otherClass +11v1["(11v1) handoff"]:::otherClass +1v1-->2v1 +2v1-->3v1 +2v1-->4v1 +3v1-->10v1 +4v1-->11v1 +5v1-->6v1 +6v1-->7v1 +7v1-->8v1 +7v1-->9v1 +10v1-->|0|5v1 +11v1-->|1|5v1 +subgraph sg_1v1 ["sg_1v1 stratum 0"] + 1v1 + 2v1 + 3v1 + 4v1 + subgraph sg_1v1_var_stream_0 ["var stream_0"] + 1v1 + end + subgraph sg_1v1_var_stream_1 ["var stream_1"] + 2v1 + end + subgraph sg_1v1_var_stream_2 ["var stream_2"] + 3v1 + end + subgraph sg_1v1_var_stream_3 ["var stream_3"] + 4v1 + end +end +subgraph sg_2v1 ["sg_2v1 stratum 0"] + 5v1 + 6v1 + 7v1 + 8v1 + 9v1 + subgraph sg_2v1_var_stream_4 ["var stream_4"] + 5v1 + end + subgraph sg_2v1_var_stream_5 ["var stream_5"] + 6v1 + end + subgraph sg_2v1_var_stream_6 ["var stream_6"] + 7v1 + end +end diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_no_replay@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_replay@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_replay@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_replay@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_replay@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_replay@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_replay@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_replay@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__chat_app__tests__chat_app_replay@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__count_elems__tests__count@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__count_elems__tests__count@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__count_elems__tests__count@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__count_elems__tests__count@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__count_elems__tests__count@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__count_elems__tests__count@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__count_elems__tests__count@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__count_elems__tests__count@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__graph_reachability__tests__reachability@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__graph_reachability__tests__reachability@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__graph_reachability__tests__reachability@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__graph_reachability__tests__reachability@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__graph_reachability__tests__reachability@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__graph_reachability__tests__reachability@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__graph_reachability__tests__reachability@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__graph_reachability__tests__reachability@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_static@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_static@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_static@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_static@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_static@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_static@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_static@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_static@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_tick@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_tick@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_tick@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_tick@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_tick@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_tick@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_tick@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_static_tick@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_static@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_static@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_static@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_static@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_static@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_static@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_static@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_static@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_tick@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_tick@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_tick@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_tick@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_tick@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_tick@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_tick@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__anti_join_tick_tick@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_static@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_static@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_static@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_static@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_static@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_static@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_static@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_static@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_tick@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_tick@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_tick@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_tick@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_tick@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_tick@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_tick@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_static_tick@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_static@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_static@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_static@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_static@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_static@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_static@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_static@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_static@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_tick@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_tick@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_tick@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_tick@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_tick@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_tick@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_tick@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__negation__tests__difference_tick_tick@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_multi_node@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_twice@graphvis_dot.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_twice@graphvis_dot.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_twice@graphvis_dot.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_twice@graphvis_dot.snap diff --git a/hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_twice@graphvis_mermaid.snap b/hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_twice@graphvis_mermaid.snap similarity index 100% rename from hydroflow_plus_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_twice@graphvis_mermaid.snap rename to hydro_test_local/src/local/snapshots/hydroflow_plus_test_local__local__teed_join__tests__teed_join_twice@graphvis_mermaid.snap diff --git a/hydroflow_plus_test_local/src/local/teed_join.rs b/hydro_test_local/src/local/teed_join.rs similarity index 96% rename from hydroflow_plus_test_local/src/local/teed_join.rs rename to hydro_test_local/src/local/teed_join.rs index 979a5a149945..01a097e70784 100644 --- a/hydroflow_plus_test_local/src/local/teed_join.rs +++ b/hydro_test_local/src/local/teed_join.rs @@ -1,9 +1,9 @@ +use hydro_lang::deploy::MultiGraph; +use hydro_lang::hydroflow::scheduled::graph::Hydroflow; +use hydro_lang::*; use hydroflow::futures::stream::Stream; use hydroflow::tokio::sync::mpsc::UnboundedSender; use hydroflow::tokio_stream::wrappers::UnboundedReceiverStream; -use hydroflow_plus::deploy::MultiGraph; -use hydroflow_plus::hydroflow::scheduled::graph::Hydroflow; -use hydroflow_plus::*; use stageleft::{Quoted, RuntimeData}; struct N0 {} diff --git a/hydroflow_plus_test_local_macro/Cargo.toml b/hydro_test_local_macro/Cargo.toml similarity index 61% rename from hydroflow_plus_test_local_macro/Cargo.toml rename to hydro_test_local_macro/Cargo.toml index 693f44dcf310..aee5288b6155 100644 --- a/hydroflow_plus_test_local_macro/Cargo.toml +++ b/hydro_test_local_macro/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hydroflow_plus_test_local_macro" +name = "hydro_test_local_macro" publish = false version = "0.0.0" edition = "2021" @@ -9,10 +9,10 @@ workspace = true [lib] proc-macro = true -path = "../hydroflow_plus_test_local/src/lib.rs" +path = "../hydro_test_local/src/lib.rs" [dependencies] -hydroflow_plus = { path = "../hydroflow_plus", version = "^0.10.0", features = ["build"] } +hydro_lang = { path = "../hydro_lang", version = "^0.10.0", features = ["build"] } stageleft = { path = "../stageleft", version = "^0.5.0" } rand = "0.8.0" diff --git a/hydro_test_local_macro/build.rs b/hydro_test_local_macro/build.rs new file mode 100644 index 000000000000..3a3e64860e91 --- /dev/null +++ b/hydro_test_local_macro/build.rs @@ -0,0 +1,5 @@ +use std::path::Path; + +fn main() { + stageleft_tool::gen_macro(Path::new("../hydro_test_local"), "hydro_test_local"); +} diff --git a/hydroflow_plus_test_local_macro/build.rs b/hydroflow_plus_test_local_macro/build.rs deleted file mode 100644 index fc15497c783d..000000000000 --- a/hydroflow_plus_test_local_macro/build.rs +++ /dev/null @@ -1,8 +0,0 @@ -use std::path::Path; - -fn main() { - stageleft_tool::gen_macro( - Path::new("../hydroflow_plus_test_local"), - "hydroflow_plus_test_local", - ); -} diff --git a/stageleft_macro/src/lib.rs b/stageleft_macro/src/lib.rs index b36241554b9d..52e6cf6e3ffa 100644 --- a/stageleft_macro/src/lib.rs +++ b/stageleft_macro/src/lib.rs @@ -7,7 +7,7 @@ use syn::{AngleBracketedGenericArguments, Token, Type}; mod quote_impl; -/// Creates a quoted expression for Hydroflow+. +/// Creates a quoted expression for Hydro. /// /// Creates a quoted expression, which can be typechecked but has its AST serialized /// until it is spliced into a staged entrypoint. Returns a value which implements diff --git a/template/hydroflow_plus/.cargo/config.toml b/template/hydro/.cargo/config.toml similarity index 100% rename from template/hydroflow_plus/.cargo/config.toml rename to template/hydro/.cargo/config.toml diff --git a/template/hydroflow_plus/.gitignore b/template/hydro/.gitignore similarity index 100% rename from template/hydroflow_plus/.gitignore rename to template/hydro/.gitignore diff --git a/template/hydroflow_plus/Cargo.toml b/template/hydro/Cargo.toml similarity index 63% rename from template/hydroflow_plus/Cargo.toml rename to template/hydro/Cargo.toml index 202a7a2663d5..fb7329e356a3 100644 --- a/template/hydroflow_plus/Cargo.toml +++ b/template/hydro/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hydroflow-plus-template" +name = "hydro-template" publish = false version = "0.0.0" edition = "2021" @@ -9,8 +9,8 @@ default = ["stageleft_devel"] stageleft_devel = [] [dependencies] -hydroflow_plus = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}" } -hydroflow_plus_std = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}" } +hydro_lang = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}" } +hydro_std = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}" } stageleft = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}" } tokio = { version = "1.29.0", features = [ "full" ] } @@ -20,7 +20,7 @@ stageleft_tool = { git = "{{ hydroflow_git | default: 'https://github.com/hydro- [dev-dependencies] async-ssh2-lite = { version = "0.5.0", features = ["vendored-openssl"] } hydro_deploy = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}" } -hydroflow_plus = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}", features = [ +hydro_lang = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}", features = [ "deploy", ] } tokio-stream = { version = "0.1.3", default-features = false } diff --git a/template/hydro/README.md b/template/hydro/README.md new file mode 100644 index 000000000000..97f328881f9c --- /dev/null +++ b/template/hydro/README.md @@ -0,0 +1,29 @@ +## Getting Started +This is a template for a Rust project that uses [Hydro](http://github.com/hydro-project/hydroflow) for distributed services. To generate a project, run + +```bash +cargo install cargo-generate +cargo generate gh:hydro-project/hydroflow template/hydro +cd +``` + +After `cd`ing into the workspace, run the sample tests + +Then test the project: +```bash +cargo test +``` + +To learn more about the template, see the [Hydro Quickstart](https://hydro.run/docs/hydro/quickstart/first-dataflow). + +## Project Structure +The template includes a sample program `first_ten_distributed`. + +`first_ten_distributed` demonstrates how to use Hydro to create dataflow programs for a distributed system, and can be launched by running `cargo run -p flow --example first_ten_distributed`. Note the use of `--example` here because `src/bin/first_ten_distributed.rs` contains the binary that will be launched for each process, whereas `examples/first_ten_distributed.rs` contains a deployment script for connecting the processes together. + +This template also comes with an example of deploying the `first_ten_distributed` flow to Google Cloud. To deploy, you will need to install the [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) and [Terraform](https://developer.hashicorp.com/terraform/install). Then, authenticate with Google Cloud and launch the deployment script with your project ID as an argument: + +```bash +$ gcloud auth application-default login +$ cargo run --example first_ten_distributed_gcp -- YOUR_PROJECT_ID_HERE +``` diff --git a/template/hydroflow_plus/build.rs b/template/hydro/build.rs similarity index 100% rename from template/hydroflow_plus/build.rs rename to template/hydro/build.rs diff --git a/template/hydroflow_plus/cargo-generate.toml b/template/hydro/cargo-generate.toml similarity index 100% rename from template/hydroflow_plus/cargo-generate.toml rename to template/hydro/cargo-generate.toml diff --git a/template/hydroflow_plus/examples/first_ten.rs b/template/hydro/examples/first_ten.rs similarity index 73% rename from template/hydroflow_plus/examples/first_ten.rs rename to template/hydro/examples/first_ten.rs index 51d614431fed..f0cd0370c313 100644 --- a/template/hydroflow_plus/examples/first_ten.rs +++ b/template/hydro/examples/first_ten.rs @@ -4,9 +4,9 @@ use hydro_deploy::Deployment; async fn main() { let mut deployment = Deployment::new(); - let flow = hydroflow_plus::FlowBuilder::new(); + let flow = hydro_lang::FlowBuilder::new(); let process = flow.process(); - hydroflow_plus_template::first_ten::first_ten(&process); + hydro_template::first_ten::first_ten(&process); let _nodes = flow .with_process(&process, deployment.Localhost()) diff --git a/template/hydroflow_plus/examples/first_ten_cluster.rs b/template/hydro/examples/first_ten_cluster.rs similarity index 74% rename from template/hydroflow_plus/examples/first_ten_cluster.rs rename to template/hydro/examples/first_ten_cluster.rs index c421570fad88..97471849c37f 100644 --- a/template/hydroflow_plus/examples/first_ten_cluster.rs +++ b/template/hydro/examples/first_ten_cluster.rs @@ -4,10 +4,10 @@ use hydro_deploy::Deployment; async fn main() { let mut deployment = Deployment::new(); - let flow = hydroflow_plus::FlowBuilder::new(); + let flow = hydro_lang::FlowBuilder::new(); let leader = flow.process(); let workers = flow.cluster(); - hydroflow_plus_template::first_ten_cluster::first_ten_cluster(&leader, &workers); + hydro_template::first_ten_cluster::first_ten_cluster(&leader, &workers); let _nodes = flow .with_process(&leader, deployment.Localhost()) diff --git a/template/hydroflow_plus/examples/first_ten_cluster_gcp.rs b/template/hydro/examples/first_ten_cluster_gcp.rs similarity index 90% rename from template/hydroflow_plus/examples/first_ten_cluster_gcp.rs rename to template/hydro/examples/first_ten_cluster_gcp.rs index edb8d6ca98cd..872f3db748e1 100644 --- a/template/hydroflow_plus/examples/first_ten_cluster_gcp.rs +++ b/template/hydro/examples/first_ten_cluster_gcp.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use hydro_deploy::gcp::GcpNetwork; use hydro_deploy::Deployment; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; use tokio::sync::RwLock; static RELEASE_RUSTFLAGS: &str = @@ -17,10 +17,10 @@ async fn main() { let mut deployment = Deployment::new(); let vpc = Arc::new(RwLock::new(GcpNetwork::new(&gcp_project, None))); - let flow = hydroflow_plus::FlowBuilder::new(); + let flow = hydro_lang::FlowBuilder::new(); let leader = flow.process(); let workers = flow.cluster(); - hydroflow_plus_template::first_ten_cluster::first_ten_cluster(&leader, &workers); + hydro_template::first_ten_cluster::first_ten_cluster(&leader, &workers); let _nodes = flow .with_process( diff --git a/template/hydroflow_plus/examples/first_ten_distributed.rs b/template/hydro/examples/first_ten_distributed.rs similarity index 73% rename from template/hydroflow_plus/examples/first_ten_distributed.rs rename to template/hydro/examples/first_ten_distributed.rs index a84f542c2ad1..86ea92f4ab5a 100644 --- a/template/hydroflow_plus/examples/first_ten_distributed.rs +++ b/template/hydro/examples/first_ten_distributed.rs @@ -4,10 +4,10 @@ use hydro_deploy::Deployment; async fn main() { let mut deployment = Deployment::new(); - let flow = hydroflow_plus::FlowBuilder::new(); + let flow = hydro_lang::FlowBuilder::new(); let p1 = flow.process(); let p2 = flow.process(); - hydroflow_plus_template::first_ten_distributed::first_ten_distributed(&p1, &p2); + hydro_template::first_ten_distributed::first_ten_distributed(&p1, &p2); let _nodes = flow .with_process(&p1, deployment.Localhost()) diff --git a/template/hydroflow_plus/examples/first_ten_distributed_gcp.rs b/template/hydro/examples/first_ten_distributed_gcp.rs similarity index 89% rename from template/hydroflow_plus/examples/first_ten_distributed_gcp.rs rename to template/hydro/examples/first_ten_distributed_gcp.rs index 1386023e4b95..61b2040d13af 100644 --- a/template/hydroflow_plus/examples/first_ten_distributed_gcp.rs +++ b/template/hydro/examples/first_ten_distributed_gcp.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use hydro_deploy::gcp::GcpNetwork; use hydro_deploy::Deployment; -use hydroflow_plus::deploy::TrybuildHost; +use hydro_lang::deploy::TrybuildHost; use tokio::sync::RwLock; static RELEASE_RUSTFLAGS: &str = @@ -17,10 +17,10 @@ async fn main() { let mut deployment = Deployment::new(); let vpc = Arc::new(RwLock::new(GcpNetwork::new(&gcp_project, None))); - let flow = hydroflow_plus::FlowBuilder::new(); + let flow = hydro_lang::FlowBuilder::new(); let p1 = flow.process(); let p2 = flow.process(); - hydroflow_plus_template::first_ten_distributed::first_ten_distributed(&p1, &p2); + hydro_template::first_ten_distributed::first_ten_distributed(&p1, &p2); let _nodes = flow .with_process( diff --git a/template/hydroflow_plus/rust-toolchain.toml b/template/hydro/rust-toolchain.toml similarity index 100% rename from template/hydroflow_plus/rust-toolchain.toml rename to template/hydro/rust-toolchain.toml diff --git a/template/hydroflow_plus/src/first_ten.rs b/template/hydro/src/first_ten.rs similarity index 85% rename from template/hydroflow_plus/src/first_ten.rs rename to template/hydro/src/first_ten.rs index 86fe2feb7528..c00b872f8949 100644 --- a/template/hydroflow_plus/src/first_ten.rs +++ b/template/hydro/src/first_ten.rs @@ -1,4 +1,4 @@ -use hydroflow_plus::*; +use hydro_lang::*; pub fn first_ten(process: &Process) { process diff --git a/template/hydroflow_plus/src/first_ten_cluster.rs b/template/hydro/src/first_ten_cluster.rs similarity index 89% rename from template/hydroflow_plus/src/first_ten_cluster.rs rename to template/hydro/src/first_ten_cluster.rs index f328d3b860e8..a30a9884e78b 100644 --- a/template/hydroflow_plus/src/first_ten_cluster.rs +++ b/template/hydro/src/first_ten_cluster.rs @@ -1,4 +1,4 @@ -use hydroflow_plus::*; +use hydro_lang::*; pub struct Leader {} pub struct Worker {} @@ -16,8 +16,8 @@ pub fn first_ten_cluster<'a>(leader: &Process<'a, Leader>, workers: &Cluster<'a, #[cfg(test)] mod tests { use hydro_deploy::Deployment; - use hydroflow_plus::deploy::DeployCrateWrapper; - use hydroflow_plus::hydroflow::futures::StreamExt; + use hydro_lang::deploy::DeployCrateWrapper; + use hydro_lang::hydroflow::futures::StreamExt; use tokio_stream::wrappers::UnboundedReceiverStream; #[tokio::test] @@ -25,7 +25,7 @@ mod tests { let mut deployment = Deployment::new(); let localhost = deployment.Localhost(); - let flow = hydroflow_plus::FlowBuilder::new(); + let flow = hydro_lang::FlowBuilder::new(); let leader = flow.process(); let workers = flow.cluster(); super::first_ten_cluster(&leader, &workers); diff --git a/template/hydroflow_plus/src/first_ten_distributed.rs b/template/hydro/src/first_ten_distributed.rs similarity index 87% rename from template/hydroflow_plus/src/first_ten_distributed.rs rename to template/hydro/src/first_ten_distributed.rs index 6445b392b769..a5febbba29ae 100644 --- a/template/hydroflow_plus/src/first_ten_distributed.rs +++ b/template/hydro/src/first_ten_distributed.rs @@ -1,4 +1,4 @@ -use hydroflow_plus::*; +use hydro_lang::*; pub struct P1 {} pub struct P2 {} @@ -12,8 +12,8 @@ pub fn first_ten_distributed<'a>(p1: &Process<'a, P1>, p2: &Process<'a, P2>) { #[cfg(test)] mod tests { use hydro_deploy::Deployment; - use hydroflow_plus::deploy::DeployCrateWrapper; - use hydroflow_plus::hydroflow::futures::StreamExt; + use hydro_lang::deploy::DeployCrateWrapper; + use hydro_lang::hydroflow::futures::StreamExt; use tokio_stream::wrappers::UnboundedReceiverStream; #[tokio::test] @@ -21,7 +21,7 @@ mod tests { let mut deployment = Deployment::new(); let localhost = deployment.Localhost(); - let flow = hydroflow_plus::FlowBuilder::new(); + let flow = hydro_lang::FlowBuilder::new(); let p1 = flow.process(); let p2 = flow.process(); super::first_ten_distributed(&p1, &p2); diff --git a/template/hydroflow_plus/src/lib.rs b/template/hydro/src/lib.rs similarity index 100% rename from template/hydroflow_plus/src/lib.rs rename to template/hydro/src/lib.rs diff --git a/template/hydroflow_plus/README.md b/template/hydroflow_plus/README.md deleted file mode 100644 index a4f1058c359d..000000000000 --- a/template/hydroflow_plus/README.md +++ /dev/null @@ -1,29 +0,0 @@ -## Getting Started -This is a template for a Rust project that uses [Hydroflow+](http://github.com/hydro-project/hydroflow) for distributed services. To generate a project, run - -```bash -cargo install cargo-generate -cargo generate gh:hydro-project/hydroflow template/hydroflow_plus -cd -``` - -After `cd`ing into the workspace, run the sample tests - -Then test the project: -```bash -cargo test -``` - -To learn more about the template, see the [Hydroflow+ Quickstart](https://hydro.run/docs/hydroflow_plus/quickstart/first-dataflow). - -## Project Structure -The template includes a sample program `first_ten_distributed`. - -`first_ten_distributed` demonstrates how to use Hydroflow+ to create dataflow programs for a distributed system, and can be launched by running `cargo run -p flow --example first_ten_distributed`. Note the use of `--example` here because `src/bin/first_ten_distributed.rs` contains the binary that will be launched for each process, whereas `examples/first_ten_distributed.rs` contains a deployment script for connecting the processes together. - -This template also comes with an example of deploying the `first_ten_distributed` flow to Google Cloud. To deploy, you will need to install the [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) and [Terraform](https://developer.hashicorp.com/terraform/install). Then, authenticate with Google Cloud and launch the deployment script with your project ID as an argument: - -```bash -$ gcloud auth application-default login -$ cargo run --example first_ten_distributed_gcp -- YOUR_PROJECT_ID_HERE -```