|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
persisting external resourcesjust thinking aloud.. maybe someone can suggest a simpler system..
our prevelant system (call it game) will use a kind of external engine for some complicated calculations. the calculations are expensive, so we want to cache the results if possible. calculations arent instantaneous but spread over time. results are retrieved via a callback interface. the time results arrive is important (changes game's state) to make things simpler, a transparent proxy (implementing calculation engine's interface) will be placed in front of calculation engine and will act as the cache. proxy will have its own prevayler to persist previous results 1. game asks proxy to calculate something 2. proxy checks its cache if it already has the results. if so proceed to step 6 3. otherwise, proxy asks calculation engine for calculation and registers its listener 4. when results came via listener, proxy persists them with a prevayler transaction and forwards results to game's listener. 5. sequence ends 6. proxy retrieves results from cache, schedules some events to game's event queue for the time of results' arrival. when that events are executed, results are forwarded to game's listener. (remember, time of results are important) 7. sequence ends cases: a. in a regular run, all will be ok: 1,2,3,4,5 b. during recovery, if calculation isnt requested yet, again all will be ok: 1,2,6,7 c. calculation is requested and a snapshot is taken after that but before results arrive. here we have problems: * game expects results but nobody is aware of situation: we can do some hacking here, for example, implement readObject method in game, so when it is deserialized from a snapshot, it can re-request calculations. alternatively after cache recovery, it may re-request result waiting calculations. may lead to some complications but say that are ok for now. * results arrival time is also a problem here. hours or even days may be past after last snapshot, and we need to insert results at a proper time at game's event queue. again may lead to some complications regards, r a f t ------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org _______________________________________________ To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion _______________________________________________ "Databases in Memoriam" -- http://www.prevayler.org |
| Free embeddable forum powered by Nabble | Forum Help |