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

Event refactor #94

Merged
merged 5 commits into from
Mar 10, 2023
Merged

Event refactor #94

merged 5 commits into from
Mar 10, 2023

Conversation

matux
Copy link
Collaborator

@matux matux commented Mar 7, 2023

Description of the change

This refactor addresses multiple deficiencies with how we transfer information from our front-end API to our internal Notifier process.

This refactor solves multiple bugs, and presents a scalable mechanism to add new functionality in a composable way with the least amount of changes due to a very modularized scheme.

What changed:

  • The Notifier used to represent a sandboxed/isolated boundary between the SDK's innards and its API. Now the Notifier is just another switchable self-contained module just like the Transformer, Sender and Marshaller.
  • A new Sandbox module that represents the aforementioned isolated boundary which offers two flavors: async useful for unit testing, and isolated which leverages Dart's Isolates.
    • We keep the same level of security by sandboxing our memory, and full thread-enabled concurrency.
    • This helps remove business logic from the Notifier, which used to handle both the process pipeline and the isolation.
  • The way the API forwards messages to the Notifier is through Event instances, which is a type-safe way of encoding action and the data associated with such action. This event is dispatched to the Sandbox and the Sandbox sends it to the Isolate stream, and then it's given to the Notifier.
  • The Notifier encodes the pipeline that processes these Events.
    • There are two types of Events:
      • Events that modify context (the SDK's state): In this case, the Notifier acts as a simple Reducer that modifies its internal state given the Event's data.
      • Events that forward data to Rollbar's API: In this case, the event is put through the Marshalling pipeline, the data is transformed if necessary, persisted and then sent.
  • Wrangler has been renamed to Marshaller.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

Shortcut stories and GitHub issues (delete irrelevant)

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

@matux matux self-assigned this Mar 7, 2023
@matux matux requested a review from diegov March 8, 2023 16:05
@matux matux marked this pull request as ready for review March 8, 2023 16:05
@matux
Copy link
Collaborator Author

matux commented Mar 9, 2023

@diegov I'm gonna have to fix the CI on a different PR. There's some general work I'll need to do to prevent it from failing every time we do certain kind of changes. Do you think you could approve so I can merge?

@matux matux merged commit 0b7d14c into main Mar 10, 2023
@matux matux deleted the events branch March 10, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants