Strumenta / starlasu-lionweb-repository-client

0 stars 0 forks source link

KolasuClient.storeTree: return a handle to retrieve the tree later #9

Closed alessiostalla closed 6 months ago

alessiostalla commented 6 months ago

KolasuClient.storeTree generates a new ID for the translated Lionweb root node, but it doesn't return this ID, so one has to know the client's internals to retrieve the tree later. It would be useful if the client returned either the ID string, or a URL, or some opaque handle that could be used (and serialized and restored) to access the tree later, possibly in a different process.

ftomassetti commented 6 months ago

For the system to work, given the same node, in the same position, the same ID should be always be generated.

I would propose this solution: we could capture the logic that maps Nodes to IDs and making accessible in the KolasuClient. In this way, you would be able to calculate at any time which ID will be assigned to a certain Node. Otherwise, if we exposed only the resulting ID for the root node: 1) you would not know the ID for all the other nodes 2) you would need to save it somewhere.

The NodeIdProvider are introduced in https://github.com/Strumenta/kolasu/pull/300, as they are useful also for the Symbol Resolution. I think they could be the key to solve also this problem.

Would this work for you? What do you think?

alessiostalla commented 6 months ago

Sounds like a good solution!