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

trigger crate prototype #415

Closed
wants to merge 1 commit into from
Closed

Conversation

lann
Copy link
Collaborator

@lann lann commented Apr 29, 2022

Currently just for discussion in #402

@lann lann mentioned this pull request Apr 29, 2022
@lann
Copy link
Collaborator Author

lann commented Apr 29, 2022

Note that this specific design would require a bit of refactoring in the http trigger's Router::build, but nothing too hard I think.

@radu-matei
Copy link
Member

The Router implementation is also one of the causes in #413, and solving it will require some refactoring anyway.

fn new(
execution_context: ExecutionContext<Self::ContextData>,
config: Self::Config,
component_configs: ComponentMap<Self::ComponentConfig>,
Copy link
Contributor

Choose a reason for hiding this comment

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

we can simply pass Application<CoreComponent> to new, instead of config and component_configs. Is this design intentionally trying to decouple Application and Trigger?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes it's intentionally decoupling, but it also avoids needing to clone the Application, which seems to be part of the issue in #413.

Copy link
Contributor

Choose a reason for hiding this comment

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

it seems like Http trigger will need application to build routers

log_dir: opts.log_dir,
config_resolver: app.config_resolver,
})?;
T::configure_execution_context(&mut builder)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should have one prepare trigger function that prepares builder, and then leave the Trigger::new and trigger.run to the up command.

  pub async fn prepare_trigger<T: Trigger>(
    app: Application<CoreComponent>, 
    opts: RunOptions<T>,
  ) -> (Builder<ContextData>, Config, ComponentConfig) {}

This allows SDK users to customize builder and configs.

Copy link
Collaborator Author

@lann lann Apr 30, 2022

Choose a reason for hiding this comment

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

In this PR's design the builder can be customized up in Trigger::configure_execution_context; that is just a default implementation of that trait function.

That said, I'm not opposed to leaving more of the logic in spin up at this point. This prototype was partially my attempt at figuring out what in implementation of #417 might look like if we move forward with that.

@Mossaka Mossaka mentioned this pull request Apr 30, 2022
@lann
Copy link
Collaborator Author

lann commented May 2, 2022

Implementation in #418

@lann lann closed this May 2, 2022
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.

3 participants