[e-lang] Adding Reactor to Lamport Slot without immediate send?
Martin Scheffler
wooyay at web.de
Wed Dec 6 05:10:20 CST 2006
2006/12/6, Kevin Reid <kpreid at mac.com>:
> ? slot.getValue()
> # value: "foo"
>
> ? slot.getCurrent()
> # value: ["foo", 153]
That would be great. As an alternative, we could add another function that subscribes starting from the next update:
def makeLamportSlot (){
...
to whenUpdatedStartingNow(reactor :EverReactor) :void {
lamportReporter.whenUpdated(reactor, myGeneration+1)
}
...
}
> On the other hand, your reactToUpdate could just do nothing but
> resubscribe if the new value is equal to the old one.
Yes I could, but will have a lot of slots and my app is starting to get slow
On Dec 5, 2006, at 17:48, Mark Miller wrote:
> How did you obtain the current value of the lamport slot?
>
> I assume the slot is near to the 'client' (and possibly a downstream
> presence).
The slot is on the server side.
1. The server calls a function on the client with the current slot value as an argument
2. the client creates a new reactor using the current value and returns a ref to the server
3. The server subscribes the reactor far ref to the slot.
Actually I wrapped the reactor in an object called field and the lamport slot in an object called route.
This way I could build a poor mans data streaming system a la Iris Performer.
? def fieldin:=<emonkey:fields.makeField>("Hello Fields", String)
? def fieldout:=<emonkey:fields.makeField>("Start value", String)
? def route:=<emonkey:fields.makeLamportRoute>(fieldin, fieldout)
? fieldout.setOnPut(fn newval{println("Out got new value: "+newval})
? fieldin.put("Bla")
> Out got new value: Bla
It works pretty good, although at some time I will have to write a different kind of route/reporter. The network roundtrip time is a pretty big limiter.
Cheers,
Martin
______________________________________________________________________________
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!
More information about the e-lang
mailing list