net.i2p.router.peermanager

## Class TunnelHistory

- java.lang.Object
- - net.i2p.router.peermanager.TunnelHistory

-     public class TunnelHistory
      extends Object

  Tunnel related history information

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) static long[]` | `RATES`
    `static int` | `TUNNEL_REJECT_BANDWIDTH` tunnel rejection due to excess bandwidth usage - used for most rejections even if not really for bandwidth
    `static int` | `TUNNEL_REJECT_CRIT` tunnel rejection due to system failure - not currently used
    `static int` | `TUNNEL_REJECT_PROBABALISTIC_REJECT` probabalistic tunnel rejection due to a flood of requests - infrequent
    `static int` | `TUNNEL_REJECT_TRANSIENT_OVERLOAD` tunnel rejection due to temporary cpu/job/tunnel overload - rare

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TunnelHistory(RouterContext context, String statGroup)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `coalesceStats()`
    `RateStat` | `getFailedRate()`
    `long` | `getLastAgreedTo()` when the peer last agreed to participate in a tunnel
    `long` | `getLastFailed()` when the last tunnel the peer participated in failed
    `long` | `getLastRejectedBandwidth()` when the peer last refused to participate in a tunnel complaining of bandwidth overload
    `long` | `getLastRejectedCritical()` when the peer last refused to participate in a tunnel with level of critical
    `long` | `getLastRejectedProbabalistic()` when the peer last refused to participate in a tunnel probabalistically
    `long` | `getLastRejectedTransient()` when the peer last refused to participate in a tunnel complaining of transient overload
    `long` | `getLifetimeAgreedTo()` total tunnels the peer has agreed to participate in
    `long` | `getLifetimeFailed()` total tunnels the peer has agreed to participate in that were later marked as failed prematurely
    `long` | `getLifetimeRejected()` total tunnels the peer has refused to participate in
    `RateStat` | `getRejectionRate()`
    `void` | `incrementAgreedTo()`
    `void` | `incrementFailed(int pct)` Define this rate as the probability it really failed
    `void` | `incrementProcessed(int processedSuccessfully, int failedProcessing)`
    `void` | `incrementRejected(int severity)`
    `void` | `load(Properties props)`
    `void` | `reset()` Reset all tunnel history counters and timestamps.
    `void` | `store(OutputStream out)`
    `void` | `store(OutputStream out, boolean addComments)` write out the data from the profile to the stream

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### RATES

          static final long[] RATES

    - #### TUNNEL_REJECT_BANDWIDTH

          public static final int TUNNEL_REJECT_BANDWIDTH

      tunnel rejection due to excess bandwidth usage - used for most rejections even if not really for bandwidth
      See Also:
        Constant Field Values

    - #### TUNNEL_REJECT_CRIT

          public static final int TUNNEL_REJECT_CRIT

      tunnel rejection due to system failure - not currently used
      See Also:
        Constant Field Values

    - #### TUNNEL_REJECT_PROBABALISTIC_REJECT

          public static final int TUNNEL_REJECT_PROBABALISTIC_REJECT

      probabalistic tunnel rejection due to a flood of requests - infrequent
      See Also:
        Constant Field Values

    - #### TUNNEL_REJECT_TRANSIENT_OVERLOAD

          public static final int TUNNEL_REJECT_TRANSIENT_OVERLOAD

      tunnel rejection due to temporary cpu/job/tunnel overload - rare
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TunnelHistory

          public TunnelHistory(RouterContext context,
                               String statGroup)

  - ### Method Detail

    - #### coalesceStats

          public void coalesceStats()

    - #### getFailedRate

          public RateStat getFailedRate()

    - #### getLastAgreedTo

          public long getLastAgreedTo()

      when the peer last agreed to participate in a tunnel

    - #### getLastFailed

          public long getLastFailed()

      when the last tunnel the peer participated in failed

    - #### getLastRejectedBandwidth

          public long getLastRejectedBandwidth()

      when the peer last refused to participate in a tunnel complaining of bandwidth overload

    - #### getLastRejectedCritical

          public long getLastRejectedCritical()

      when the peer last refused to participate in a tunnel with level of critical

    - #### getLastRejectedProbabalistic

          public long getLastRejectedProbabalistic()

      when the peer last refused to participate in a tunnel probabalistically

    - #### getLastRejectedTransient

          public long getLastRejectedTransient()

      when the peer last refused to participate in a tunnel complaining of transient overload

    - #### getLifetimeAgreedTo

          public long getLifetimeAgreedTo()

      total tunnels the peer has agreed to participate in

    - #### getLifetimeFailed

          public long getLifetimeFailed()

      total tunnels the peer has agreed to participate in that were later marked as failed prematurely

    - #### getLifetimeRejected

          public long getLifetimeRejected()

      total tunnels the peer has refused to participate in

    - #### getRejectionRate

          public RateStat getRejectionRate()

    - #### incrementAgreedTo

          public void incrementAgreedTo()

    - #### incrementFailed

          public void incrementFailed(int pct)

      Define this rate as the probability it really failed
      Parameters:
        `pct` - = probability * 100

    - #### incrementProcessed

          public void incrementProcessed(int processedSuccessfully,
                                         int failedProcessing)

    - #### incrementRejected

          public void incrementRejected(int severity)

      Parameters:
        `severity` - how much the peer doesnt want to participate in the tunnel (large == more severe)

    - #### load

          public void load(Properties props)

    - #### reset

          public void reset()

      Reset all tunnel history counters and timestamps. Used to give ghost peers a fresh start.

    - #### store

          public void store(OutputStream out)
                     throws IOException

      Throws:
        `IOException`

    - #### store

          public void store(OutputStream out,
                            boolean addComments)
                     throws IOException

      write out the data from the profile to the stream
      Parameters:
        `addComments` - add comment lines to the output
      Throws:
        `IOException`