|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
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_SIZE
|
Constructor Summary | |
---|---|
TrackerStorage(IdentityManagement identityManagement,
int trackerTimoutSeconds,
Replication replication,
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(Number320 key)
Calculates a digest over a specific location and domain. |
DigestInfo |
digest(Number320 key,
Collection<Number160> contentKeys)
Calculates a digest over a specific location and domain. |
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)
|
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)
|
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
Constructor Detail |
---|
public TrackerStorage(IdentityManagement identityManagement, int trackerTimoutSeconds, Replication replication, 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(Number320 key)
Digest
digest
in interface Digest
key
- The location and domain key
public DigestInfo digest(Number320 key, Collection<Number160> contentKeys)
Digest
digest
in interface Digest
key
- The location and domain keycontentKeys
- The content keys to look for. Those keys that are not
found are ignored.
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |