net.tomp2p.p2p
Class Peer

java.lang.Object
  extended by net.tomp2p.p2p.Peer

public class Peer
extends Object

TomP2P implements besides the following distributed hash table (DHT) operations:

also the following DHHT operations: The advantage of a DHHT is that multiple values can be stored in one location. Furthermore, TomP2P also provides to store keys in different domains to avoid key collisions.

Author:
Thomas Bocek

Constructor Summary
Peer(int p2pID, KeyPair keyPair)
           
Peer(int p2pID, Number160 nodeId)
           
Peer(int p2pID, Number160 nodeId, ConnectionConfiguration connectionConfiguration)
           
Peer(int p2pID, Number160 nodeId, KeyPair keyPair)
           
Peer(int p2pID, Number160 nodeId, P2PConfiguration peerConfiguration, ConnectionConfiguration connectionConfiguration, KeyPair keyPair)
           
Peer(KeyPair keyPair)
           
Peer(Number160 nodeId)
           
Peer(Number160 nodeId, KeyPair keyPair)
           
 
Method Summary
 FutureDHT add(Number160 locationKey, Collection<Data> dataCollection, ConfigurationStore config)
           
 FutureDHT add(Number160 locationKey, Data data)
           
 FutureDHT add(Number160 locationKey, Data data, ConfigurationStore config)
           
 ScheduledFuture<?> addIndirectReplicaiton(Runnable runnable)
           
 ScheduledFuture<?> addMaintainance(Runnable runnable)
           
 void addPeerListener(PeerListener listener)
           
 FutureTracker addToTracker(Number160 locationKey, ConfigurationTrackerStore config)
           
 FutureBootstrap bootstrap(Collection<PeerAddress> peerAddresses)
           
 FutureBootstrap bootstrap(Collection<PeerAddress> peerAddresses, ConfigurationStore config)
           
 FutureBootstrap bootstrap(InetSocketAddress address)
           
 FutureBootstrap bootstrap(PeerAddress peerAddress)
           
 FutureBootstrap bootstrapBroadcast()
           
 void customLoggerMessage(String customMessage)
           
 FutureDiscover discover(PeerAddress peerAddress)
           
 FutureDHT get(Number160 locationKey)
           
 FutureDHT get(Number160 locationKey, ConfigurationGet config)
           
 FutureDHT get(Number160 locationKey, Set<Number160> keyCollection, ConfigurationGet config)
           
 FutureDHT getAll(Number160 locationKey)
           
 FutureDHT getAll(Number160 locationKey, ConfigurationGet config)
           
 ConnectionBean getConnectionBean()
           
 ConnectionConfiguration getConnectionConfiguration()
           
 ConnectionHandler getConnectionHandler()
           
 DistributedHashHashMap getDHT()
           
 DirectDataRPC getDirectDataRPC()
           
 FutureTracker getFromTracker(Number160 locationKey, ConfigurationTrackerGet config)
           
 HandshakeRPC getHandshakeRPC()
           
 P2PConfiguration getP2PConfiguration()
           
 int getP2PID()
           
 PeerAddress getPeerAddress()
           
 PeerBean getPeerBean()
           
 Number160 getPeerID()
           
 Map<BaseFuture,Long> getPendingFutures()
           
 QuitRPC getQuitRPC()
           
 Routing getRouting()
           
 StorageRPC getStoreRPC()
           
 DistributedTracker getTracker()
           
 TrackerRPC getTrackerRPC()
           
