Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

use call_actor callback for better reusability of library #207

Merged
merged 19 commits into from
Mar 24, 2023

Conversation

stevelr
Copy link
Contributor

@stevelr stevelr commented Feb 16, 2023

Most of the functionality of the httpserver capability provider is wrapped in a library wasmcloud-provider-httpserver, which was intended to provide a reusable, embeddable http server library.

This change improves the reusability of the library by allowing customization of call_actor: the asynchronous function that delivers the http payload to an actor, waits for the result, and returns the response to the http caller.

With this change, the http server can use different transports to communicate with the actor, for example, by sending the http payload over nats, instead of wasmbus-rpc.

The wasmcloud-provider-httpserver library has not yet been published to crates.io. We'd like to publish it as a crate after this PR is merged.

Signed-off-by: stevelr <steve@cosmonic.com>
Signed-off-by: stevelr <steve@cosmonic.com>
Signed-off-by: stevelr <steve@cosmonic.com>
Signed-off-by: stevelr <steve@cosmonic.com>
@stevelr
Copy link
Contributor Author

stevelr commented Feb 22, 2023

Dependent on wasmCloud/wasmcloud-test#24, which is in turn dependent on wasmCloud/weld#143

Signed-off-by: stevelr <steve@cosmonic.com>
Signed-off-by: stevelr <steve@cosmonic.com>
@stevelr
Copy link
Contributor Author

stevelr commented Feb 22, 2023

  • For safety, sets a maximum size of incoming content to 100MB. The maximum can be adjusted anywhere from 0 bytes to 1 GB by setting max_content_len in the configuration settings or in the linkdef values.

@stevelr
Copy link
Contributor Author

stevelr commented Feb 22, 2023

Other than references in Cargo.toml (which will be changed when dependent PRs are merged), this is ready for review

@stevelr stevelr marked this pull request as ready for review February 22, 2023 17:34
@stevelr
Copy link
Contributor Author

stevelr commented Feb 28, 2023

blocked on wasmCloud/wasmcloud-test#24

Signed-off-by: stevelr <steve@cosmonic.com>
httpserver-rs/Cargo.toml Outdated Show resolved Hide resolved
httpserver-rs/bin/main.rs Outdated Show resolved Hide resolved
httpserver-rs/bin/main.rs Show resolved Hide resolved
httpserver-rs/src/settings.rs Show resolved Hide resolved
Signed-off-by: stevelr <steve@cosmonic.com>
Signed-off-by: stevelr <steve@cosmonic.com>
Signed-off-by: stevelr <steve@cosmonic.com>
Copy link
Member

@brooksmtownsend brooksmtownsend left a comment

Choose a reason for hiding this comment

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

LGTM once git dependencies are pinned dependencies

Signed-off-by: stevelr <steve@cosmonic.com>
@stevelr
Copy link
Contributor Author

stevelr commented Mar 24, 2023

Note: after this PR is merged, tag and release wasmcloud-httpserver-provider library as a new crate

Signed-off-by: stevelr <steve@cosmonic.com>
Signed-off-by: stevelr <steve@cosmonic.com>
Signed-off-by: stevelr <steve@cosmonic.com>
@stevelr stevelr merged commit c68fe64 into main Mar 24, 2023
@stevelr stevelr deleted the fix/httpserver-send-closure branch March 24, 2023 19:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants