Skip to content
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
647 changes: 294 additions & 353 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions crates/http-service/src/executor/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::state::HttpState;
use anyhow::{anyhow, bail, Context};
use async_trait::async_trait;
use bytesize::ByteSize;
use dictionary::Dictionary;
use http::{Method, Request, Response, StatusCode};
use http_backend::Backend;
use http_body_util::{BodyExt, Full};
Expand All @@ -19,7 +18,6 @@ pub struct HttpExecutorImpl<C: 'static> {
instance_pre: InstancePre<HttpState<C>>,
store_builder: StoreBuilder,
backend: Backend<C>,
dictionary: Dictionary,
}

#[async_trait]
Expand Down Expand Up @@ -88,7 +86,6 @@ where
uri: backend_uri,
propagate_headers: parts.headers,
propagate_header_names,
dictionary: self.dictionary.clone(),
};

let mut store = store_builder.build(state)?;
Expand Down Expand Up @@ -151,13 +148,11 @@ where
instance_pre: InstancePre<HttpState<C>>,
store_builder: StoreBuilder,
backend: Backend<C>,
dictionary: Dictionary,
) -> Self {
Self {
instance_pre,
store_builder,
backend,
dictionary,
}
}
}
Expand Down Expand Up @@ -303,6 +298,7 @@ mod tests {
.set_env(&env)
.max_memory_size(cfg.mem_limit)
.max_epoch_ticks(cfg.max_duration)
.dictionary(dictionary)
.logger(logger);

let component = self.loader().load_component(cfg.binary_id)?;
Expand All @@ -312,7 +308,6 @@ mod tests {
instance_pre,
store_builder,
self.backend(),
dictionary,
))
}
}
Expand Down
5 changes: 0 additions & 5 deletions crates/http-service/src/executor/wasi_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use ::http::{header, HeaderMap, Request, Response, StatusCode, Uri};
use anyhow::{anyhow, bail, Context};
use async_trait::async_trait;
use bytesize::ByteSize;
use dictionary::Dictionary;
use http_backend::Backend;
use http_body_util::{BodyExt, Full};
use hyper::body::Body;
Expand All @@ -21,7 +20,6 @@ pub struct WasiHttpExecutorImpl<C: 'static> {
instance_pre: InstancePre<HttpState<C>>,
store_builder: StoreBuilder,
backend: Backend<C>,
dictionary: Dictionary,
}

#[async_trait]
Expand Down Expand Up @@ -99,7 +97,6 @@ where
uri: backend_uri,
propagate_headers,
propagate_header_names,
dictionary: self.dictionary.clone(),
};

let mut store = store_builder.build(state).context("store build")?;
Expand Down Expand Up @@ -194,13 +191,11 @@ where
instance_pre: InstancePre<HttpState<C>>,
store_builder: StoreBuilder,
backend: Backend<C>,
dictionary: Dictionary,
) -> Self {
Self {
instance_pre,
store_builder,
backend,
dictionary,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/http-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ where
})?;

reactor::gcore::fastedge::dictionary::add_to_linker::<_, HasSelf<_>>(linker, |data| {
&mut data.as_mut().dictionary
&mut data.dictionary
})?;

reactor::gcore::fastedge::secret::add_to_linker::<_, HasSelf<_>>(linker, |data| {
Expand Down
2 changes: 0 additions & 2 deletions crates/http-service/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use anyhow::Error;
use dictionary::Dictionary;
use http::request::Parts;
use http::uri::Scheme;
use http::{header, HeaderMap, HeaderName, Uri};
Expand All @@ -12,7 +11,6 @@ pub struct HttpState<C> {
pub(super) uri: Uri,
pub(super) propagate_headers: HeaderMap,
pub(super) propagate_header_names: Vec<HeaderName>,
pub(super) dictionary: Dictionary,
}

impl<C> BackendRequest for HttpState<C> {
Expand Down
1 change: 1 addition & 0 deletions crates/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tracing = { workspace = true }
bytesize = { workspace = true }
http-backend = { path = "../http-backend" }
key-value-store = { path = "../key-value-store" , features = ["redis"]}
dictionary = { path = "../dictionary" }
secret = { path = "../secret" }
async-trait = "0.1"
bytes = "1.10"
Expand Down
2 changes: 2 additions & 0 deletions crates/runtime/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::app::KvStoreOption;
use dictionary::Dictionary;
use key_value_store::KeyValueStore;
use std::{fmt::Debug, ops::Deref};
use wasmtime_wasi::ResourceTable;
Expand Down Expand Up @@ -91,6 +92,7 @@ pub struct Data<T: 'static> {
http: WasiHttpCtx,
pub secret_store: SecretStore,
pub key_value_store: KeyValueStore,
pub dictionary: Dictionary,
}

pub trait BackendRequest {
Expand Down
9 changes: 9 additions & 0 deletions crates/runtime/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::logger::Logger;
use crate::registry::CachedGraphRegistry;
use crate::{Data, Wasi, WasiVersion, DEFAULT_EPOCH_TICK_INTERVAL};
use anyhow::Result;
use dictionary::Dictionary;
use key_value_store::KeyValueStore;
use secret::SecretStore;
use std::{
Expand Down Expand Up @@ -84,6 +85,7 @@ pub struct StoreBuilder {
registry: CachedGraphRegistry,
secret_store: SecretStore,
key_value_store: KeyValueStore,
dictionary: Dictionary,
}

impl StoreBuilder {
Expand All @@ -100,6 +102,7 @@ impl StoreBuilder {
registry: CachedGraphRegistry::new(),
secret_store: Default::default(),
key_value_store: KeyValueStore::default(),
dictionary: Default::default(),
}
}

Expand Down Expand Up @@ -168,6 +171,11 @@ impl StoreBuilder {
}
}

/// Set key value dictionary
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment 'Set key value dictionary' is misleading. This method sets a dictionary, not specifically a key-value dictionary. Consider changing to 'Set dictionary' to be more accurate.

Suggested change
/// Set key value dictionary
/// Set dictionary

Copilot uses AI. Check for mistakes.
pub fn dictionary(self, dictionary: Dictionary) -> Self {
Self { dictionary, ..self }
}

pub fn make_wasi_nn(&self) -> Result<WasiNnCtx> {
// initialize application specific graph
let backends: Vec<&str> = self
Expand Down Expand Up @@ -247,6 +255,7 @@ impl StoreBuilder {
http: WasiHttpCtx::new(),
secret_store: self.secret_store,
key_value_store: self.key_value_store,
dictionary: self.dictionary,
},
);
inner.limiter(|state| &mut state.store_limits);
Expand Down
5 changes: 2 additions & 3 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ impl ExecutorFactory<HttpState<HttpsConnector<HttpConnector>>> for Context {
.max_epoch_ticks(app.max_duration)
.logger(logger)
.secret_store(secret_store)
.key_value_store(key_value_store);
.key_value_store(key_value_store)
.dictionary(dictionary);

let component = self.loader().load_component(app.binary_id)?;
let instance_pre = engine.component_instantiate_pre(&component)?;
Expand All @@ -122,14 +123,12 @@ impl ExecutorFactory<HttpState<HttpsConnector<HttpConnector>>> for Context {
instance_pre,
store_builder,
self.backend(),
dictionary,
)))
} else {
Ok(RunExecutor::Http(HttpExecutorImpl::new(
instance_pre,
store_builder,
self.backend(),
dictionary,
)))
}
}
Expand Down