-
Notifications
You must be signed in to change notification settings - Fork 47
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
backend: Pass handle token to method calls for easier identification and association with their backend logic #252
backend: Pass handle token to method calls for easier identification and association with their backend logic #252
Conversation
e5431e7
to
446c033
Compare
v1:
|
HandleToken also needs to derive various traits like Hash, PartialEq,Eq and so on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise lgtm
Will be used in subsequent commits for situations where we need to identify a `Request` but passing `ObjectPath` directly will be too much of exposure. Since handle tokens are supposed to be as unique as possible as per the specifications, we shall use them for these situations.
446c033
to
dfd0153
Compare
v2:
|
By having a handle token, an implementer can now associate further calls on the `Request` with its backend logic. For example, suppose an app A calls `Account.GetUserInformation()` followed by an app B. The implementer shows a dialog for each of them that lets the user give their response. Now, if any of these apps call `Request.close()`, then the implementer does not know which dialog to close, as it did not have any way to associate the `Request` to its backend logic in the first place. This commit solves this issue.
This lets the implementer to know on which `Request` `close` was called.
dfd0153
to
72223f8
Compare
v3:
|
Thanks! |
Thank you! |
In the current state of
ashpd::backend
, it is difficult to associate each request with the backend logic. So any further calls on the request is left in ambiguity.For example, let's say two apps call
Account.GetUserInformation
. Our implementation shows dialogs that lets the user enter their details. Now, if one of these apps cancel their request withRequest.close()
, then it is impossible (or difficult) for implementer to know which dialog must be closed.An easy fix to this problem is to pass the object path of request on the method calls. Now the backend can associate each request with its backend logic, like say a hash map of requests to dialogs. Then, when
close
method is called, it can identify which dialog to close and can close it.I'm a Rust newbie, so not sure if
clone()
ing paths are a good idea or if we can tackle this problem from a different angle. 😅Thank you