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: specify gossip arc clamping via feature flag #31

Merged
merged 6 commits into from
Aug 8, 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
7 changes: 7 additions & 0 deletions crates/tauri-plugin-holochain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ async-trait = "0.1"

[build-dependencies]
tauri-plugin = { version = "2.0.0-rc", features = ["build"] }

[features]
default = ["gossip_arc_normal"]

gossip_arc_empty = []
gossip_arc_full = []
gossip_arc_normal = []
15 changes: 15 additions & 0 deletions crates/tauri-plugin-holochain/src/features.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#[cfg(all(feature = "gossip_arc_empty", feature = "gossip_arc_full"))]
compile_error!(
"The `gossip_arc_empty` and `gossip_arc_full` features are both enabled, which is an error. Please enable only one."
);
#[cfg(all(feature = "gossip_arc_empty", feature = "gossip_arc_normal"))]
compile_error!(
"The `gossip_arc_empty` and `gossip_arc_normal` features are both enabled, which is an error. Please enable only one."
);
#[cfg(all(feature = "gossip_arc_full", feature = "gossip_arc_normal"))]
compile_error!(
"The `gossip_arc_full` and `gossip_arc_normal` features are both enabled, which is an error. Please enable only one."
);

#[cfg(all(not(feature = "gossip_arc_empty"), not(feature = "gossip_arc_full"), not(feature = "gossip_arc_normal")))]
compile_error!("All of the `gossip_arc_empty`, `gossip_arc_full`, and `gossip_arc_normal` features are disabled. Please enable one of them.");
17 changes: 12 additions & 5 deletions crates/tauri-plugin-holochain/src/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ mod mdns;
mod signal;
use mdns::spawn_mdns_bootstrap;

#[cfg(feature="gossip_arc_empty")]
fn override_gossip_arc_clamping() -> Option<String> {
if cfg!(mobile) {
Some(String::from("empty"))
} else {
None
}
Some(String::from("empty"))
}

#[cfg(feature="gossip_arc_full")]
fn override_gossip_arc_clamping() -> Option<String> {
Some(String::from("full"))
}

#[cfg(feature="gossip_arc_normal")]
fn override_gossip_arc_clamping() -> Option<String> {
None
}

// pub static RUNNING_HOLOCHAIN: RwLock<Option<RunningHolochainInfo>> = RwLock::const_new(None);
Expand Down
1 change: 1 addition & 0 deletions crates/tauri-plugin-holochain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mod filesystem;
mod http_server;
mod lair_signer;
mod launch;
mod features;

use commands::install_web_app::{install_app, install_web_app, update_app, UpdateAppError};
pub use error::{Error, Result};
Expand Down
Loading