org.erights.e.elib.slot
Interface EverReporter

All Superinterfaces:
Slot

public interface EverReporter
extends Slot

Untamed: Reports new values to subscribed EverReactors.

The Reporter/Reactor pattern is much like the Observable/Observer pattern (or the bean/Listener pattern), described by the following terminology:

To accommodate distributed programming, the Reporter/Reactor subscription patterns differ from the conventional Observer pattern as follows: The EverReporter/EverReactor pair is the main example of the virtual continuing subscription pattern. A virtual continuing subscription is built out of one-report subscriptions as follows: An EverReporter is a Reporter that reports successively more recent versions of a single value to its registered EverReactors. EverReactors are assumed to care about only the most recent available version of the value, so the "ever" protocol is lossy -- it skips unobserved intermediate values.

When the values to be reported are large, one can imagine more sophisticated variants of this protocol that send differences or update operations rather than new copies. However, these variants should be defined as new types, not as kinds of EverReporter/EverReactor.

Author:
Mark S. Miller, Derived from the Lamport Cell work done in collaboration with Dean Tribble and inspired by Leslie Lamport., Thanks to Terry Stanley and Marc Stiegler for the Reactor / Reporter terminology. Finding good terminology was harder than it looks.
See Also:
makeLamportSlot$lamportSlot, makeLamportSlot$lamportReporter, makeLamportSlot$lamportReactor

Method Summary
 Object getValue()
          Enabled: Synchronously return the locally stored value, which may be stale if this Reporter is also a Reactor downstream from a more authoritative Reporter.
 void setValue(Object newValue)
          Enabled: A typical EverReporter will normally double as a read-only Slot, in which case it should implement setValue to simply throw an informative exception.
 void whenUpdated(EverReactor reactor)
          Enabled: For initial connectivity.
 void whenUpdated(EverReactor reactor, BigInteger lastGeneration)
          Enabled: This is how a downstream EverReactor subscribes (or re-subscribes) with this EverReporter.
 

Method Detail

whenUpdated

public void whenUpdated(EverReactor reactor,
                        BigInteger lastGeneration)
Enabled: This is how a downstream EverReactor subscribes (or re-subscribes) with this EverReporter.

This EverReporter is being told

'reactor' has a value that's current as of 'lastGeneration'. When this EverReporter has more recent news, report it to him.
Once this EverReporter reports to the EverReactor, this EverReporter forgets the EverReactor, so the EverReactor will receive further reports only if it re-subscribes.


whenUpdated

public void whenUpdated(EverReactor reactor)
Enabled: For initial connectivity.

Should be equivalent to whenUpdated(reactor, -1)


getValue

public Object getValue()
Enabled: Synchronously return the locally stored value, which may be stale if this Reporter is also a Reactor downstream from a more authoritative Reporter.

A getValue() query is an expression of local interest: If this Reporter is also a whenever-reactor (see the class comment), then getValue() should trigger any delayed updating so that future getValue()s will come to be less stale.

Specified by:
getValue in interface Slot

setValue

public void setValue(Object newValue)
Enabled: A typical EverReporter will normally double as a read-only Slot, in which case it should implement setValue to simply throw an informative exception.

Specified by:
setValue in interface Slot


comments?