|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.tomp2p.storage.TrackerStorage
public class TrackerStorage
The maintenance for the tracker is done by the client peer. Thus the peers on a tracker expire, but a client can send a Bloom filter with peers, that he knows are offline. TrackerStorage stores the data in memory only. TODO: check availability of secondary peers and periodically check if peers from the mesh are still online, right now we rely on the PeerMap mechanism
Nested Class Summary | |
---|---|
static class |
TrackerStorage.ReferrerType
|
Nested classes/interfaces inherited from interface net.tomp2p.peers.PeerStatusListener |
---|
PeerStatusListener.Reason |
Field Summary | |
---|---|
static int |
TRACKER_CACHE_SIZE
|
static int |
TRACKER_SIZE
|
Constructor Summary | |
---|---|
TrackerStorage(IdentityManagement identityManagement,
int trackerTimoutSeconds,
PeerBean peerBean,
Maintenance maintenance)
|
Method Summary | |
---|---|
Map<Number160,TrackerData> |
activePeers(Number160 locationKey,
Number160 domainKey)
|
void |
addActive(Number160 locationKey,
Number160 domainKey,
PeerAddress remotePeer,
byte[] attachement,
int offset,
int length)
|
DigestInfo |
digest(Number160 locationKey,
Number160 domainKey,
Collection<Number160> contentKeys)
Calculates a digest over a specific location and domain. |
DigestInfo |
digest(Number160 locationKey,
Number160 domainKey,
SimpleBloomFilter<Number160> bloomFilter1,
SimpleBloomFilter<Number160> bloomFilter2)
Calculates a digest over a specific location and domain. |
Collection<Number160> |
findContentForResponsiblePeerID(Number160 peerID)
|
Number160 |
findPeerIDForResponsibleContent(Number160 locationKey)
|
int |
getPrimanyFactor()
|
int |
getSecondaryFactor()
|
int |
getTrackerTimoutSeconds()
|
boolean |
isFillPrimaryStorageFast()
|
boolean |
isSecondaryTracker(Number160 locationKey,
Number160 domainKey)
A peer is a secondary tracker if the peers stores itself on the tracker as well. |
Map<Number160,TrackerData> |
meshPeers(Number160 locationKey,
Number160 domainKey)
|
boolean |
moveFromSecondaryToMesh(PeerAddress peerAddress,
PeerAddress referrer,
Number160 locationKey,
Number160 domainKey,
PublicKey publicKey)
|
void |
peerFail(PeerAddress peerAddress,
boolean force)
Called if the peer does not send answer in time. |
void |
peerOffline(PeerAddress peerAddress,
PeerStatusListener.Reason reason)
Called if the peer does not send multiple answer in time. |
void |
peerOnline(PeerAddress peerAddress)
Called if the peer is online and we verified it. |
boolean |
put(Number160 locationKey,
Number160 domainKey,
PeerAddress peerAddress,
PublicKey publicKey,
byte[] attachement)
|
boolean |
put(Number160 locationKey,
Number160 domainKey,
PeerAddress peerAddress,
PublicKey publicKey,
byte[] attachement,
int offset,
int length)
|
boolean |
putReferred(Number160 locationKey,
Number160 domainKey,
PeerAddress peerAddress,
PeerAddress referrer,
byte[] attachement,
int offset,
int length,
TrackerStorage.ReferrerType type)
|
boolean |
removeActive(Number160 locationKey,
Number160 domainKey,
Number160 remotePeerId)
|
void |
removeReferred(Number160 locationKey,
Number160 domainKey,
Number160 key,
PeerAddress referrer)
|
void |
removeResponsibility(Number160 locationKey)
|
Collection<Number160> |
responsibleDomains(Number160 locationKey)
|
Map<Number160,TrackerData> |
secondaryPeers(Number160 locationKey,
Number160 domainKey)
|
void |
setFillPrimaryStorageFast(boolean fillPrimaryStorageFast)
|
void |
setPrimanyFactor(int primanyFactor)
|
void |
setSecondaryFactor(int secondaryFactor)
|
int |
sizePrimary(Number160 locationKey,
Number160 domainKey)
|
int |
sizeSecondary(Number160 locationKey,
Number160 domainKey)
|
boolean |
updateResponsibilities(Number160 locationKey,
Number160 peerId)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TRACKER_SIZE
public static final int TRACKER_CACHE_SIZE
Constructor Detail |
---|
public TrackerStorage(IdentityManagement identityManagement, int trackerTimoutSeconds, PeerBean peerBean, Maintenance maintenance)
Method Detail |
---|
public Map<Number160,TrackerData> activePeers(Number160 locationKey, Number160 domainKey)
public Map<Number160,TrackerData> meshPeers(Number160 locationKey, Number160 domainKey)
public Map<Number160,TrackerData> secondaryPeers(Number160 locationKey, Number160 domainKey)
public void addActive(Number160 locationKey, Number160 domainKey, PeerAddress remotePeer, byte[] attachement, int offset, int length)
public boolean removeActive(Number160 locationKey, Number160 domainKey, Number160 remotePeerId)
public boolean put(Number160 locationKey, Number160 domainKey, PeerAddress peerAddress, PublicKey publicKey, byte[] attachement)
public boolean put(Number160 locationKey, Number160 domainKey, PeerAddress peerAddress, PublicKey publicKey, byte[] attachement, int offset, int length)
public boolean putReferred(Number160 locationKey, Number160 domainKey, PeerAddress peerAddress, PeerAddress referrer, byte[] attachement, int offset, int length, TrackerStorage.ReferrerType type)
public boolean moveFromSecondaryToMesh(PeerAddress peerAddress, PeerAddress referrer, Number160 locationKey, Number160 domainKey, PublicKey publicKey)
public int sizePrimary(Number160 locationKey, Number160 domainKey)
public int sizeSecondary(Number160 locationKey, Number160 domainKey)
public void setSecondaryFactor(int secondaryFactor)
public int getSecondaryFactor()
public void setPrimanyFactor(int primanyFactor)
public int getPrimanyFactor()
public void peerOffline(PeerAddress peerAddress, PeerStatusListener.Reason reason)
PeerStatusListener
peerOffline
in interface PeerStatusListener
peerAddress
- The address of the peer that went offlinepublic void peerFail(PeerAddress peerAddress, boolean force)
PeerStatusListener
peerFail
in interface PeerStatusListener
peerAddress
- The address of the peer that failedforce
- Set to true if we are sure that the peer died.public void peerOnline(PeerAddress peerAddress)
PeerStatusListener
peerOnline
in interface PeerStatusListener
peerAddress
- The address of the peer that is online.public DigestInfo digest(Number160 locationKey, Number160 domainKey, SimpleBloomFilter<Number160> bloomFilter1, SimpleBloomFilter<Number160> bloomFilter2)
Digest
digest
in interface Digest
locationKey
- The location keydomainKey
- The domain keybloomFilter1
- The bloomFilter of those key elements we want the digest. Please not that there might be
false positive, e.g., a Number160 that is included in the digest but not stored on disk/memory.bloomFilter2
- The bloomFilter of those data elements we want the digest. Please not that there might
be false positive, e.g., a Number160 that is included in the digest but not stored on disk/memory.
public DigestInfo digest(Number160 locationKey, Number160 domainKey, Collection<Number160> contentKeys)
Digest
digest
in interface Digest
locationKey
- The location keydomainKey
- The domain keycontentKeys
- The content keys to look for. Those keys that are not found are ignored. Can be set to null ->
gets the information for all content keys
public void removeReferred(Number160 locationKey, Number160 domainKey, Number160 key, PeerAddress referrer)
public void setFillPrimaryStorageFast(boolean fillPrimaryStorageFast)
public boolean isFillPrimaryStorageFast()
public int getTrackerTimoutSeconds()
public boolean isSecondaryTracker(Number160 locationKey, Number160 domainKey)
locationKey
- domainKey
-
public Collection<Number160> responsibleDomains(Number160 locationKey)
public Number160 findPeerIDForResponsibleContent(Number160 locationKey)
findPeerIDForResponsibleContent
in interface ReplicationStorage
public Collection<Number160> findContentForResponsiblePeerID(Number160 peerID)
findContentForResponsiblePeerID
in interface ReplicationStorage
public boolean updateResponsibilities(Number160 locationKey, Number160 peerId)
updateResponsibilities
in interface ReplicationStorage
public void removeResponsibility(Number160 locationKey)
removeResponsibility
in interface ReplicationStorage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |