Query Cycle Simulator HEADER

qcsim.peer
Interface PeerBehavior

All Known Implementing Classes:
PeerBehaviorImpl

public interface PeerBehavior

Represents a peer's behavior during a simulation. The peer will use an object of this type to make decisions regarding its behavior.

Version:
1.0
Author:
unascribed

Field Summary
static int ACTIVITY_ALWAYSUP
           
static int ACTIVITY_ALWAYSUPNOQUERIES
           
static int ACTIVITY_RANDOM
           
static int GOOD_PEER
           
static int HIGHLY_TRUSTED_PEER
           
static int MALICIOUS_CAMOUFLAGED
           
static int MALICIOUS_COLLECTIVE
           
static int MALICIOUS_PEER
           
static int MALICIOUS_SPY
           
static int RPB_RANDOM
           
static int RPB_SIMPLEPROBABILISTIC
           
static int RPB_TRUSTDETERMINISTIC
           
static int RPB_TRUSTPROBABILISTIC
           
 
Method Summary
 void activity(int activity)
          Initializes uptime ratio and query activity ratio for all specified peers.
 int categoryPreference()
          Get the peers category preference.
 void categoryPreference(int preference)
          Indicates which category of files a peer is likely to respond to.
 void errorFraction(double errorFraction)
          The fraction of uploads that will contain errors.
 double opinion(Peer peer, boolean authenticFile)
          Will determine the value a peer should use to update it's local trust
 double queryActivity()
          The fraction of cycles this peer will participate by sending to queries.
 boolean respond(PeerMsgQuery msg)
          Will determine if peer should respond to a query
 int responseSelector()
          This determines how a peer will choose a site to download from.
 void responseSelector(int selector)
          Set the selector for how a peer will choose a download site.
 int type()
          The type of peer.
 void type(int type)
          Set the type of peer.
 double uploadStatus(Peer dest)
          Will determine the file upload status.
 

Field Detail

GOOD_PEER

public static final int GOOD_PEER
See Also:
Constant Field Values

HIGHLY_TRUSTED_PEER

public static final int HIGHLY_TRUSTED_PEER
See Also:
Constant Field Values

MALICIOUS_PEER

public static final int MALICIOUS_PEER
See Also:
Constant Field Values

MALICIOUS_COLLECTIVE

public static final int MALICIOUS_COLLECTIVE
See Also:
Constant Field Values

MALICIOUS_CAMOUFLAGED

public static final int MALICIOUS_CAMOUFLAGED
See Also:
Constant Field Values

MALICIOUS_SPY

public static final int MALICIOUS_SPY
See Also:
Constant Field Values

ACTIVITY_ALWAYSUP

public static final int ACTIVITY_ALWAYSUP
See Also:
Constant Field Values

ACTIVITY_RANDOM

public static final int ACTIVITY_RANDOM
See Also:
Constant Field Values

ACTIVITY_ALWAYSUPNOQUERIES

public static final int ACTIVITY_ALWAYSUPNOQUERIES
See Also:
Constant Field Values

RPB_RANDOM

public static final int RPB_RANDOM
See Also:
Constant Field Values

RPB_TRUSTDETERMINISTIC

public static final int RPB_TRUSTDETERMINISTIC
See Also:
Constant Field Values

RPB_TRUSTPROBABILISTIC

public static final int RPB_TRUSTPROBABILISTIC
See Also:
Constant Field Values

RPB_SIMPLEPROBABILISTIC

public static final int RPB_SIMPLEPROBABILISTIC
See Also:
Constant Field Values
Method Detail

queryActivity

public double queryActivity()
The fraction of cycles this peer will participate by sending to queries.

Returns:
the query activity.

type

public int type()
The type of peer.

Returns:
the peer type.

type

public void type(int type)
Set the type of peer.

Returns:
the peer type.

errorFraction

public void errorFraction(double errorFraction)
The fraction of uploads that will contain errors.

Parameters:
errorFraction - fraction of file upload errors.

categoryPreference

public void categoryPreference(int preference)
Indicates which category of files a peer is likely to respond to. For instance setting the value to RB_TOP will focus the peer's interest to top level categories of files.


categoryPreference

public int categoryPreference()
Get the peers category preference.

Returns:
TOP_CATEGORY, BOTTOM_CATEGORY, or RANDOM_CATEGORY

responseSelector

public int responseSelector()
This determines how a peer will choose a site to download from.

Returns:
selector type

responseSelector

public void responseSelector(int selector)
Set the selector for how a peer will choose a download site.

Parameters:
selector - type

respond

public boolean respond(PeerMsgQuery msg)
Will determine if peer should respond to a query

Parameters:
msg - The query message

uploadStatus

public double uploadStatus(Peer dest)
Will determine the file upload status.

Parameters:
dest - The destination peer.
Returns:
The files status: GOOD_FILE or BAD_FILE.

opinion

public double opinion(Peer peer,
                      boolean authenticFile)
Will determine the value a peer should use to update it's local trust

Parameters:
peer - the peer that was downloaded from.
authenticFile - true if the file download successful.

activity

public void activity(int activity)
Initializes uptime ratio and query activity ratio for all specified peers.


Query Cycle Simulator HEADER