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

feat(*): Completes spike of HA stream architecture #60

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

thomastaylor312
Copy link
Contributor

This adds some code for handling the event streams and a basic setup of the wadm binary. Much of the code in the binary will likely need to be refactored into library code, but it is good enough to prove that things work. I might do another follow on PR to this to maybe clean up a few more things.

Sorry for how giant this is, it was what was needed to get things working

Closes #42

This adds some code for handling the event streams and a basic setup of
the wadm binary. Much of the code in the binary will likely need to be
refactored into library code, but it is good enough to prove that things
work. I might do another follow on PR to this to maybe clean up a few more
things.

Closes wasmCloud#42

Signed-off-by: Taylor Thomas <[email protected]>
@thomastaylor312 thomastaylor312 linked an issue Mar 6, 2023 that may be closed by this pull request
@autodidaddict
Copy link
Member

Given that this is experimental to prove that certain aspects of the design work, this all LGTM. Just take care to make sure that all the hardcoded bits (e.g. using default as the lattice name) become configurable bits as this gets migrated

async fn send_fake_command(context: &Context, host_id: &str, event: &Event) -> anyhow::Result<()> {
use wadm::nats_utils::ensure_send;
let command: Command = match event {
Event::ActorStarted(actor) => {
Copy link
Member

Choose a reason for hiding this comment

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

I know this is test, so I'm assuming this is just mock data... but wadm wouldn't emit a start actor command in response to an actor started event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, totally something to demo it works and so I knew what would be coming out the other end!

// NOTE: These functions will probably need to be replaced with something in the library code, but
// they're good enough for testing
async fn handle_events(stream: Stream, context: Context, host_id: String) -> anyhow::Result<()> {
let mut consumer = EventConsumer::new(stream, "wasmbus.evt.default")
Copy link
Member

Choose a reason for hiding this comment

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

assuming this hard coded topic is just because this is a test/experiment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, 100% hard coded. If you take a look at #61 you'll see that I made something to support multiple.

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.

Love the tests, architecture seems solid. I'll leave @autodidaddict to some details of HA, I left some nits

Comment on lines +78 to +79
#[arg(short = 'd', env = "WADM_JETSTREAM_DOMAIN")]
domain: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

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

nit: Might be nice to have this be -j and --js-domain to match NATS

@@ -0,0 +1,123 @@
//! A module for creating and consuming a stream of events from a wasmcloud lattice
Copy link
Member

Choose a reason for hiding this comment

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

nit: copy paste comment

@thomastaylor312
Copy link
Contributor Author

Thanks for the ideas @brooksmtownsend! I'll wrap those nits up in #61

@thomastaylor312 thomastaylor312 merged commit a07e812 into wasmCloud:wadm_0.4 Mar 7, 2023
@thomastaylor312 thomastaylor312 deleted the feat/stream_ha branch March 7, 2023 18:40
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.

Spike: Test out HA streaming architecture
3 participants