|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sdnplatform.sync.internal.store.JavaDBStorageEngine
public class JavaDBStorageEngine
Persistent storage engine that keeps its data in a JDB database
| Field Summary | |
|---|---|
protected static org.slf4j.Logger |
logger
|
| Constructor Summary | |
|---|---|
JavaDBStorageEngine(java.lang.String name,
javax.sql.ConnectionPoolDataSource dataSource)
Construct a new storage engine that will use the provided engine as a delegate and provide persistence for its data. |
|
| Method Summary | |
|---|---|
void |
cleanupTask()
Perform any periodic cleanup tasks that might need to be performed. |
void |
close()
Close the store. |
IClosableIterator<java.util.Map.Entry<ByteArray,java.util.List<Versioned<byte[]>>>> |
entries()
Get an iterator over pairs of entries in the store. |
java.util.List<Versioned<byte[]>> |
get(ByteArray key)
Get the value associated with the given key |
static javax.sql.ConnectionPoolDataSource |
getDataSource(java.lang.String dbPath,
boolean memory)
Get a connection pool data source for use by Java DB storage engines |
java.lang.String |
getName()
|
java.util.List<IVersion> |
getVersions(ByteArray key)
Get a list of the versions associated with the given key |
boolean |
isPersistent()
Returns true if the underlying data store is persistent |
IClosableIterator<ByteArray> |
keys()
Get an iterator over keys in the store. |
void |
put(ByteArray key,
Versioned<byte[]> value)
Associate the value with the key and version in this 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(ByteArray key,
java.lang.Iterable<Versioned<byte[]>> values)
Write the given versioned values into the given key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.slf4j.Logger logger
| Constructor Detail |
|---|
public JavaDBStorageEngine(java.lang.String name,
javax.sql.ConnectionPoolDataSource dataSource)
throws PersistException
delegate - the delegate engine to persist
SyncException
PersistException| Method Detail |
|---|
public java.util.List<Versioned<byte[]>> get(ByteArray key)
throws SyncException
IStore
get in interface IStore<ByteArray,byte[]>key - The key to check for
SyncExceptionpublic IClosableIterator<java.util.Map.Entry<ByteArray,java.util.List<Versioned<byte[]>>>> entries()
IStorageEngine
entries in interface IStorageEngine<ByteArray,byte[]>entries in interface IStore<ByteArray,byte[]>
public void put(ByteArray key,
Versioned<byte[]> value)
throws SyncException
IStore
put in interface IStore<ByteArray,byte[]>key - The key to usevalue - The value to store and its version.
SyncExceptionpublic IClosableIterator<ByteArray> keys()
IStorageEngine
keys in interface IStorageEngine<ByteArray,byte[]>
public void truncate()
throws SyncException
IStorageEngine
truncate in interface IStorageEngine<ByteArray,byte[]>SyncExceptionpublic java.lang.String getName()
getName in interface IStore<ByteArray,byte[]>
public void close()
throws SyncException
IStore
close in interface IStore<ByteArray,byte[]>SyncException - If closing fails.
public boolean writeSyncValue(ByteArray key,
java.lang.Iterable<Versioned<byte[]>> values)
IStorageEngine
writeSyncValue in interface IStorageEngine<ByteArray,byte[]>key - the keyvalues - the list of versions for that key
public java.util.List<IVersion> getVersions(ByteArray key)
throws SyncException
IStore
getVersions in interface IStore<ByteArray,byte[]>key - the key
IVersion objects
SyncException
public void cleanupTask()
throws SyncException
IStorageEngine
cleanupTask in interface IStorageEngine<ByteArray,byte[]>SyncExceptionpublic boolean isPersistent()
IStorageEngine
isPersistent in interface IStorageEngine<ByteArray,byte[]>public void setTombstoneInterval(int interval)
IStorageEngine
setTombstoneInterval in interface IStorageEngine<ByteArray,byte[]>interval - the interval in milliseconds
public static javax.sql.ConnectionPoolDataSource getDataSource(java.lang.String dbPath,
boolean memory)
dbPath - The path where the db will be locatedmemory - whether to actually use a memory database
ConnectionPoolDataSource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||