net.tomp2p.storage
Class StorageDisk

java.lang.Object
  extended by net.tomp2p.storage.Storage
      extended by net.tomp2p.storage.StorageDisk
All Implemented Interfaces:
Digest, Responsibility

public class StorageDisk
extends Storage
implements Responsibility


Nested Class Summary
 
Nested classes/interfaces inherited from class net.tomp2p.storage.Storage
Storage.ProtectionEnable, Storage.ProtectionMode
 
Constructor Summary
StorageDisk(String homeDirectory)
           
 
Method Summary
 void close()
           
 boolean contains(Number480 key)
           
 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.
 Collection<Number160> findContentForResponsiblePeerID(Number160 peerID)
           
 Number160 findPeerIDForResponsibleContent(Number160 locationKey)
           
 Data get(Number480 key)
           
 SortedMap<Number480,Data> get(Number480 fromKey, Number480 toKey)
           
 void iterateAndRun(Number160 locationKey, StorageRunner runner)
           
 boolean put(Number480 key, Data newData, PublicKey publicKey, boolean putIfAbsent, boolean domainProtection)
           
 SortedMap<Number480,Data> remove(Number480 fromKey, Number480 toKey, PublicKey publicKey)
           
 Data remove(Number480 key, PublicKey publicKey)
           
 void removeResponsibility(Number160 locationKey)
           
 Collection<Number480> storedDirectReplication()
           
 boolean updateResponsibilities(Number160 locationKey, Number160 peerID)
           
 
Methods inherited from class net.tomp2p.storage.Storage
acquire, acquire, acquire, acquire, acquire, compareAndPut, get, getProtectionDomainEnable, getProtectionDomainMode, getProtectionEntryEnable, getProtectionEntryMode, release, 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
 

Constructor Detail

StorageDisk

public StorageDisk(String homeDirectory)
            throws Exception
Throws:
Exception
Method Detail

close

public void close()
Specified by:
close in class Storage

put

public boolean put(Number480 key,
                   Data newData,
                   PublicKey publicKey,
                   boolean putIfAbsent,
                   boolean domainProtection)
Specified by:
put in class Storage

get

public Data get(Number480 key)
Specified by:
get in class Storage

get

public SortedMap<Number480,Data> get(Number480 fromKey,
                                     Number480 toKey)
Specified by:
get in class Storage

remove

public Data remove(Number480 key,
                   PublicKey publicKey)
Specified by:
remove in class Storage

remove

public SortedMap<Number480,Data> remove(Number480 fromKey,
                                        Number480 toKey,
                                        PublicKey publicKey)
Specified by:
remove in class Storage

contains

public boolean contains(Number480 key)
Specified by:
contains in class Storage

digest

public DigestInfo digest(Number320 key)
Description copied from interface: Digest
Calculates a digest over a specific location and domain. It will return those content keys that are stored.

Specified by:
digest in interface Digest
Parameters:
key - The location and domain key
Returns:
A list of all hashes for the content keys. To return a predictable amount (important for routing), the hashes can be xored.

digest

public DigestInfo digest(Number320 key,
                         Collection<Number160> contentKeys)
Description copied from interface: Digest
Calculates a digest over a specific location and domain. It will return those content keys that are stored. Those keys that are not stored are ignored

Specified by:
digest in interface Digest
Parameters:
key - The location and domain key
contentKeys - The content keys to look for. Those keys that are not found are ignored.
Returns:
A list of all hashes for the content keys. To return a predictable amount (important for routing), the hashes can be xored.

iterateAndRun

public void iterateAndRun(Number160 locationKey,
                          StorageRunner runner)
Specified by:
iterateAndRun in class Storage

findContentForResponsiblePeerID

public Collection<Number160> findContentForResponsiblePeerID(Number160 peerID)
Specified by:
findContentForResponsiblePeerID in interface Responsibility

findPeerIDForResponsibleContent

public Number160 findPeerIDForResponsibleContent(Number160 locationKey)
Specified by:
findPeerIDForResponsibleContent in interface Responsibility

updateResponsibilities

public boolean updateResponsibilities(Number160 locationKey,
                                      Number160 peerID)
Specified by:
updateResponsibilities in interface Responsibility

storedDirectReplication

public Collection<Number480> storedDirectReplication()
Specified by:
storedDirectReplication in class Storage

removeResponsibility

public void removeResponsibility(Number160 locationKey)
Specified by:
removeResponsibility in interface Responsibility


Copyright © 2012. All Rights Reserved.