org.sdnplatform.sync.internal.store
Interface IStorageEngine<K,V>

Type Parameters:
K - The type of the key being stored
V - The type of the value being stored
T - The type of the transforms
All Superinterfaces:
IStore<K,V>
All Known Implementing Classes:
InMemoryStorageEngine, JavaDBStorageEngine, ListenerStorageEngine, SynchronizingStorageEngine

public interface IStorageEngine<K,V>
extends IStore<K,V>

A base storage class which is actually responsible for data persistence. This interface implies all the usual responsibilities of a Store implementation, and in addition

  1. The implementation MUST throw an ObsoleteVersionException if the user attempts to put a version which is strictly before an existing version (concurrent is okay)
  2. The implementation MUST increment this version number when the value is stored.
  3. The implementation MUST contain an ID identifying it as part of the cluster
A hash value can be produced for known subtrees of a StorageEngine


Method Summary
 void cleanupTask()
          Perform any periodic cleanup tasks that might need to be performed.
 IClosableIterator<java.util.Map.Entry<K,java.util.List<Versioned<V>>>> entries()
          Get an iterator over pairs of entries in the store.
 boolean isPersistent()
          Returns true if the underlying data store is persistent
 IClosableIterator<K> keys()
          Get an iterator over keys in the store.
 void setTombstoneInterval(int interval)
          Set the interval after which tombstones will be cleaned up.
 void truncate()
          Truncate all entries in the store.
 boolean writeSyncValue(K key, java.lang.Iterable<Versioned<V>> values)
          Write the given versioned values into the given key.
 
Methods inherited from interface org.sdnplatform.sync.internal.store.IStore
close, get, getName, getVersions, put
 

Method Detail

entries

IClosableIterator<java.util.Map.Entry<K,java.util.List<Versioned<V>>>> entries()
Get an iterator over pairs of entries in the store. The key is the first element in the pair and the versioned value is the second element. Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Specified by:
entries in interface IStore<K,V>
Returns:
An iterator over the entries in this StorageEngine.

keys

IClosableIterator<K> keys()
Get an iterator over keys in the store. Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Returns:
An iterator over the keys in this StorageEngine.

truncate

void truncate()
              throws SyncException
Truncate all entries in the store. Note that this is a purely local operation and all the data will sync back over of it's connected

Throws:
SyncException

writeSyncValue

boolean writeSyncValue(K key,
                       java.lang.Iterable<Versioned<V>> values)
Write the given versioned values into the given key.

Parameters:
key - the key
values - the list of versions for that key
Returns:
true if any of the values were new and not obsolete
Throws:
SyncException

cleanupTask

void cleanupTask()
                 throws SyncException
Perform any periodic cleanup tasks that might need to be performed. This method will be called periodically by the sync manager

Throws:
SyncException

isPersistent

boolean isPersistent()
Returns true if the underlying data store is persistent

Returns:
whether the store is persistent

setTombstoneInterval

void setTombstoneInterval(int interval)
Set the interval after which tombstones will be cleaned up. This imposes an upper bound on the amount of time that two partitions can be separate before reaching consistency for any given key.

Parameters:
interval - the interval in milliseconds