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

Requests now use EffectId(u32) instead of Uuid #238

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

StuartHarris
Copy link
Member

  • replace Uuid with new type EffectId(u32)
  • use a slab to manage storage of callbacks for resolving effects
  • update examples, tests, docs, book

Note, this does not affect Rust shells that use the core directly, as they bypass the bridge and the registry.

Also, we need to measure the performance of the slab (vs the HashMap we were using beforehand).

Incidentally, we now remove the slab entry once the effect is fully resolved (although subscription style callbacks, e.g. Server Sent Events, still keep the entry in case there are more resolutions. We need to look at how to signal the end of a subscription so these can be cleaned up too). Before this change all effects were "leaking", now its only the effects that can be resolved repeatedly).

@@ -41,3 +41,4 @@ serde = { version = "1.0.201", features = ["derive"] }
static_assertions = "1.1"
rand = "0.8"
url = "2.5.0"
uuid = { version = "1.8.0", features = ["v4", "serde"] }
Copy link
Member

Choose a reason for hiding this comment

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

Is it still needed for dev...? 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really. There's a test for sending UUID across the typegen IIRC. Could use another type though

@StuartHarris StuartHarris requested a review from obmarg May 18, 2024 07:46
Copy link
Collaborator

@obmarg obmarg left a comment

Choose a reason for hiding this comment

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

Nice, I read about Slab a while back and using it here sprung to mind. A good change.

@StuartHarris StuartHarris merged commit 6993083 into master May 20, 2024
9 checks passed
@StuartHarris StuartHarris deleted the remove-uuid branch May 20, 2024 10:44
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.

None yet

3 participants