Skip to content

Commit

Permalink
feat(builtins): remove builtins dir from configs (#1711)
Browse files Browse the repository at this point in the history
  • Loading branch information
folex authored Jul 20, 2023
1 parent 463b3b4 commit 9bce547
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 18 deletions.
1 change: 0 additions & 1 deletion crates/created-swarm/src/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ pub fn create_swarm_with_runtime<RT: AquaRuntime>(
UnresolvedConfig::deserialize(node_config).expect("created_swarm: deserialize config");

let mut resolved = node_config.resolve().expect("failed to resolve config");
create_dir(&resolved.dir_config.builtins_base_dir).expect("create builtins dir");

resolved.node_config.transport_config.transport = Transport::Memory;
resolved.node_config.transport_config.socket_timeout = TRANSPORT_TIMEOUT;
Expand Down
4 changes: 0 additions & 4 deletions crates/server-config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ pub fn services_base_dir(base_dir: &Path) -> PathBuf {
base_dir.join("services")
}

pub fn builtins_base_dir(base_dir: &Path) -> PathBuf {
base_dir.join("builtins")
}

pub fn avm_base_dir(base_dir: &Path) -> PathBuf {
base_dir.join("stepper")
}
Expand Down
11 changes: 1 addition & 10 deletions crates/server-config/src/dir_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use crate::defaults::{avm_base_dir, builtins_base_dir, default_base_dir, services_base_dir};
use crate::defaults::{avm_base_dir, default_base_dir, services_base_dir};

use air_interpreter_fs::air_interpreter_path;
use fs_utils::{canonicalize, create_dirs, to_abs_path};
Expand All @@ -31,9 +31,6 @@ pub struct UnresolvedDirConfig {
/// Base directory for resources needed by application services
pub services_base_dir: Option<PathBuf>,

/// Base directory for builtin services
pub builtins_base_dir: Option<PathBuf>,

/// Base directory for resources needed by application services
pub avm_base_dir: Option<PathBuf>,

Expand All @@ -51,7 +48,6 @@ impl UnresolvedDirConfig {
let base = to_abs_path(self.base_dir);

let services_base_dir = self.services_base_dir.unwrap_or(services_base_dir(&base));
let builtins_base_dir = self.builtins_base_dir.unwrap_or(builtins_base_dir(&base));
let avm_base_dir = self.avm_base_dir.unwrap_or(avm_base_dir(&base));
let air_interpreter_path = self
.air_interpreter_path
Expand All @@ -63,23 +59,20 @@ impl UnresolvedDirConfig {
&base,
&services_base_dir,
&avm_base_dir,
&builtins_base_dir,
&spell_base_dir,
&keypairs_base_dir,
])
.context("creating configured directories")?;

let base = canonicalize(base)?;
let services_base_dir = canonicalize(services_base_dir)?;
let builtins_base_dir = canonicalize(builtins_base_dir)?;
let avm_base_dir = canonicalize(avm_base_dir)?;
let spell_base_dir = canonicalize(spell_base_dir)?;
let keypairs_base_dir = canonicalize(keypairs_base_dir)?;

Ok(ResolvedDirConfig {
base_dir: base,
services_base_dir,
builtins_base_dir,
avm_base_dir,
air_interpreter_path,
spell_base_dir,
Expand All @@ -92,8 +85,6 @@ impl UnresolvedDirConfig {
pub struct ResolvedDirConfig {
pub base_dir: PathBuf,
pub services_base_dir: PathBuf,
/// Directory where configs for autodeployed builtins are stored
pub builtins_base_dir: PathBuf,
/// Directory where particle's prev_data is stored
pub avm_base_dir: PathBuf,
/// Directory where interpreter's WASM module is stored
Expand Down
2 changes: 1 addition & 1 deletion crates/server-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mod resolved_config;
mod services_config;
pub mod system_services_config;

pub use defaults::{builtins_base_dir, *};
pub use defaults::*;
pub use resolved_config::load_config;
pub use resolved_config::load_config_with_args;
pub use resolved_config::ConfigData;
Expand Down
3 changes: 1 addition & 2 deletions nox/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,15 +546,14 @@ mod tests {
use config_utils::to_peer_id;
use connected_client::ConnectedClient;
use fs_utils::to_abs_path;
use server_config::{builtins_base_dir, default_base_dir, load_config_with_args};
use server_config::{default_base_dir, load_config_with_args};

use crate::Node;

#[tokio::test]
async fn run_node() {
let base_dir = default_base_dir();
fs_utils::create_dir(&base_dir).unwrap();
fs_utils::create_dir(builtins_base_dir(&base_dir)).unwrap();
write_default_air_interpreter(&air_interpreter_path(&base_dir)).unwrap();

let mut config = load_config_with_args(vec![], None)
Expand Down

0 comments on commit 9bce547

Please sign in to comment.