net.tomp2p.storage
Class StorageGeneric

java.lang.Object
  extended by net.tomp2p.storage.StorageGeneric
All Implemented Interfaces:
Digest, ReplicationStorage, Storage
Direct Known Subclasses:
StorageDisk, StorageMemory

public abstract class StorageGeneric
extends Object
implements Storage


Nested Class Summary
static class StorageGeneric.ProtectionEnable
           
static class StorageGeneric.ProtectionMode
           
static class StorageGeneric.PutStatus
           
 
Constructor Summary
StorageGeneric()
           
 
Method Summary
 void checkTimeout()
           
 Collection<Number160> compareAndPut(Number160 locationKey, Number160 domainKey, Map<Number160,HashData> hashDataMap, PublicKey publicKey, boolean partial, boolean protectDomain)
          Compares and puts the data if the compare matches
 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> keyBloomFilter, SimpleBloomFilter<Number160> contentBloomFilter)
          Calculates a digest over a specific location and domain.
 SortedMap<Number480,Data> get(Number160 locationKey, Number160 domainKey, Number160 fromContentKey, Number160 toContentKey)
           
 KeyLock<Number160> getLockNumber160()
           
 KeyLock<Number320> getLockNumber320()
           
 KeyLock<Number480> getLockNumber480()
           
 KeyLock<Storage> getLockStorage()
           
 StorageGeneric.ProtectionEnable getProtectionDomainEnable()
           
 StorageGeneric.ProtectionMode getProtectionDomainMode()
           
 StorageGeneric.ProtectionEnable getProtectionEntryEnable()
           
 StorageGeneric.ProtectionMode getProtectionEntryMode()
           
 StorageGeneric.PutStatus put(Number160 locationKey, Number160 domainKey, Number160 contentKey, Data newData, PublicKey publicKey, boolean putIfAbsent, boolean domainProtection)
           
 SortedMap<Number480,Data> remove(Number160 locationKey, Number160 domainKey, Number160 fromContentKey, Number160 toContentKey, PublicKey publicKey)
           
 Data remove(Number160 locationKey, Number160 domainKey, Number160 contentKey, PublicKey publicKey)
           
 void removeDomainProtection(Number160 removeDomain)
           
 void setProtection(StorageGeneric.ProtectionEnable protectionDomainEnable, StorageGeneric.ProtectionMode protectionDomainMode, StorageGeneric.ProtectionEnable protectionEntryEnable, StorageGeneric.ProtectionMode protectionEntryMode)
           
 void setProtectionDomainEnable(StorageGeneric.ProtectionEnable protectionDomainEnable)
           
 void setProtectionDomainMode(StorageGeneric.ProtectionMode protectionDomainMode)
           
 void setProtectionEntryEnable(StorageGeneric.ProtectionEnable protectionEntryEnable)
           
 void setProtectionEntryMode(StorageGeneric.ProtectionMode protectionEntryMode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.tomp2p.storage.Storage
addTimeout, close, contains, get, isDomainProtectedByOthers, map, protectDomain, put, remove, removeTimeout, subMap, subMap, subMapTimeout
 
Methods inherited from interface net.tomp2p.storage.ReplicationStorage
findContentForResponsiblePeerID, findPeerIDForResponsibleContent, removeResponsibility, updateResponsibilities
 

Constructor Detail

StorageGeneric

public StorageGeneric()
Method Detail

setProtection

public void setProtection(StorageGeneric.ProtectionEnable protectionDomainEnable,
                          StorageGeneric.ProtectionMode protectionDomainMode,
                          StorageGeneric.ProtectionEnable protectionEntryEnable,
                          StorageGeneric.ProtectionMode protectionEntryMode)

setProtectionDomainMode

public void setProtectionDomainMode(StorageGeneric.ProtectionMode protectionDomainMode)

getProtectionDomainMode

public StorageGeneric.ProtectionMode getProtectionDomainMode()

setProtectionDomainEnable

public void setProtectionDomainEnable(StorageGeneric.ProtectionEnable protectionDomainEnable)

getProtectionDomainEnable

public StorageGeneric.ProtectionEnable getProtectionDomainEnable()

setProtectionEntryMode

public void setProtectionEntryMode(StorageGeneric.ProtectionMode protectionEntryMode)

getProtectionEntryMode

public StorageGeneric.ProtectionMode getProtectionEntryMode()

setProtectionEntryEnable

public void setProtectionEntryEnable(StorageGeneric.ProtectionEnable protectionEntryEnable)

getProtectionEntryEnable

public StorageGeneric.ProtectionEnable getProtectionEntryEnable()

removeDomainProtection

public void removeDomainProtection(Number160 removeDomain)

compareAndPut

public Collection<Number160> compareAndPut(Number160 locationKey,
                                           Number160 domainKey,
                                           Map<Number160,HashData> hashDataMap,
                                           PublicKey publicKey,
                                           boolean partial,
                                           boolean protectDomain)
Compares and puts the data if the compare matches

Parameters:
locationKey - The location key
domainKey - The domain key
hashDataMap - The map with the data and the hashes to compare to
publicKey - The public key
partial - If set to true, then partial puts are OK, otherwise all the data needs to be absent.
protectDomain - Flag to protect domain
Returns:
The keys that have been stored

put

public StorageGeneric.PutStatus put(Number160 locationKey,
                                    Number160 domainKey,
                                    Number160 contentKey,
                                    Data newData,
                                    PublicKey publicKey,
                                    boolean putIfAbsent,
                                    boolean domainProtection)

remove

public Data remove(Number160 locationKey,
                   Number160 domainKey,
                   Number160 contentKey,
                   PublicKey publicKey)

remove

public SortedMap<Number480,Data> remove(Number160 locationKey,
                                        Number160 domainKey,
                                        Number160 fromContentKey,
                                        Number160 toContentKey,
                                        PublicKey publicKey)

get

public SortedMap<Number480,Data> get(Number160 locationKey,
                                     Number160 domainKey,
                                     Number160 fromContentKey,
                                     Number160 toContentKey)

checkTimeout

public void checkTimeout()

digest

public DigestInfo digest(Number160 locationKey,
                         Number160 domainKey,
                         SimpleBloomFilter<Number160> keyBloomFilter,
                         SimpleBloomFilter<Number160> contentBloomFilter)
Description copied from interface: Digest
Calculates a digest over a specific location and domain. It will return those content keys that match the Bloom filter. Those keys that are not stored are ignored

Specified by:
digest in interface Digest
Parameters:
locationKey - The location key
domainKey - The domain key
keyBloomFilter - 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.
contentBloomFilter - 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.
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(Number160 locationKey,
                         Number160 domainKey,
                         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:
locationKey - The location key
domainKey - The domain key
contentKeys - 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
Returns:
A list of all hashes for the content keys. To return a predictable amount (important for routing), the hashes can be xored.

getLockStorage

public KeyLock<Storage> getLockStorage()

getLockNumber160

public KeyLock<Number160> getLockNumber160()

getLockNumber320

public KeyLock<Number320> getLockNumber320()

getLockNumber480

public KeyLock<Number480> getLockNumber480()


Copyright © 2013. All Rights Reserved.