protected  void init(ConnectionHandler connectionHandler, Statistics statistics)
           
 boolean isListening()
           
 boolean isRunning()
           
 void listen()
           
 void listen(File messageLogger)
           
 void listen(int udpPort, int tcpPort)
           
 void listen(int udpPort, int tcpPort, Bindings bindings)
           
 void listen(int udpPort, int tcpPort, Bindings bindings, File messageLogger)
          Lets this node listen on a port
 void listen(int udpPort, int tcpPort, File messageLogger)
           
 void listen(int udpPort, int tcpPort, InetAddress bind)
           
 void listen(Peer master)
           
 FutureResponse ping(InetSocketAddress address)
           
 FutureDHT put(Number160 locationKey, Data data)
           
 FutureDHT put(Number160 locationKey, Data data, ConfigurationStore config)
           
 FutureDHT put(Number160 locationKey, Map<Number160,Data> dataMap, ConfigurationStore config)
           
 FutureDHT remove(Number160 locationKey)
           
 FutureDHT remove(Number160 locationKey, ConfigurationRemove config)
           
 FutureDHT remove(Number160 locationKey, Set<Number160> keyCollection, ConfigurationRemove config)
           
 FutureDHT removeAll(Number160 locationKey)
           
 FutureDHT removeAll(Number160 locationKey, ConfigurationRemove config)
           
 void removePeerListener()
           
 FutureDHT send(Number160 locationKey, org.jboss.netty.buffer.ChannelBuffer buffer)
           
 FutureDHT send(Number160 locationKey, org.jboss.netty.buffer.ChannelBuffer buffer, ConfigurationDirect config)
           
 FutureDHT send(Number160 locationKey, Object object)
           
 FutureDHT send(Number160 locationKey, Object object, ConfigurationDirect config)
           
 FutureData send(PeerAddress remotePeer, org.jboss.netty.buffer.ChannelBuffer requestBuffer)
           
 FutureData send(PeerAddress remotePeer, Object object)
           
 FutureData send(String channelName, PeerAddress remotePeer, org.jboss.netty.buffer.ChannelBuffer requestBuffer)
           
 FutureData send(String channelName, PeerAddress remotePeer, Object object)
           
 void setDefaultStorageReplication()
           
 void setDefaultTrackerReplication()
           
 void setObjectDataReply(ObjectDataReply objectDataReply)
           
 void setPeerMap(PeerMap peerMap)
           
 void setRawDataReply(RawDataReply rawDataReply)
           
 void shutdown()
          Closes all connections of this node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Peer

public Peer(KeyPair keyPair)

Peer

public Peer(Number160 nodeId)

Peer

public Peer(Number160 nodeId,
            KeyPair keyPair)

Peer

public Peer(int p2pID,
            KeyPair keyPair)

Peer

public Peer(int p2pID,
            Number160 nodeId)

Peer

public Peer(int p2pID,
            Number160 nodeId,
            KeyPair keyPair)

Peer

public Peer(int p2pID,
            Number160 nodeId,
            ConnectionConfiguration connectionConfiguration)

Peer

public Peer(int p2pID,
            Number160 nodeId,
            P2PConfiguration peerConfiguration,
            ConnectionConfiguration connectionConfiguration,
            KeyPair keyPair)
Method Detail

addPeerListener

public void addPeerListener(PeerListener listener)

removePeerListener

public void removePeerListener()

shutdown

public void shutdown()
Closes all connections of this node

Throws:
InterruptedException

listen

public void listen()
            throws Exception
Throws:
Exception

listen

public void listen(File messageLogger)
            throws Exception
Throws:
Exception

listen

public void listen(int udpPort,
                   int tcpPort)
            throws Exception
Throws:
Exception

listen

public void listen(int udpPort,
                   int tcpPort,
                   File messageLogger)
            throws Exception
Throws:
Exception

listen

public void listen(int udpPort,
                   int tcpPort,
                   InetAddress bind)
            throws Exception
Throws:
Exception

listen

public void listen(int udpPort,
                   int tcpPort,
                   Bindings bindings)
            throws Exception
Throws:
Exception

listen

public void listen(int udpPort,
                   int tcpPort,
                   Bindings bindings,
                   File messageLogger)
            throws Exception
Lets this node listen on a port

Parameters:
udpPort - the UDP port to listen on
tcpPort - the TCP port to listen on
bindInformation - contains IP addresses to listen on
replication -
statServer -
Throws:
Exception

listen

public void listen(Peer master)
            throws Exception
Throws:
Exception

init

protected void init(ConnectionHandler connectionHandler,
                    Statistics statistics)

setDefaultStorageReplication

public void setDefaultStorageReplication()

setDefaultTrackerReplication

public void setDefaultTrackerReplication()

getPendingFutures

public Map<BaseFuture,Long> getPendingFutures()

isRunning

public boolean isRunning()

isListening

public boolean isListening()

customLoggerMessage

public void customLoggerMessage(String customMessage)

getHandshakeRPC

public HandshakeRPC getHandshakeRPC()

getStoreRPC

public StorageRPC getStoreRPC()

getQuitRPC

public QuitRPC getQuitRPC()

getDirectDataRPC

public DirectDataRPC getDirectDataRPC()

getTrackerRPC

public TrackerRPC getTrackerRPC()

getRouting

public Routing getRouting()

addIndirectReplicaiton

