Skip to content

Commit

Permalink
refactor(wasi): Move capabilities into root submodule
Browse files Browse the repository at this point in the history
Just a small restructuring that moves the capabilities submodule from
state into the root lib.

Done because it is now exported in full rather than just partially from
state::, and because it is a more generic module that will probably be moved
out to a separate crate soon.
  • Loading branch information
theduke committed Mar 13, 2023
1 parent 20ca8be commit 38e998a
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/wasi/src/http/client_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::string::FromUtf8Error;
use std::sync::Arc;

use crate::bindings::wasix_http_client_v1 as sys;
use crate::{Capabilities, WasiRuntime};
use crate::{capabilities::Capabilities, WasiRuntime};

use crate::{
http::{DynHttpClient, HttpClientCapabilityV1},
Expand Down
4 changes: 3 additions & 1 deletion lib/wasi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ mod syscalls;
mod utils;
pub mod wapm;

pub mod capabilities;

/// WAI based bindings.
mod bindings;

Expand Down Expand Up @@ -106,7 +108,7 @@ pub use crate::utils::is_wasix_module;

pub use crate::{
state::{
Capabilities, WasiEnv, WasiEnvBuilder, WasiEnvInit, WasiFunctionEnv, WasiInstanceHandles,
WasiEnv, WasiEnvBuilder, WasiEnvInit, WasiFunctionEnv, WasiInstanceHandles,
WasiStateCreationError, ALL_RIGHTS,
},
syscalls::types,
Expand Down
2 changes: 1 addition & 1 deletion lib/wasi/src/os/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use wasmer_wasi_types::{types::__WASI_STDIN_FILENO, wasi::BusErrno};
use super::{cconst::ConsoleConst, common::*, task::TaskJoinHandle};
use crate::{
bin_factory::{spawn_exec, BinFactory, ModuleCache},
capabilities::Capabilities,
os::task::{control_plane::WasiControlPlane, process::WasiProcess},
state::Capabilities,
VirtualBusError, VirtualTaskManagerExt, WasiEnv, WasiRuntime,
};

Expand Down
3 changes: 2 additions & 1 deletion lib/wasi/src/runners/wcgi/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ use wasmer_vfs::{FileSystem, PassthruFileSystem, RootFileSystemBuilder, TmpFileS
use wcgi_host::CgiDialect;

use crate::{
capabilities::Capabilities,
http::HttpClientCapabilityV1,
runners::wcgi::{Callbacks, MappedDirectory},
Capabilities, Pipe, PluggableRuntimeImplementation, VirtualTaskManager, WasiEnv,
Pipe, PluggableRuntimeImplementation, VirtualTaskManager, WasiEnv,
};

/// The shared object that manages the instantiaion of WASI executables and
Expand Down
4 changes: 2 additions & 2 deletions lib/wasi/src/state/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use wasmer_vfs::{ArcFile, FsError, TmpFileSystem, VirtualFile};

use crate::{
bin_factory::{BinFactory, ModuleCache},
capabilities::Capabilities,
fs::{WasiFs, WasiFsRoot, WasiInodes},
os::task::control_plane::{ControlPlaneConfig, ControlPlaneError, WasiControlPlane},
state::WasiState,
syscalls::types::{__WASI_STDERR_FILENO, __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO},
Capabilities, PluggableRuntimeImplementation, WasiEnv, WasiFunctionEnv, WasiRuntime,
WasiRuntimeError,
PluggableRuntimeImplementation, WasiEnv, WasiFunctionEnv, WasiRuntime, WasiRuntimeError,
};

use super::env::WasiEnvInit;
Expand Down
3 changes: 2 additions & 1 deletion lib/wasi/src/state/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use wasmer_wasi_types::{

use crate::{
bin_factory::{BinFactory, ModuleCache},
capabilities::Capabilities,
fs::{WasiFsRoot, WasiInodes},
import_object_for_all_wasi_versions,
os::{
Expand All @@ -35,7 +36,7 @@ use crate::{
DEFAULT_STACK_SIZE,
};

use super::{Capabilities, WasiState};
use super::WasiState;

/// Various [`TypedFunction`] and [`Global`] handles for an active WASI(X) instance.
///
Expand Down
2 changes: 0 additions & 2 deletions lib/wasi/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#![allow(clippy::cognitive_complexity, clippy::too_many_arguments)]

mod builder;
mod capabilities;
mod env;
mod func_env;
mod types;
Expand All @@ -39,7 +38,6 @@ use wasmer_wasi_types::wasi::{Errno, Fd as WasiFd, Rights, Snapshot0Clockid};

pub use self::{
builder::*,
capabilities::Capabilities,
env::{WasiEnv, WasiEnvInit, WasiInstanceHandles},
func_env::WasiFunctionEnv,
types::*,
Expand Down

0 comments on commit 38e998a

Please sign in to comment.