Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hydroflow_plus_std): extract initial Hydroflow+ utilities into a standard library #1591

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
--bump ${{ inputs.bump }} --bump-dependencies auto
${{ inputs.execute && '--execute' || '--no-publish' }}
hydroflow hydroflow_lang hydroflow_macro hydroflow_plus
hydroflow_datalog hydroflow_datalog_core
hydroflow_plus_std hydroflow_datalog hydroflow_datalog_core
hydro_deploy hydro_cli hydroflow_deploy_integration
stageleft stageleft_macro stageleft_tool
multiplatform_test
Expand Down
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ members = [
"hydroflow_lang",
"hydroflow_macro",
"hydroflow_plus",
"hydroflow_plus_std",
"hydroflow_plus_test",
"hydroflow_plus_test_local",
"hydroflow_plus_test_local_macro",
Expand Down
Empty file added hydroflow_plus_std/CHANGELOG.md
Empty file.
28 changes: 28 additions & 0 deletions hydroflow_plus_std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "hydroflow_plus_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+"

[lints]
workspace = true

[lib]
path = "src/lib.rs"

[dependencies]
hydroflow_plus = { path = "../hydroflow_plus", 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" }
insta = "1.39"
hydro_deploy = { path = "../hydro_deploy/core", version = "^0.10.0" }
async-ssh2-lite = { version = "0.5.0", features = ["vendored-openssl"] }
ctor = "0.2.8"
3 changes: 3 additions & 0 deletions hydroflow_plus_std/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
stageleft_tool::gen_final!();
}
13 changes: 13 additions & 0 deletions hydroflow_plus_std/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
stageleft::stageleft_no_entry_crate!();

pub mod quorum;
pub mod request_response;

#[stageleft::runtime]
#[cfg(test)]
mod tests {
#[ctor::ctor]
fn init() {
hydroflow_plus::deploy::init_test();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::hash::Hash;
use hydroflow_plus::*;
use location::NoTick;

#[expect(clippy::type_complexity, reason = "internal paxos code // TODO")]
#[expect(clippy::type_complexity, reason = "stream types with ordering")]
pub fn collect_quorum_with_response<
'a,
L: Location<'a> + NoTick,
Expand Down Expand Up @@ -99,7 +99,7 @@ pub fn collect_quorum_with_response<
)
}

#[expect(clippy::type_complexity, reason = "quorum types are complex")]
#[expect(clippy::type_complexity, reason = "stream types with ordering")]
pub fn collect_quorum<'a, L: Location<'a> + NoTick, Order, K: Clone + Eq + Hash, E: Clone>(
responses: Stream<(K, Result<(), E>), Timestamped<L>, Unbounded, Order>,
min: usize,
Expand Down
1 change: 1 addition & 0 deletions hydroflow_plus_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ stageleft_devel = []

[dependencies]
hydroflow_plus = { path = "../hydroflow_plus", version = "^0.10.0" }
hydroflow_plus_std = { path = "../hydroflow_plus_std", version = "^0.10.0" }
tokio = { version = "1.29.0", features = [ "full" ] }
stageleft = { path = "../stageleft", version = "^0.5.0" }
rand = "0.8.0"
Expand Down
2 changes: 0 additions & 2 deletions hydroflow_plus_test/src/cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ pub mod map_reduce;
pub mod paxos;
pub mod paxos_bench;
pub mod paxos_kv;
pub mod quorum;
pub mod request_response;
pub mod simple_cluster;
pub mod two_pc;
5 changes: 2 additions & 3 deletions hydroflow_plus_test/src/cluster/paxos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ 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 serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};

use super::quorum::{collect_quorum, collect_quorum_with_response};
use super::request_response::join_responses;

pub struct Proposer {}
pub struct Acceptor {}

Expand Down
2 changes: 1 addition & 1 deletion hydroflow_plus_test/src/cluster/paxos_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use std::rc::Rc;
use std::time::Duration;

use hydroflow_plus::*;
use hydroflow_plus_std::quorum::collect_quorum;
use tokio::time::Instant;

use super::paxos::{Acceptor, Ballot, Proposer};
use super::paxos_kv::{paxos_kv, KvPayload, Replica};
use super::quorum::collect_quorum;

pub struct Client {}

Expand Down

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions hydroflow_plus_test/src/cluster/two_pc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use hydroflow_plus::*;

use super::quorum::collect_quorum;
use hydroflow_plus_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.
//
Expand Down
1 change: 1 addition & 0 deletions stageleft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ macro_rules! stageleft_no_entry_crate {
unused,
ambiguous_glob_reexports,
clippy::suspicious_else_formatting,
clippy::type_complexity,
reason = "generated code"
)]
pub mod __staged {
Expand Down
1 change: 1 addition & 0 deletions template/hydroflow_plus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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' }}" }
stageleft = { git = "{{ hydroflow_git | default: 'https://github.com/hydro-project/hydroflow.git' }}", branch = "{{ hydroflow_branch | default: 'main' }}" }
tokio = { version = "1.29.0", features = [ "full" ] }

Expand Down
Loading