public ScheduledFuture<?> addIndirectReplicaiton(Runnable runnable)

addMaintainance

public ScheduledFuture<?> addMaintainance(Runnable runnable)

getConnectionHandler

public ConnectionHandler getConnectionHandler()

getDHT

public DistributedHashHashMap getDHT()

getTracker

public DistributedTracker getTracker()

getPeerBean

public PeerBean getPeerBean()

getConnectionBean

public ConnectionBean getConnectionBean()

getPeerID

public Number160 getPeerID()

getPeerAddress

public PeerAddress getPeerAddress()

setPeerMap

public void setPeerMap(PeerMap peerMap)

getP2PID

public int getP2PID()

setRawDataReply

public void setRawDataReply(RawDataReply rawDataReply)

setObjectDataReply

public void setObjectDataReply(ObjectDataReply objectDataReply)

send

public FutureData send(PeerAddress remotePeer,
                       org.jboss.netty.buffer.ChannelBuffer requestBuffer)

send

public FutureData send(String channelName,
                       PeerAddress remotePeer,
                       org.jboss.netty.buffer.ChannelBuffer requestBuffer)

send

public FutureData send(PeerAddress remotePeer,
                       Object object)
                throws IOException
Throws:
IOException

send

public FutureData send(String channelName,
                       PeerAddress remotePeer,
                       Object object)
                throws IOException
Throws:
IOException

bootstrapBroadcast

public FutureBootstrap bootstrapBroadcast()

ping

public FutureResponse ping(InetSocketAddress address)

bootstrap

public FutureBootstrap bootstrap(InetSocketAddress address)

bootstrap

public FutureBootstrap bootstrap(Collection<PeerAddress> peerAddresses)

bootstrap

public FutureBootstrap bootstrap(Collection<PeerAddress> peerAddresses,
                                 ConfigurationStore config)

bootstrap

public FutureBootstrap bootstrap(PeerAddress peerAddress)

discover

public FutureDiscover discover(PeerAddress peerAddress)

put

public FutureDHT put(Number160 locationKey,
                     Data data)

put

public FutureDHT put(Number160 locationKey,
                     Data data,
                     ConfigurationStore config)

put

public FutureDHT put(Number160 locationKey,
                     Map<Number160,Data> dataMap,
                     ConfigurationStore config)

add

public FutureDHT add(Number160 locationKey,
                     Data data)

add

public FutureDHT add(Number160 locationKey,
                     Data data,
                     ConfigurationStore config)

add

public FutureDHT add(Number160 locationKey,
                     Collection<Data> dataCollection,
                     ConfigurationStore config)

getAll

public FutureDHT getAll(Number160 locationKey)

getAll

public FutureDHT getAll(Number160 locationKey,
                        ConfigurationGet config)

get

public FutureDHT get(Number160 locationKey)

get

public FutureDHT get(Number160 locationKey,
                     ConfigurationGet config)

get

public FutureDHT get(Number160 locationKey,
                     Set<Number160> keyCollection,
                     ConfigurationGet config)

removeAll

public FutureDHT removeAll(Number160 locationKey)

removeAll

public FutureDHT removeAll(Number160 locationKey,
                           ConfigurationRemove config)

remove

public FutureDHT remove(Number160 locationKey)

remove

public FutureDHT remove(Number160 locationKey,
                        ConfigurationRemove config)

remove

public FutureDHT remove(Number160 locationKey,
                        Set<Number160> keyCollection,
                        ConfigurationRemove config)

send

public FutureDHT send(Number160 locationKey,
                      org.jboss.netty.buffer.ChannelBuffer buffer)

send

public FutureDHT send(Number160 locationKey,
                      org.jboss.netty.buffer.ChannelBuffer buffer,
                      ConfigurationDirect config)

send

public FutureDHT send(Number160 locationKey,
                      Object object)
               throws IOException
Throws:
IOException

send

public FutureDHT send(Number160 locationKey,
                      Object object,
                      ConfigurationDirect config)
               throws IOException
Throws:
IOException

getFromTracker

public FutureTracker getFromTracker(Number160 locationKey,
                                    ConfigurationTrackerGet config)

addToTracker

public FutureTracker addToTracker(Number160 locationKey,
                                  ConfigurationTrackerStore config)

getConnectionConfiguration

public ConnectionConfiguration getConnectionConfiguration()

getP2PConfiguration

public P2PConfiguration getP2PConfiguration()


Copyright © 2011. All Rights Reserved.