Epidemic version 1.0

Epidemic enables a shared key-value tuple space for your motes. The
tuple space is automatically synchronized in the background between
motes with a controlled flood. The timing from Phil Levis's Trickle
algorithm is used to limit the bandwidth consumed by the flood.

This component can be used instead of Bcast, because it propagates
quickly when changes are inserted. But, whereas Bcast floods are
transient and unreliable, Epidemic floods are reliable and have
soft-state persistence. When a value is changed at one mote, you can
rely on it eventually being propagated to every other subscribing
mote. If a mote is disconnected or rebooted, it will be automatically
be updated when it re-establishes connectivity.
 
The tuple-space key is composed of two pieces: 

 * a 3-byte component ID
   - This is intended to allow multiple components to have 
     their own namespaces.

 * a 1-byte channel ID
   - This is intended to distinguish between variables within
     a component.

To subscribe to a key, user-level components must call the
registration function in their own start(). This registration function
takes the key, a pointer to a buffer that will be used to cache the
data, and the length of the data object. Using a user-provided buffer
for the cache space enables data objects of any size to be used
without wasting cache space for unused objects. Objects that are not
subscribed to by a given mote will not be propagated or cached, and
unused cache entries take up a small amount of space.

The size of the data object can range from 0 (with a NULL pointer) to
(TOSH_DATA_LENGTH-6). A key with no data object is intended to act as
a simple command. The registration function can be called as many
times as there are spaces in the metadata cache, which defaults to 8
but can be changed in EpidemicM.nc.

If the only use of the flood is to change a value on the mote, passing
in that variable as the cache space will do this automatically with no
further programming. To support more complex action when a value
changes, the handler function will be called for each change. If both
the old and new values are needed for this action, it is the
component's responsibility to save its own copy whenever the value
changes.

Usage:

Add the contrib/ucb/tos/lib/Epidemic directory to your PFLAGS -I. 

TestEpidemic is in contrib/ucb/apps

A Java program called EpidemicInject is in
contrib/ucb/tools/java/net/tinyos/tools. This can be used to change an
integer value on a UART-attached mote and let it propagate through the
network.

This component should be useful for network actuation, runtime
modification of "magic values" in your TinyOS programs, propagation of
queries, etc. I have tested it and it works, but your mileage may
vary. Give it a try, and let me know if it makes any of your
programming easier.

Gilman Tolle
<get@cs.berkeley.edu>

 
