tapestry.dissemination
Class DisseminationSetPredicate

java.lang.Object
  |
  +--tapestry.dissemination.DisseminationSetPredicate
All Implemented Interfaces:
QuickSerializable

public class DisseminationSetPredicate
extends Object
implements QuickSerializable

DisseminationSetPredicate is used to specify the constraints that the dissemination set must satisfy. For example, the following SQL-like query SELECT 64 distinct(node)
WHERE availability > 0.95 AND
distinct(label/classification) AND
distinct(domain) AND
distinct(location) AND
spread(time zone)
the above SQL-like query is equivalent to requesting 64 nodes that have a high probability of being up, the intersection between their classification, domain, and location is empty (i.e. they are not correlated, have different domains, and are geographically, spread), and their is an affinity to pick nodes in different time zones.

The query result is simply a set of nodes that satisfies the query or an empty set if the query cannot be satisfied.

USAGE

To receive a dissemination set, dispatch a RequestDisseminationSetMsg containing a DisseminationSetPredicate. When the SetCreator receives the message, it will respond with a RequestDisseminationSetResponseMsg containing a set of dissemination sets.

Version:
$Id: DisseminationSetPredicate.java,v 1.1.1.1 2004/03/26 19:57:11 hweather Exp $
Author:
Hakim Weatherspoon
See Also:
SetCreatorStage, RequestDisseminationSetQuery, RequestDisseminationSetResponseMsg, TapestryLocateMsg

Field Summary
static byte CONSTRAINT_ANY
           
static byte CONSTRAINT_DISTINCT
           
static byte CONSTRAINT_NONE
           
static byte CONSTRAINT_SAME
           
static byte CONSTRAINT_SPREAD
           
static String[] CONSTRAINT_STRING
           
 
Constructor Summary
DisseminationSetPredicate(InputBuffer buffer)
          Constructs a DisseminationSetPredicate from its serialized form.
DisseminationSetPredicate(int numNodes, double availability, long lifetime, byte classification, byte domain, byte location, byte timeZone, HostAppFilter filter)
          Construct according to the given fields.
DisseminationSetPredicate(int minNumNodes, int maxNumNodes, double availability, long lifetime, byte classification, byte domain, byte location, byte timeZone, HostAppFilter filter)
          Construct according to the given fields.
 
Method Summary
 double getAvailability()
          getAvailability returns minimum threshold of availability for a node in the dissemination set.
 byte getClassification()
          getClassification returns classification constraint that the dissemination set needs to satifsfy.
 byte getDomain()
          getDomain returns domain constraint that the dissemination set needs to satifsfy.
 HostAppFilter getFilter()
          getFilter returns an application filter summarizing the applications that hosts must export.
 long getLifetime()
          getLifetime returns minimum threshold of lifetime (in us) for a node in the dissemination set.
 byte getLocation()
          getLocation returns location constraint that the dissemination set needs to satifsfy.
 int getMaxNumNodes()
          getMaxNumNodes returns the maximum number of nodes requested to be returned; that is, size of the returned dissemination set.
 int getMinNumNodes()
          getMinNumNodes returns the minimum number of nodes requested to be returned; that is, size of the returned dissemination set.
 byte getTimeZone()
          getTimeZone returns timeZone constraint that the dissemination set needs to satifsfy.
 void serialize(OutputBuffer buffer)
          Specified by ostore.util.QuickSerializable
 String toString()
          Specified by java.lang.Object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONSTRAINT_NONE

public static final byte CONSTRAINT_NONE
See Also:
Constant Field Values

CONSTRAINT_DISTINCT

public static final byte CONSTRAINT_DISTINCT
See Also:
Constant Field Values

CONSTRAINT_ANY

public static final byte CONSTRAINT_ANY
See Also:
Constant Field Values

CONSTRAINT_SAME

public static final byte CONSTRAINT_SAME
See Also:
Constant Field Values

CONSTRAINT_SPREAD

public static final byte CONSTRAINT_SPREAD
See Also:
Constant Field Values

CONSTRAINT_STRING

public static final String[] CONSTRAINT_STRING
Constructor Detail

DisseminationSetPredicate

public DisseminationSetPredicate(int numNodes,
                                 double availability,
                                 long lifetime,
                                 byte classification,
                                 byte domain,
                                 byte location,
                                 byte timeZone,
                                 HostAppFilter filter)
Construct according to the given fields.


DisseminationSetPredicate

public DisseminationSetPredicate(int minNumNodes,
                                 int maxNumNodes,
                                 double availability,
                                 long lifetime,
                                 byte classification,
                                 byte domain,
                                 byte location,
                                 byte timeZone,
                                 HostAppFilter filter)
Construct according to the given fields.


DisseminationSetPredicate

public DisseminationSetPredicate(InputBuffer buffer)
                          throws QSException
Constructs a DisseminationSetPredicate from its serialized form.

Parameters:
buffer - serialized form of object.
Method Detail

getMinNumNodes

public int getMinNumNodes()
getMinNumNodes returns the minimum number of nodes requested to be returned; that is, size of the returned dissemination set.

Returns:
minimum number of nodes (i.e. min size of dissemination set).

getMaxNumNodes

public int getMaxNumNodes()
getMaxNumNodes returns the maximum number of nodes requested to be returned; that is, size of the returned dissemination set.

Returns:
maximum number of nodes (i.e. max size of dissemination set).

getAvailability

public double getAvailability()
getAvailability returns minimum threshold of availability for a node in the dissemination set.

Returns:
minimum node availability.

getLifetime

public long getLifetime()
getLifetime returns minimum threshold of lifetime (in us) for a node in the dissemination set.

Returns:
minimum node lifetime.

getClassification

public byte getClassification()
getClassification returns classification constraint that the dissemination set needs to satifsfy. For example, no constraint on classification, or each node has a distinct classification, or each node has a any classification, or each node has the same classification, or set of classifications is spread over all possible classifications (i.e. there may be nodes with duplicate classifications).

Returns:
classification that the dissemination set needs to satisfy.

getDomain

public byte getDomain()
getDomain returns domain constraint that the dissemination set needs to satifsfy. For example, no constraint on domain, or each node has a distinct domain, or each node has a any domain, or each node has the same domain, or set of domains is spread over all possible domains (i.e. there may be nodes with duplicate domains).

Returns:
domain that the dissemination set needs to satisfy.

getLocation

public byte getLocation()
getLocation returns location constraint that the dissemination set needs to satifsfy. For example, no constraint on location, or each node has a distinct location, or each node has a any location, or each node has the same location, or set of locations is spread over all possible locations (i.e. there may be nodes with duplicate locations).

Returns:
location that the dissemination set needs to satisfy.

getTimeZone

public byte getTimeZone()
getTimeZone returns timeZone constraint that the dissemination set needs to satifsfy. For example, no constraint on timeZone, or each node has a distinct timeZone, or each node has a any timeZone, or each node has the same timeZone, or set of timeZones is spread over all possible timeZones (i.e. there may be nodes with duplicate timeZones).

Returns:
timeZone that the dissemination set needs to satisfy.

getFilter

public HostAppFilter getFilter()
getFilter returns an application filter summarizing the applications that hosts must export. For example, filter specify storage server if looking for a storage node.

Returns:
an application filter summarizing the applications that hosts must export.

serialize

public void serialize(OutputBuffer buffer)
Specified by ostore.util.QuickSerializable

Specified by:
serialize in interface QuickSerializable

toString

public String toString()
Specified by java.lang.Object

Overrides:
toString in class Object