public class Peer extends Object
put(Number160),
get(Number160), add(Number160), addTracker(Number160), getTracker(Number160),
remove(Number160), #submit(Number160, Worker), send(Number160), #sendDirect(),
broadcast(Number160). Each of those operations return a builder that offers more options. One of the main
difference to a "regular" DHT is that TomP2P can store a map (key-values) instead of just values. To distinguish
those, the keys are termed location key (for finding the right peer in the network), and content key (to store more
than one value on a peer). For the put builder e.g. the following options can be set:
PutBuilder.setData(Number160, net.tomp2p.storage.Data) - puts a content key with a valuepublic PingRPC getHandshakeRPC()
public void setHandshakeRPC(PingRPC handshakeRPC)
public StorageRPC getStoreRPC()
public void setStorageRPC(StorageRPC storageRPC)
public NeighborRPC getNeighborRPC()
public void setNeighborRPC(NeighborRPC neighborRPC)
public QuitRPC getQuitRPC()
public void setQuitRPC(QuitRPC quitRCP)
public PeerExchangeRPC getPeerExchangeRPC()
public void setPeerExchangeRPC(PeerExchangeRPC peerExchangeRPC)
public DirectDataRPC getDirectDataRPC()
public void setDirectDataRPC(DirectDataRPC directDataRPC)
public TrackerRPC getTrackerRPC()
public void setTrackerRPC(TrackerRPC trackerRPC)
public void setBroadcastRPC(BroadcastRPC broadcastRPC)
public BroadcastRPC getBroadcastRPC()
public DistributedRouting getDistributedRouting()
public void setDistributedRouting(DistributedRouting distributedRouting)
public DistributedHashTable getDistributedHashMap()
public void setDistributedHashMap(DistributedHashTable distributedHashMap)
public DistributedTracker getDistributedTracker()
public void setDistributedTracker(DistributedTracker distributedTracker)
public PeerBean getPeerBean()
public ConnectionBean getConnectionBean()
public Number160 getPeerID()
public int getP2PID()
public PeerAddress getPeerAddress()
public Peer notifyAutomaticFutures(BaseFuture future)
public void setRawDataReply(RawDataReply rawDataReply)
public void setObjectDataReply(ObjectDataReply objectDataReply)
public FuturePeerConnection createPeerConnection(PeerAddress destination)
public FuturePeerConnection createPeerConnection(PeerAddress destination, int heartBeatMillis)
destination - The end-point to connect toidleTCPMillis - time in milliseconds after a connection gets closed if idle, -1 if it should remain always open until
the user closes the connection manually.public AddBuilder add(Number160 locationKey)
public PutBuilder put(Number160 locationKey)
public GetBuilder get(Number160 locationKey)
public DigestBuilder digest(Number160 locationKey)
public RemoveBuilder remove(Number160 locationKey)
public SendBuilder send(Number160 locationKey)
1. routing: find close peers to the content hash.
You can control the routing behavior with
setRoutingConfiguration()
2. sending: send the data to the n closest peers.
N is set via setRequestP2PConfiguration().
If you want to send it to the closest one, use
setRequestP2PConfiguration(1, 5, 0)
locationKey - The target hash to search for during the routing processpublic SendDirectBuilder sendDirect(PeerAddress recipientAddress)
public SendDirectBuilder sendDirect(FuturePeerConnection recipientConnection)
public SendDirectBuilder sendDirect(PeerConnection peerConnection)
public BootstrapBuilder bootstrap()
public PingBuilder ping()
public DiscoverBuilder discover()
public AddTrackerBuilder addTracker(Number160 locationKey)
public GetTrackerBuilder getTracker(Number160 locationKey)
public ParallelRequestBuilder<?> parallelRequest(Number160 locationKey)
public BroadcastBuilder broadcast(Number160 messageKey)
public ShutdownBuilder announceShutdown()
public BaseFuture shutdown()
public boolean isShutdown()
public void addShutdownListener(Shutdown shutdown)
public void removeShutdownListener(Shutdown shutdown)
Copyright © 2014. All rights reserved.