4 ms·
> For example, how would you transfer ownership of a big linked data structure from one guild to another? Slowly. Objects well-suited to transfer would be sha
by parenthephobia 10y ago
> For example, how would you transfer ownership of a big linked data structure from one guild to another?
Slowly.
Objects well-suited to transfer would be shallow mutable structures with immutable data "underneath". Immutable data can be shared, so they'd be ignored by the transfer logic.
Another approach likely to be common would be not transferring objects at all, but sending proxy objects to other guilds which transparently marshal method invocations between those guilds and the object's home guild. For large mutable complexes which are intertwined with everything a guild does, that's probably a more manageable approach.
> Making things worse, you would have to make sure that the ownership transfer is atomic - no other part of the program should see the data structure in a “partially transferred” state
This is easy. You just run the transfer operation with the guild's mutex locked. No other guild can have a reference to a mutable object, and an immutable object doesn't need to be transferred.
> In Ruby, what exactly should happen here? Have these guys really thought about the possibilities?
It seems obvious that every linked mutable object is invalidated, so Qux will be transferred.
- catnaroek 10y ago> Objects well-suited to transfer would be shallow mutable structures with immutable data "underneath". Immutable data can be shared, so they'd be ignored by the transfer logic. How often are data structures designed like this in Ruby? > Another approach likely to be common would be not transferring objects at all, but sending proxy objects to other guilds which transparently marshal method invocations between those guilds and the object's home guild. What if said “home guild” ends up overburdened with requests coming from all over the place? > This is easy. You just run the transfer operation with the guild's mutex locked. You mean both the sender and the receiver's mutexes? I'm worried about the receiver being able to observe partial transfers.
- eregon 10y agoThe object graph would only be handed to the receiver once it's fully transferred I would imagine.