net.tomp2p.storage
Class StorageMemory
java.lang.Object
net.tomp2p.storage.StorageGeneric
net.tomp2p.storage.StorageMemory
- All Implemented Interfaces:
- Digest, ReplicationStorage, Storage
public class StorageMemory
- extends StorageGeneric
Method Summary |
void |
addTimeout(Number160 locationKey,
Number160 domainKey,
Number160 contentKey,
long expiration)
|
void |
close()
|
boolean |
contains(Number160 locationKey,
Number160 domainKey,
Number160 contentKey)
|
Collection<Number160> |
findContentForResponsiblePeerID(Number160 peerID)
|
Number160 |
findPeerIDForResponsibleContent(Number160 locationKey)
|
Data |
get(Number160 locationKey,
Number160 domainKey,
Number160 contentKey)
|
boolean |
isDomainProtectedByOthers(Number160 locationKey,
Number160 domainKey,
PublicKey publicKey)
|
NavigableMap<Number480,Data> |
map()
The storage is typically backed by multiple Java collections (HashMap, TreeMap, etc.). |
boolean |
protectDomain(Number160 locationKey,
Number160 domainKey,
PublicKey publicKey)
|
boolean |
put(Number160 locationKey,
Number160 domainKey,
Number160 contentKey,
Data value)
|
Data |
remove(Number160 locationKey,
Number160 domainKey,
Number160 contentKey)
|
void |
removeResponsibility(Number160 locationKey)
|
void |
removeTimeout(Number160 locationKey,
Number160 domainKey,
Number160 contentKey)
|
Map<Number480,Data> |
subMap(Number160 locationKey)
|
SortedMap<Number480,Data> |
subMap(Number160 locationKey,
Number160 domainKey,
Number160 fromContentKey,
Number160 toContentKey)
|
Collection<Number480> |
subMapTimeout(long to)
|
boolean |
updateResponsibilities(Number160 locationKey,
Number160 peerId)
|
Methods inherited from class net.tomp2p.storage.StorageGeneric |
checkTimeout, compareAndPut, digest, digest, get, getLockNumber160, getLockNumber320, getLockNumber480, getLockStorage, getProtectionDomainEnable, getProtectionDomainMode, getProtectionEntryEnable, getProtectionEntryMode, put, remove, remove, removeDomainProtection, setProtection, setProtectionDomainEnable, setProtectionDomainMode, setProtectionEntryEnable, setProtectionEntryMode |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StorageMemory
public StorageMemory()
put
public boolean put(Number160 locationKey,
Number160 domainKey,
Number160 contentKey,
Data value)
get
public Data get(Number160 locationKey,
Number160 domainKey,
Number160 contentKey)
contains
public boolean contains(Number160 locationKey,
Number160 domainKey,
Number160 contentKey)
remove
public Data remove(Number160 locationKey,
Number160 domainKey,
Number160 contentKey)
subMap
public SortedMap<Number480,Data> subMap(Number160 locationKey,
Number160 domainKey,
Number160 fromContentKey,
Number160 toContentKey)
subMap
public Map<Number480,Data> subMap(Number160 locationKey)
map
public NavigableMap<Number480,Data> map()
- Description copied from interface:
Storage
- The storage is typically backed by multiple Java collections (HashMap, TreeMap, etc.). This map returns the map
that stores the values which are present in the DHT. If you plan to do transactions (put/get), make sure you do
the locking in order to not interfere with other threads that use this map. Although the storage is threadsafe,
there may be concurrency issues with respect to transactions (e.g., do a get before a put). Please use
StorageGeneric.getLockStorage()
for full locking, and StorageGeneric.getLockNumber160()
,
StorageGeneric.getLockNumber320()
, StorageGeneric.getLockNumber480()
for fine grained locking.
- Returns:
- The backing dataMap
addTimeout
public void addTimeout(Number160 locationKey,
Number160 domainKey,
Number160 contentKey,
long expiration)
removeTimeout
public void removeTimeout(Number160 locationKey,
Number160 domainKey,
Number160 contentKey)
subMapTimeout
public Collection<Number480> subMapTimeout(long to)
protectDomain
public boolean protectDomain(Number160 locationKey,
Number160 domainKey,
PublicKey publicKey)
isDomainProtectedByOthers
public boolean isDomainProtectedByOthers(Number160 locationKey,
Number160 domainKey,
PublicKey publicKey)
close
public void close()
findPeerIDForResponsibleContent
public Number160 findPeerIDForResponsibleContent(Number160 locationKey)
findContentForResponsiblePeerID
public Collection<Number160> findContentForResponsiblePeerID(Number160 peerID)
updateResponsibilities
public boolean updateResponsibilities(Number160 locationKey,
Number160 peerId)
removeResponsibility
public void removeResponsibility(Number160 locationKey)
Copyright © 2013. All Rights Reserved.