Rice Pastry API

org.mpisws.p2p.transport.rendezvous
Class EphemeralDBImpl<Identifier,HighIdentifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.rendezvous.EphemeralDBImpl<Identifier,HighIdentifier>
All Implemented Interfaces:
EphemeralDB<Identifier,HighIdentifier>

public class EphemeralDBImpl<Identifier,HighIdentifier>
extends java.lang.Object
implements EphemeralDB<Identifier,HighIdentifier>


Field Summary
protected  java.util.Map<Identifier,java.lang.Long> ephemeralToTag
           
protected  java.util.Map<HighIdentifier,java.lang.Long> highToTag
           
protected  long nextTag
           
protected  long STALE_PORT_TIME
          Time where a NAT will have reset the port to a new forwarding in millis Default 2 hours
protected  java.util.Map<java.lang.Long,MutableTuple<Identifier,java.lang.Long>> tagToEphemeral
          maps tag to ephemeral and timestamp
 
Fields inherited from interface org.mpisws.p2p.transport.rendezvous.EphemeralDB
NO_TAG
 
Constructor Summary
EphemeralDBImpl(Environment env, long stalePortTime)
           
 
Method Summary
protected  void clear(long tag)
           
 Identifier getEphemeral(HighIdentifier high)
          Get the valid Identifier for this highIdentifier
 Identifier getEphemeral(long tag, Identifier i)
          Return a current valid Identifier for the tag, otherwise, return the default identifier only a getter
 long getTagForEphemeral(Identifier addr)
          Get the existing tag, or make a new one if needed
 void mapHighToTag(HighIdentifier high, long tag)
          Tell the DB that the high identifier points to this tag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STALE_PORT_TIME

protected long STALE_PORT_TIME
Time where a NAT will have reset the port to a new forwarding in millis Default 2 hours


nextTag

protected long nextTag

highToTag

protected java.util.Map<HighIdentifier,java.lang.Long> highToTag

ephemeralToTag

protected java.util.Map<Identifier,java.lang.Long> ephemeralToTag

tagToEphemeral

protected java.util.Map<java.lang.Long,MutableTuple<Identifier,java.lang.Long>> tagToEphemeral
maps tag to ephemeral and timestamp

Constructor Detail

EphemeralDBImpl

public EphemeralDBImpl(Environment env,
                       long stalePortTime)
Parameters:
env -
stalePortTime - how long until we should forget about the port binding
Method Detail

mapHighToTag

public void mapHighToTag(HighIdentifier high,
                         long tag)
Tell the DB that the high identifier points to this tag

Specified by:
mapHighToTag in interface EphemeralDB<Identifier,HighIdentifier>
Parameters:
high -
tag -

getEphemeral

public Identifier getEphemeral(HighIdentifier high)
Description copied from interface: EphemeralDB
Get the valid Identifier for this highIdentifier

Specified by:
getEphemeral in interface EphemeralDB<Identifier,HighIdentifier>
Returns:
null if there isn't a valid one

getEphemeral

public Identifier getEphemeral(long tag,
                               Identifier i)
Description copied from interface: EphemeralDB
Return a current valid Identifier for the tag, otherwise, return the default identifier only a getter

Specified by:
getEphemeral in interface EphemeralDB<Identifier,HighIdentifier>
i - the default identifier
Returns:

getTagForEphemeral

public long getTagForEphemeral(Identifier addr)
Description copied from interface: EphemeralDB
Get the existing tag, or make a new one if needed

Specified by:
getTagForEphemeral in interface EphemeralDB<Identifier,HighIdentifier>
Returns:

clear

protected void clear(long tag)

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection