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

Retrieve YDoc from Y object #111

Closed
davidbrochart opened this issue Jan 21, 2023 · 2 comments
Closed

Retrieve YDoc from Y object #111

davidbrochart opened this issue Jan 21, 2023 · 2 comments

Comments

@davidbrochart
Copy link
Collaborator

Would it be possible to retrieve the YDoc a Y object is attached to? For instance through a ydoc property:

from y_py import YDoc

doc = YDoc()
text = doc.get_text('name')
assert text.ydoc is doc
@Horusiath
Copy link

I don't think it's possible at the current state. We didn't wanted to expose doc access from y-type to prevent people from throwing Doc instance away and use it instead.

There are some considerations around the fact that doc uses ref-count internally, which for avoiding memory leaks must never be using strong ref count (only weak ref count) within the objects that are stored inside of the document store itself.

@davidbrochart
Copy link
Collaborator Author

Makes sense, thanks for the explanation!

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

No branches or pull requests

2 participants