Skip to content

Commit

Permalink
rename wit to http-client
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Nov 22, 2024
1 parent f9ee749 commit 031c01d
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 29 deletions.
13 changes: 7 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/kitsune-activitypub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ speedy-uuid = { workspace = true }
tracing = "0.1.40"
triomphe = { workspace = true }
typed-builder = "0.20.0"
url = "2.5.3"
url = "2.5.4"

[target.'cfg(not(target_env = "msvc"))'.dependencies]
sha2 = { version = "0.10.8", features = ["asm"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ kitsune-language = { workspace = true }
kitsune-type = { workspace = true }
num-derive = "0.4.2"
num-traits = "0.2.19"
rustls = { version = "0.23.17", default-features = false, features = [
rustls = { version = "0.23.18", default-features = false, features = [
"logging",
"ring",
"std",
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-federation-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ kitsune-config = { workspace = true }
kitsune-derive = { workspace = true }
kitsune-error = { workspace = true }
kitsune-type = { workspace = true }
url = "2.5.3"
url = "2.5.4"

[lints]
workspace = true
2 changes: 0 additions & 2 deletions crates/kitsune-http-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ pub use self::body::Body;
/// Response body type
pub type ResponseBody = BoxBody;

pub use ::http;

/// Client error type
pub struct Error {
inner: BoxError,
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-oidc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ serde = { version = "1.0.215", features = ["derive"] }
sonic-rs = { workspace = true }
speedy-uuid = { workspace = true }
thiserror = "2.0.3"
url = "2.5.3"
url = "2.5.4"

[dev-dependencies]
tokio = { version = "1.41.1", features = ["macros", "rt"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ tokio = { workspace = true, features = ["macros", "sync"] }
tracing = "0.1.40"
triomphe = { workspace = true }
typed-builder = "0.20.0"
url = "2.5.3"
url = "2.5.4"
zxcvbn = { version = "3.1.0", default-features = false }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ rand = "0.8.5"
rusty-s3 = { version = "0.5.0", default-features = false }
tokio = { workspace = true, features = ["time"] }
triomphe = { workspace = true }
url = "2.5.3"
url = "2.5.4"
uuid = { version = "1.11.0", features = ["fast-rng", "v4"] }

[lints]
Expand Down
1 change: 1 addition & 0 deletions crates/kitsune-wasm-mrf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fred = { workspace = true }
futures-util = { version = "0.3.31", default-features = false, features = [
"alloc",
] }
http = "1.1.0"
http-body-util = "0.1.2"
kitsune-config = { workspace = true }
kitsune-derive = { workspace = true }
Expand Down
11 changes: 7 additions & 4 deletions crates/kitsune-wasm-mrf/src/ctx.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
kv_storage,
mrf_wit::v1::fep::mrf::{http, keyvalue},
mrf_wit::v1::fep::mrf::{http_client, keyvalue},
};
use slab::Slab;
use triomphe::Arc;
Expand Down Expand Up @@ -28,12 +28,15 @@ impl KvContext {

pub struct HttpContext {
pub client: kitsune_http_client::Client,
pub bodies: Slab<crate::http::Body>,
pub bodies: Slab<crate::http_client::Body>,
}

impl HttpContext {
#[inline]
pub fn get_body(&mut self, rep: &Resource<http::ResponseBody>) -> &mut crate::http::Body {
pub fn get_body(
&mut self,
rep: &Resource<http_client::ResponseBody>,
) -> &mut crate::http_client::Body {
&mut self.bodies[rep.rep() as usize]
}
}
Expand Down Expand Up @@ -80,7 +83,7 @@ pub fn construct_store(
buckets: Slab::new(),
},
resource_limiter: StoreLimitsBuilder::new()
.memory_size(100 * 1024 * 1024)
.memory_size(15 * 1024 * 1024)
.build(),
resource_table: ResourceTable::new(),
wasi_ctx,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
ctx::Context,
mrf_wit::v1::fep::mrf::http::{self, Error, Request, Response, ResponseBody},
mrf_wit::v1::fep::mrf::http_client::{self, Error, Request, Response, ResponseBody},
};
use async_trait::async_trait;
use futures_util::TryStreamExt;
Expand All @@ -10,12 +10,12 @@ use wasmtime::component::Resource;
pub type Body = BodyDataStream<kitsune_http_client::ResponseBody>;

#[async_trait]
impl http::Host for Context {
impl http_client::Host for Context {
async fn do_request(&mut self, request: Request) -> Result<Response, Resource<Error>> {
let method = kitsune_http_client::http::Method::from_bytes(request.method.as_bytes())
let method = http::Method::from_bytes(request.method.as_bytes())
.map_err(|_| Resource::new_own(0))?;

let request = kitsune_http_client::http::Request::builder()
let request = http::Request::builder()
.uri(request.url)
.method(method)
.body(request.body.map_or_else(Default::default, Into::into))
Expand Down Expand Up @@ -51,7 +51,7 @@ impl http::Host for Context {
}

#[async_trait]
impl http::HostResponseBody for Context {
impl http_client::HostResponseBody for Context {
async fn next(
&mut self,
rep: Resource<ResponseBody>,
Expand All @@ -72,7 +72,7 @@ impl http::HostResponseBody for Context {
}

#[async_trait]
impl http::HostError for Context {
impl http_client::HostError for Context {
async fn drop(&mut self, _rep: Resource<Error>) -> wasmtime::Result<()> {
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-wasm-mrf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use wasmtime::{

mod cache;
mod ctx;
mod http;
mod http_client;
mod logging;
mod mrf_wit;

Expand Down
6 changes: 3 additions & 3 deletions crates/kitsune-wasm-mrf/wit/mrf.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package fep:mrf@1.0.0;
package fep:mrf@0.1.0;

/// Home-grown version of an interface for doing HTTP requests
interface http {
interface http-client {
/// Opaque representation of some error
resource error {}

Expand Down Expand Up @@ -101,7 +101,7 @@ interface types {
world mrf {
use types.{direction, error};

import http;
import http-client;
import keyvalue;
import wasi:logging/logging;

Expand Down
2 changes: 1 addition & 1 deletion kitsune/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ tracing = "0.1.40"
trials = { workspace = true }
triomphe = { workspace = true }
typed-builder = "0.20.0"
url = "2.5.3"
url = "2.5.4"

# --- Optional dependencies ---

Expand Down

0 comments on commit 031c01d

Please sign in to comment.