-
Notifications
You must be signed in to change notification settings - Fork 2
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
Make EntityManager Clone #3
Comments
Thank you for your suggestion. I've pondered this some, but I think the current shared It'd in fact be problematic to have more than one In the case of |
Right, but that's not something that is inherently guaranteed by the current use of the Why does the
Yes they are, it's only the use of |
Sure, but at that point the user is actively choosing to create a new
IIRC it doesn't need to be, and I'm okay with removing it to allow for a possible future where |
Ok, I think it would be clearer to remove the |
That's the thing. The The only alternative is to add a lifetime parameter to |
I think I don't completely understand the API you are sketching. To be clear on my side:
The point of the So, even though you are not using So that's it on my side :) Now, with regards to what you are trying to do:
Why is it supposed to be shared? Looking at the example, it seems you hand it over to the repository, and then transact on it, and then expect the repository to find the book transacted. If you were to transact in another task or thread, the expectation would break down(unless you used something like So to me it appears that, similar to a
You can later add arcs to other shared state internally, as opposed to putting the thing itself in an arc.
Please explain more about what you want it to achieve as a "manager". |
Thanks for your patience in trying to explain all this to me. I'm pretty sure I must have been missing something. Anyway, I'll have to take a long hard look at the code and get back to you. |
Earlier you said:
But now you also said:
Does using multiple cloned |
If I understand the code in https://github.com/automerge/automerge-repo-rs/blob/847d0ff53ace756599eaf5380740b9c2ab356b1b/src/dochandle.rs correctly, So I'm not really sure what's the problem... |
Using cloned
An
At this point it's not a problem yet, but it may become a problem later, for example if you do anything with |
Is it correct to say that |
That pretty much sums it up :) |
Since the EntityRepository is
Clone
, you could remove theArc
around theEntityManager
and instead make itClone
as well, since theDocHandle
isClone
.Besides removing the arc, if you were ever to start using
DocHandle.changed
somewhere, you would get what I think is a more intuitive kind of result than if you were to use the same refcounted doc handle everywhere: with the current setup it could lead to some updates apparently not propagating(because each doc handle keeps track of the latest state it has seen, and the arc would make this a single global thing as opposed to a local thing, see this note).The text was updated successfully, but these errors were encountered: