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 8, 2023
1 parent 041c211 commit 6d8b03d
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 8 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 @@ -28,7 +28,7 @@ use super::{cconst::ConsoleConst, common::*, task::TaskJoinHandle};
use crate::{
bin_factory::{spawn_exec, BinFactory, ModuleCache},
os::task::{control_plane::WasiControlPlane, process::WasiProcess},
state::Capabilities,
capabilities::Capabilities,
VirtualBusError, VirtualTaskManagerExt, WasiEnv, WasiRuntime,
};

Expand Down
2 changes: 1 addition & 1 deletion lib/wasi/src/runners/wcgi/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use wcgi_host::CgiDialect;
use crate::{
http::HttpClientCapabilityV1,
runners::wcgi::{Callbacks, MappedDirectory},
Capabilities, Pipe, PluggableRuntimeImplementation, VirtualTaskManager, WasiEnv,
capabilities::Capabilities, Pipe, PluggableRuntimeImplementation, VirtualTaskManager, WasiEnv,
};

/// The shared object that manages the instantiaion of WASI executables and
Expand Down
2 changes: 1 addition & 1 deletion lib/wasi/src/state/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
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,
capabilities::Capabilities, PluggableRuntimeImplementation, WasiEnv, WasiFunctionEnv, WasiRuntime,
WasiRuntimeError,
};

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 @@ -33,9 +33,10 @@ use crate::{
SpawnedMemory, VirtualTaskManager, WasiControlPlane, WasiEnvBuilder, WasiError,
WasiFunctionEnv, WasiRuntime, WasiRuntimeError, WasiStateCreationError, WasiVFork,
DEFAULT_STACK_SIZE,
capabilities::Capabilities,
};

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 6d8b03d

Please sign in to comment.