org.terracotta.toolkit.store
Interface ToolkitStore<K,V>

All Superinterfaces:
ConcurrentMap<K,V>, Destroyable, Map<K,V>, SearchableMap<K,V>, ToolkitBulkLoadObject, ToolkitObject

public interface ToolkitStore<K,V>
extends ConcurrentMap<K,V>, Destroyable, SearchableMap<K,V>, ToolkitBulkLoadObject

A Key-Value store used for storing key-value mappings. No eviction can happen on a Store. A key-value store can be configured using various configs available in ToolkitConfigFields. Consult Toolkit.getStore(String, Configuration, Class) for more info on various configs.

Consult the Toolkit class level docs for more info on behavior regarding destroy.

Trying to add values that are not serializable will throw NotSerializableRuntimeException.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 boolean containsValue(Object value)
          Check if the value is contained in the store.
 ToolkitReadWriteLock createLockForKey(K key)
          Creates a ToolkitReadWriteLock for the given key.
 Map<K,V> getAll(Collection<? extends K> keys)
          Perform get for the given set of keys.
 Configuration getConfiguration()
          Returns the configuration of this key-value store.
 void putNoReturn(K key, V value)
          Behaves the same as the standard Map.put(Object, Object) method except that the previous value is not returned.
 void removeNoReturn(Object key)
          Behaves the same as the standard Map.remove(Object) method except that the previous value is not returned.
 void setConfigField(String name, Serializable value)
          Updates the configuration of the Store using passed in value.
 
Methods inherited from interface java.util.concurrent.ConcurrentMap
putIfAbsent, remove, replace, replace
 
Methods inherited from interface java.util.Map
clear, containsKey, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from interface org.terracotta.toolkit.object.Destroyable
destroy, isDestroyed
 
Methods inherited from interface org.terracotta.toolkit.search.SearchableMap
createQueryBuilder, setAttributeExtractor
 
Methods inherited from interface org.terracotta.toolkit.bulkload.ToolkitBulkLoadObject
isBulkLoadEnabled, isNodeBulkLoadEnabled, setNodeBulkLoadEnabled, waitUntilBulkLoadComplete
 
Methods inherited from interface org.terracotta.toolkit.object.ToolkitObject
getName
 

Method Detail

containsValue

boolean containsValue(Object value)
Check if the value is contained in the store. Optional operation, some implementation may throw UnsupportedOperationException

Specified by:
containsValue in interface Map<K,V>
Returns:
Check if the value is contained in the store.

removeNoReturn

void removeNoReturn(Object key)
Behaves the same as the standard Map.remove(Object) method except that the previous value is not returned. This may provide significant performance improvements when the old value is not required.

Parameters:
key - the key of the entry to remove

putNoReturn

void putNoReturn(K key,
                 V value)
Behaves the same as the standard Map.put(Object, Object) method except that the previous value is not returned. This may provide significant performance improvements when old value is not required.

Parameters:
key - the key of the entry
value - the value of the entry

getAll

Map<K,V> getAll(Collection<? extends K> keys)
Perform get for the given set of keys. Keys which are not present in the Store will have null values associated with them in the returned map. The returned map is unmodifiable.

Parameters:
keys - the collection of keys to lookup
Returns:
a map of keys and the value mapped to the given key (but not necessarily the current mapping)

getConfiguration

Configuration getConfiguration()
Returns the configuration of this key-value store.

Returns:
the configuration of this key-value store

setConfigField

void setConfigField(String name,
                    Serializable value)
Updates the configuration of the Store using passed in value. Throws IllegalArgumentException if the config field name is not dynamic and cannot be changed at runtime


createLockForKey

ToolkitReadWriteLock createLockForKey(K key)
Creates a ToolkitReadWriteLock for the given key.

NOTE: ToolkitObject.getName() on the ToolkitReadWriteLock, ToolkitReadWriteLock.readLock() and ToolkitReadWriteLock.writeLock() will return null

Parameters:
key - the key for which a lock will be returned
Returns:
an instance of ToolkitReadWriteLock that can be used to perform primitive locking operations on the key


Copyright © 2014 Terracotta, Inc.. All Rights Reserved.