|Subject:||Re: RFC: StepTalk semi-persistent shared environment(s)|
|Date:||Wed, 31 Aug 2005 21:47:58 +0200|
Le 19 août 05 à 17:49, Stefan Urbanek a écrit :
Sorry for the late reply…
I'm not convinced I must say, why not STDistantEnvironment ?
methodFromSource:receiver:context or methodForSource:receiver:context could be better.
looks right in my opinion. I wouldn't use copyOfResult.
I mean, each object would have a unique id assigned when it is shared between two or more environments, and when parent environment (which provided the object initially) terminates, the object would be copied to the first distant environment which obtained a reference on it.
With more details, it may look like :
-> an object starts to be shared between a parent environment and a distant environment
- a unique id is created (probably stored in an ivar by extending STObjectReference ?)
- an environments array is created with 'parent environment', 'distant environment' (probably stored in an ivar by extending STObjectReference ?)
- the object reference is put in a persistent hash table (id is playing hash role)
Note: the persistent hash table could be a light key/value database like SkipDB <http://www.dekorte.com/projects/opensource/SkipDB/>
-> a shared object stops to be used in a distant environment
- the distant environment removes itself in 'environments' array
- it removes the object in hash table if 'environments' array is now empty (reference count inspired mechanism)
-> the parent environment terminates
- the parent environment checks every shared objects presence in hash table by iterating over their id (I'm supposing each environment have a way to know which local objects are shared)
- if the object is referenced by the hash table, it is copied to the second environment referenced in 'environments' array, then dying environment removes itself in 'environments' array
- otherwise, the object is deallocated.
Finally environment loading could be extended with a mechamism to check STObjectReference objects state :
- the environment checks the persistent hash table to know if the object is referenced or not
- if the object is referenced, it retrieves STObjectReference object for it (previously stored)
- otherwise a blank object reference is created
A similar mechanism is used in Io language to implement orthogonal persistency iirc.
Any STObjectReference may have a method -sharable which returns NO by default, but a -setSharable accessor would allow to set it to YES.
And objects when put in context/environment dictionary would automatically returns YES to this method.Why not try to solve this question with the previous one ?
EnvironmentManager class ?
I don't know.
I would say both.
|[Prev in Thread]||Current Thread||[Next in Thread]|