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

Spike: Define Scaler trait #48

Closed
thomastaylor312 opened this issue Mar 4, 2023 · 1 comment · Fixed by #71
Closed

Spike: Define Scaler trait #48

thomastaylor312 opened this issue Mar 4, 2023 · 1 comment · Fixed by #71
Assignees

Comments

@thomastaylor312
Copy link
Contributor

A scaler will need to take a config of some kind, likely a handle to some sort of state, and two different methods. Below is a general idea of what it could look like, but part of this spike is to have an integration test that can pass in an Event or a wadm manifest and output commands with a basic, not fully functional spreadscaler.

/// A Scaler is used to manage responding to even
pub trait Scaler {
  /// Any type that has the necessary data to configure the scaler
  type Config: Send + Sync;

  /// Handles the event, returning any needed changes in response
  fn handle_event(&self, event: ScopedEvent) -> Result<HashSet<Command>>;

  /// Handles a new or updated manifest with its given config. This configuration should be stored by implementors in some form so that handle_event can produce the right commands
  fn handle_manifest(&self, config: Self::Config) -> Result<HashSet<Command>>;

  /// Removes a config from the scaler and emits the expected compensatory commands
  fn remove_manifest(&self, config: &Self::Config) -> Result<HashSet<Command>>;
}
@thomastaylor312
Copy link
Contributor Author

Closed in #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants