ANTS v2.0 API

apps.statsfusion
Class StatsReturnCapsule

java.lang.Object
  |
  +--ants.core.Capsule
        |
        +--apps.statsfusion.StatsReturnCapsule

public class StatsReturnCapsule
extends Capsule

Stats return capsule.

Author:
Utah Janos Team

Field Summary
 java.util.Vector branches
           
 int cachetime
          The number of seconds to wait in the NodeCache before expiring
 long capTime
           
 ByteArray data
           
 int dpt
          Capsule headers which only occur in the main capsule
 java.util.Vector fusedcapsules
          All capsules fused with this one
 int infosource
          Capsule headers and statistics returns
 long keyid
           
 long latency
           
 int nodessentto
           
 int numstatsstrings
           
 int parentnode
           
 boolean partial
           
 long removekey
          An arbitrary number used to single out this capsule from other return capsules in a node cache
 int rootaddress
           
 ByteArray statsstrings
           
 
Fields inherited from class ants.core.Capsule
MAX_TTL
 
Constructor Summary
StatsReturnCapsule()
           
StatsReturnCapsule(int d)
           
StatsReturnCapsule(long keyid, int rootaddress)
          Constructor used when StatsReturnCapsule is sitting in the node cache
StatsReturnCapsule(short sa, short da, int na, Node n)
           
 
Method Summary
 Xdr decode()
          Decode a capsule header from this Capsule's xdr field.
 Xdr encode()
          Return capsule data looks like:
4 Address of the actual source of the information
4 Address of the node that requested stats from source node
8 Time capsule this is a response to was sent
8 Latency (0 if latency has yet to be figured)
8 The key id of this capsule (used in the node cache)
4 Number of nodes the source of this return sent to
4 Cachetime parameter n The addresses of the nodes the request was sent to
n The byte array containing the return data
 boolean equals(java.lang.Object o)
          Used when a StatsReturnCapsule is held in a NodeCache
 boolean evaluate(Node n)
          The forwarding routine for the Capsule.
 void fuse(StatsReturnCapsule src)
          Fuses the information from src into this capsule
 int hashCode()
          Used when a StatsReturnCapsule is held in a NodeCache
 int length()
          Return the length of the capsule header that all capsule encodings will include.
 void setData(ByteArray ba)
           
 void showInformation(StatsReturnCapsule hsrc, Node n)
          Print out the information that is contained in this capsule
 void subdecode(Xdr xdr)
          Subencode is called on each fused capsule and the parent capsule to decode only the capsules data.
 void subencode(Xdr xdr)
          Subencode is called on each fused capsule and the parent capsule to encode only its own data
 int sublength()
          Sublength is called on each fused capsule and the parent capsule to get the length of just that capsule
 
Methods inherited from class ants.core.Capsule
create, encodeCapsuleForSend, findExtension, findMID, findPID, getDst, getPrevious, getSrc, getTTL, prime, setDst, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

infosource

public int infosource
Capsule headers and statistics returns

parentnode

public int parentnode

capTime

public long capTime

latency

public long latency

keyid

public long keyid

nodessentto

public int nodessentto

branches

public java.util.Vector branches

dpt

public int dpt
Capsule headers which only occur in the main capsule

rootaddress

public int rootaddress

data

public ByteArray data

partial

public boolean partial

numstatsstrings

public int numstatsstrings

statsstrings

public ByteArray statsstrings

cachetime

public int cachetime
The number of seconds to wait in the NodeCache before expiring

removekey

public long removekey
An arbitrary number used to single out this capsule from other return capsules in a node cache

fusedcapsules

public java.util.Vector fusedcapsules
All capsules fused with this one
Constructor Detail

StatsReturnCapsule

public StatsReturnCapsule()

StatsReturnCapsule

public StatsReturnCapsule(int d)

StatsReturnCapsule

public StatsReturnCapsule(long keyid,
                          int rootaddress)
Constructor used when StatsReturnCapsule is sitting in the node cache

This sets only the information neccessary to compare this capsule to those sitting in the node cache.


StatsReturnCapsule

public StatsReturnCapsule(short sa,
                          short da,
                          int na,
                          Node n)
Method Detail

length

public int length()
Description copied from class: Capsule
Return the length of the capsule header that all capsule encodings will include.
Overrides:
length in class Capsule
Tags copied from class: Capsule
Returns:
the length of the capsule header

sublength

public int sublength()
Sublength is called on each fused capsule and the parent capsule to get the length of just that capsule

encode

public Xdr encode()
Return capsule data looks like:
4 Address of the actual source of the information
4 Address of the node that requested stats from source node
8 Time capsule this is a response to was sent
8 Latency (0 if latency has yet to be figured)
8 The key id of this capsule (used in the node cache)
4 Number of nodes the source of this return sent to
4 Cachetime parameter n The addresses of the nodes the request was sent to
n The byte array containing the return data

The data in the capsule contains strings which specify the actual statistics of the node this is returning from

The header for an entire return capsule looks like:
4 The number of fused capules
4 The destination application port
4 The address of the root of this tree
1 The partial flag (indicates that more returns might come from this source
4 The number of stats strings in each return capsule
n The return stats header strings

Overrides:
encode in class Capsule
Tags copied from class: Capsule
Returns:
the new Xdr representing this capsule.
See Also:
#xdr

subencode

public void subencode(Xdr xdr)
Subencode is called on each fused capsule and the parent capsule to encode only its own data

decode

public Xdr decode()
Description copied from class: Capsule
Decode a capsule header from this Capsule's xdr field.
Overrides:
decode in class Capsule
Tags copied from class: Capsule
Returns:
the new Xdr based on the current xdr.

subdecode

public void subdecode(Xdr xdr)
Subencode is called on each fused capsule and the parent capsule to decode only the capsules data.

evaluate

public boolean evaluate(Node n)
Description copied from class: Capsule
The forwarding routine for the Capsule. This is invoked by the router when a capsule is received.

This method should not access other Java classes, and should only interact with the local system through the local node interface. This routine should "terminate quickly."

XXX perhaps default to forwarding the Capsule?

Overrides:
evaluate in class Capsule
Tags copied from class: Capsule
Parameters:
node - the local node interface
Returns:
an indicationof whether the forwarding was successful.

showInformation

public void showInformation(StatsReturnCapsule hsrc,
                            Node n)
Print out the information that is contained in this capsule

fuse

public void fuse(StatsReturnCapsule src)
Fuses the information from src into this capsule

Note that this only holds on to a reference to the capsule to be fused until this capsule is actually sent

Parameters:
src - - The capsule to fuse with this one

setData

public void setData(ByteArray ba)

equals

public boolean equals(java.lang.Object o)
Used when a StatsReturnCapsule is held in a NodeCache
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Used when a StatsReturnCapsule is held in a NodeCache
Overrides:
hashCode in class java.lang.Object

ANTS v2.0 API

This documentation is Copyright (C) 1998-2001 The University of Utah and the University of Washington. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for ANTS v2.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/