Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial refactor for 'no fail' actor start #4

Merged
merged 4 commits into from
Nov 13, 2020
Merged

Conversation

autodidaddict
Copy link
Member

After talking to the people who actually know what they're doing in the Actix gitter/discord, I found that I was using a bit of an anti-pattern. It should be impossible for an actor to fail to start, and there were a couple of places, especially in the capability provider host actor, where I was pulling shenanigans like try_new(), which I then hid behind a builder (that also returned a result).

Instead, the recommended practice is that all actors should be 100% guaranteed to start, and if you need to set an initial state that could be rejected or invalid, then you do so through sending that message to the actor, and the actor stops itself if there's an error.

So far I've only refactored the host controller's interaction with the native capability provider host. After we agree on the cleanest way to implement this, I can poke around the rest of all the actors and make them conform to this new pattern.

…tored to send new actors an initialize message
@autodidaddict
Copy link
Member Author

@brooksmtownsend just pushed a new batch that removes potentially panic-inducing unwraps from the actor startup, adopting the new "optional state with initializer" pattern.

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.

I might be taking the "Actor should always be able to start" too literally, I don't want to encourage creating weird program state to satisfy that. I am interested especially in the actor host Initialize handler about what this should look like.

crates/wascc-host/src/actors/actor_host.rs Show resolved Hide resolved
crates/wascc-host/src/actors/actor_host.rs Show resolved Hide resolved
crates/wascc-host/src/actors/actor_host.rs Outdated Show resolved Hide resolved
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.

Those code pieces look a lot cleaner without the header referenced constantly.

@autodidaddict autodidaddict merged commit 2ed73d6 into main Nov 13, 2020
@autodidaddict autodidaddict deleted the nofailactor branch November 13, 2020 15:03
brooksmtownsend added a commit that referenced this pull request May 4, 2021
* changed zip compression method to stored to prevent lossy compression

* remove debug derive, remove extra clone

* revoked public struct fields

* Replaced `zip` library with `tar` for consistent archival of par files

* Increased version number

* Changed try_load to accept byte array, renamed test archives
brooksmtownsend added a commit that referenced this pull request May 4, 2021
* Initial commit

* Update README.md (#1)

Furthering the cause of DDD - documentation-driven-development.

* Initial implementation (#2)

* Initial implementation

* Adding function to retrieve target bytes

* Adding cargo.lock

* Archive providers using Tar rather than Zip (#4)

* changed zip compression method to stored to prevent lossy compression

* remove debug derive, remove extra clone

* revoked public struct fields

* Replaced `zip` library with `tar` for consistent archival of par files

* Increased version number

* Changed try_load to accept byte array, renamed test archives

* Making the result type error Sync and Send

* Add rust build action

* Created release action for crates.io

* Support par compression (#5)

* changed zip compression method to stored to prevent lossy compression

* remove debug derive, remove extra clone

* revoked public struct fields

* Replaced `zip` library with `tar` for consistent archival of par files

* Increased version number

* Changed try_load to accept byte array, renamed test archives

* added ability to compress and decompress par archives

* use result

* changed compression algorithm to gz, included compression tests, bumped to 0.2.0

* refined tests to compare raw data rather than length of bytes

* refined another test

* removed trailing parenthesis

* Detect gzip file via magic header

Co-authored-by: chris <[email protected]>

* Updated zip references to tar in README

* Update README.md

Adding build badge

* Update README.md

Adding other badges

* Update README.md

* updated release action

* changed write to either output compressed or uncompressed par, not both (#6)

* Fixes #7, write par file only once

This fixes issue #7 with the gz suffix being added to the archive
even if it already exists. It also changes how the par file is written
in cases where gzip compression is used. Previously, it would write the
file then read that in and write the compressed file, where as now it
just writes the par file once, regardless of compression.

Cleanup try_load compression usage, move compress/decompress to tests

Bump minor version

* added rev and ver to claims preserved on load (#11)

* Wascap bump (#12)

* bumped wascap version

* bumped wascap to 0.5.2

* bump dependencies for wascap update (#13)

* temporarily remove conflicts

* complete merge

* added provider-archive to workspace

Co-authored-by: Kevin Hoffman <[email protected]>
Co-authored-by: Kevin Hoffman <[email protected]>
Co-authored-by: chris <[email protected]>
rvolosatovs referenced this pull request in rvolosatovs/wasmCloud Mar 21, 2023
Co-authored-by: Alexander Schnackenberg <[email protected]>
rvolosatovs referenced this pull request in rvolosatovs/wasmCloud Mar 21, 2023
…ed to view content outside the FS provider's root path (#4)
rvolosatovs referenced this pull request in rvolosatovs/wasmCloud Mar 21, 2023
This implements the provider by leaning on the reqwests library for
handling all of the HTTP details and tokio for making it async.

Closes #1.
rvolosatovs referenced this pull request in rvolosatovs/wasmCloud Mar 21, 2023
rvolosatovs referenced this pull request in rvolosatovs/wasmCloud Mar 21, 2023
rvolosatovs referenced this pull request in rvolosatovs/wasmCloud Mar 21, 2023
rvolosatovs referenced this pull request in rvolosatovs/wasmCloud Mar 21, 2023
corrected cargo clippy working dir, not using action
connorsmith256 pushed a commit to connorsmith256/wasmCloud that referenced this pull request Oct 17, 2023
* Migrated functionality for claims from wascap crate

* Migrated functionality for keys from nkeys crate

* Migrated functionality for lattice from latticeclient crate

* Updated CLI to support keys, claims, and lattice commands

* Added par subcommand, created ability for auto-generating keys during par signing

* pinned dependencies, beautified wash par inspect output, updated par README

* Bumped version

* created result error type for par module

* changed generated message

Co-authored-by: Brooks Townsend <[email protected]>
connorsmith256 pushed a commit to connorsmith256/wasmCloud that referenced this pull request Oct 17, 2023
* Migrated functionality for claims from wascap crate

* Migrated functionality for keys from nkeys crate

* Migrated functionality for lattice from latticeclient crate

* Updated CLI to support keys, claims, and lattice commands

* Added par subcommand, created ability for auto-generating keys during par signing

* pinned dependencies, beautified wash par inspect output, updated par README

* Bumped version

* created result error type for par module

* changed generated message

Co-authored-by: Brooks Townsend <[email protected]>
connorsmith256 pushed a commit that referenced this pull request Oct 19, 2023
Add Revision and Version support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants