dd.ptr.api
Class GetPtrReq

java.lang.Object
  |
  +--dd.ptr.api.PtrReq
        |
        +--dd.ptr.api.GetPtrReq
All Implemented Interfaces:
QueueElementIF

public class GetPtrReq
extends PtrReq

Ask for the publish info of certain objects from the pointer manager stage.

Version:
$Id: GetPtrReq.java,v 1.3 2004/05/03 20:39:14 hweather Exp $
Author:
Jeremy Stribling

Field Summary
 bamboo.vivaldi.VirtualCoordinate coordinate
          VirtualCoordinate used to calculate relative distances.
 boolean local
          SQL-like query equivalent to SELECT pinfo FROM p AS ptrs WHERE p.local=true AND p.objguid=objguid That is, select PublishInfo's where the src is this node.
 boolean nonroot
          SQL-like query equivalent to SELECT pinfo FROM p AS ptrs WHERE p.root=false AND p.objguid=objguid That is, select PublishInfo's that this node is the root for.
 SecureHash[] objguids
          Array of objguids of ptrs to retrieve from the PtrMgr stage.
 short policy
          policy defines the SQL-like query to run over the ptr, level, and host data structures.
static short POLICY_DEAD
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level=root AND l.guid=p.guid AND p.src=h.guid AND h.state=DEAD.
static short POLICY_DOWN
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS level WHERE p.objguid=objguid AND l.level=root AND l.guid=p.objguid AND p.src=h.guid AND (h.state=DEAD OR h.state=HIBERNATING).
static short POLICY_EXPIRED
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, l AS levels WHERE p.objguid=objguid AND l.p.deadline > now.
static short POLICY_HIBERNATING
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level=root AND l.guid=p.objguid AND p.src=h.guid AND h.state=HIBERNATING.
static short POLICY_INSTANCEOF_THRESHOLD
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, l AS levels WHERE p.objguid = objguid AND l.level=root AND l.guid=p.objguid AND (p.tag instanceof DDThresholdTag).
static short POLICY_NONE
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs WHERE p.objguid=objguid.
static short POLICY_NORMAL
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level=root AND l.guid=p.objguid AND p.src=h.guid AND h.state=NORMAL.
static short POLICY_REVIVING
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level=root AND l.guid=p.objguid AND p.src=h.guid AND h.state=REVIVING.
static String[] POLICY_STRING
          Strings corresponding to ptr queries.
static short POLICY_THRESHOLD_REACHED
          SQL-like query equivalent to SELECT pinfos FROM p1 AS ptrs, l AS levels WHERE p1.objguid=objguid AND l.level=root AND l.guid=p1.objguid AND (p1.tag instanceof DDThresholdTag) AND p1.low_watermark > (SELECT COUNT FROM p2 as ptrs, h AS hosts WHERE p1.objguid=p2.objguid AND p1.tag=p2.tag AND p2.src=h.guid AND (h.state=NORMAL OR h.state=REVIVING) That is, select PublishInfo's where the remaining number of PublishInfo's is less that the DDThresholdTag.low_watermark.
static short POLICY_UP
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level==root AND l.guid=p.objguid AND p.src=h.guid AND (h.state=NORMAL OR h.state=REVIVING).
static short POLICY_UP_OR_HIBERNATING
          SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level==root AND l.guid=p.objguid AND p.src=h.guid AND (h.state=NORMAL OR h.state=REVIVING OR h.state=HIBERNATING) .
 boolean root
          SQL-like query equivalent to SELECT pinfo FROM p AS ptrs WHERE p.root=true AND p.objguid=objguid That is, select PublishInfo's that this node is the root for.
 boolean useCache
          Flag indicating whether query should use the cache (if there is a valid entry) or only use disk.
 
Fields inherited from class dd.ptr.api.PtrReq
appId, sink, userData
 
Constructor Summary
GetPtrReq(SecureHash[] objguids, short policy, boolean root, boolean nonroot, boolean local, boolean useCache, bamboo.vivaldi.VirtualCoordinate coordinate, long appId, Object userData, SinkIF sink)
          Constructor: Creates a new GetPtrReq.
GetPtrReq(SecureHash objguid, short policy, boolean root, boolean nonroot, boolean local, boolean useCache, bamboo.vivaldi.VirtualCoordinate coordinate, long appId, Object userData, SinkIF sink)
          Constructor: Creates a new GetPtrReq.
 
Method Summary
 String toString()
          Specified by java.lang.Object
 
Methods inherited from class dd.ptr.api.PtrReq
BUG
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POLICY_NONE

public static final short POLICY_NONE
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs WHERE p.objguid=objguid. That is, select all PublishInfo's that match the given objguid.

See Also:
Constant Field Values

POLICY_EXPIRED

public static final short POLICY_EXPIRED
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, l AS levels WHERE p.objguid=objguid AND l.p.deadline > now. That is, for all the ptrs where the local node is root, select expired PublishInfo's.

See Also:
Constant Field Values

POLICY_UP

public static final short POLICY_UP
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level==root AND l.guid=p.objguid AND p.src=h.guid AND (h.state=NORMAL OR h.state=REVIVING). That is, select PublishInfo's that match the given objguid, local node is root, and where host is up.

See Also:
Constant Field Values

POLICY_UP_OR_HIBERNATING

public static final short POLICY_UP_OR_HIBERNATING
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level==root AND l.guid=p.objguid AND p.src=h.guid AND (h.state=NORMAL OR h.state=REVIVING OR h.state=HIBERNATING) . That is, select PublishInfo's that match the given objguid, local node is root, and where host is up or hibernating (we don't know up or down).

See Also:
Constant Field Values

POLICY_DOWN

public static final short POLICY_DOWN
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS level WHERE p.objguid=objguid AND l.level=root AND l.guid=p.objguid AND p.src=h.guid AND (h.state=DEAD OR h.state=HIBERNATING). That is, select PublishInfo's that match the given objguid, local node is root, and where host is down.

See Also:
Constant Field Values

POLICY_NORMAL

public static final short POLICY_NORMAL
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level=root AND l.guid=p.objguid AND p.src=h.guid AND h.state=NORMAL. That is, select PublishInfo's that match the given objguid, local node is root, and where host is normal.

See Also:
Constant Field Values

POLICY_REVIVING

public static final short POLICY_REVIVING
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level=root AND l.guid=p.objguid AND p.src=h.guid AND h.state=REVIVING. That is, select PublishInfo's that match the given objguid, local node is root, and where host is reviving.

See Also:
Constant Field Values

POLICY_HIBERNATING

public static final short POLICY_HIBERNATING
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level=root AND l.guid=p.objguid AND p.src=h.guid AND h.state=HIBERNATING. That is, select PublishInfo's that match the given objguid, local node is root, and where host is hibernating.

See Also:
Constant Field Values

POLICY_DEAD

public static final short POLICY_DEAD
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, h AS hosts, l AS levels WHERE p.objguid=objguid AND l.level=root AND l.guid=p.guid AND p.src=h.guid AND h.state=DEAD. That is, select PublishInfo's that match the given objguid, local node is root, and where host is dead.

See Also:
Constant Field Values

POLICY_INSTANCEOF_THRESHOLD

public static final short POLICY_INSTANCEOF_THRESHOLD
SQL-like query equivalent to SELECT pinfos FROM p AS ptrs, l AS levels WHERE p.objguid = objguid AND l.level=root AND l.guid=p.objguid AND (p.tag instanceof DDThresholdTag). That is, select PublishInfo's that local node is root and where tag instanceof DDThresholdTag.

See Also:
Constant Field Values

POLICY_THRESHOLD_REACHED

public static final short POLICY_THRESHOLD_REACHED
SQL-like query equivalent to SELECT pinfos FROM p1 AS ptrs, l AS levels WHERE p1.objguid=objguid AND l.level=root AND l.guid=p1.objguid AND (p1.tag instanceof DDThresholdTag) AND p1.low_watermark > (SELECT COUNT FROM p2 as ptrs, h AS hosts WHERE p1.objguid=p2.objguid AND p1.tag=p2.tag AND p2.src=h.guid AND (h.state=NORMAL OR h.state=REVIVING) That is, select PublishInfo's where the remaining number of PublishInfo's is less that the DDThresholdTag.low_watermark.

See Also:
Constant Field Values

POLICY_STRING

public static final String[] POLICY_STRING
Strings corresponding to ptr queries. Used for debugging.


objguids

public SecureHash[] objguids
Array of objguids of ptrs to retrieve from the PtrMgr stage.


root

public boolean root
SQL-like query equivalent to SELECT pinfo FROM p AS ptrs WHERE p.root=true AND p.objguid=objguid That is, select PublishInfo's that this node is the root for. NOTE ALSO: cannot also run query over combined root (or non-root) and local ptrs. That is, root=true AND local=true.


nonroot

public boolean nonroot
SQL-like query equivalent to SELECT pinfo FROM p AS ptrs WHERE p.root=false AND p.objguid=objguid That is, select PublishInfo's that this node is the root for. NOTE ALSO: cannot also run query over combined root (or non-root) and local ptrs. That is, root=true AND local=true.


local

public boolean local
SQL-like query equivalent to SELECT pinfo FROM p AS ptrs WHERE p.local=true AND p.objguid=objguid That is, select PublishInfo's where the src is this node. NOTE ALSO: cannot also run query over combined root and local ptrs. That is, root=true AND local=true.


useCache

public boolean useCache
Flag indicating whether query should use the cache (if there is a valid entry) or only use disk.


coordinate

public bamboo.vivaldi.VirtualCoordinate coordinate
VirtualCoordinate used to calculate relative distances.


policy

public short policy
policy defines the SQL-like query to run over the ptr, level, and host data structures.

Constructor Detail

GetPtrReq

public GetPtrReq(SecureHash[] objguids,
                 short policy,
                 boolean root,
                 boolean nonroot,
                 boolean local,
                 boolean useCache,
                 bamboo.vivaldi.VirtualCoordinate coordinate,
                 long appId,
                 Object userData,
                 SinkIF sink)
Constructor: Creates a new GetPtrReq.

For a valid setting at least one has to be true: root, nonroot, or local. Also, local overrides root and nonroot, so either (local=T and root=F and nonroot=F) or (local=F and root=T and/or nonroot=T)

Parameters:
objguids - Array of objguids to retrieve from DHT.
policy - SQL-like query to run over the ptr and host.
root - Select ptrs that this node is the root for.
nonroot - Select ptrs that this node is not the root for.
local - Select local ptrs that this node is the server for.
useCache - Flag indicating to use the cache of pointers.
coordinate - VirtualCoordinate used to calculate relative distances.
appId - Unique identifier for a destination application.
userData - Requestor defined object to be returned in the resp.
sink - Requestor sink to return resp.

GetPtrReq

public GetPtrReq(SecureHash objguid,
                 short policy,
                 boolean root,
                 boolean nonroot,
                 boolean local,
                 boolean useCache,
                 bamboo.vivaldi.VirtualCoordinate coordinate,
                 long appId,
                 Object userData,
                 SinkIF sink)
Constructor: Creates a new GetPtrReq.

For a valid setting at least one has to be true: root, nonroot, or local. Also, local overrides root and nonroot, so either (local=T and root=F and nonroot=F) or (local=F and root=T and/or nonroot=T)

Parameters:
objguid - objguid retrieve from DHT.
policy - SQL-like query to run over the ptr and host.
root - Select ptrs that this node is the root for.
nonroot - Select ptrs that this node is not the root for.
local - Select local ptrs that this node is the server for.
useCache - Flag indicating to use the cache of pointers.
coordinate - VirtualCoordinate used to calculate relative distances.
appId - Unique identifier for a destination application.
userData - Requestor defined object to be returned in the resp.
sink - Requestor sink to return resp.
Method Detail

toString

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

Specified by:
toString in class PtrReq