Class SQLiteBufferStorage
java.lang.Object
uk.ac.manchester.spinnaker.storage.sqlite.SQLiteBufferStorage
- All Implemented Interfaces:
BufferManagerStorage
,DatabaseAPI
,ProxyAwareStorage
public class SQLiteBufferStorage extends Object implements BufferManagerStorage
How to actually talk to an SQLite database.
- Author:
- Donal Fellows
-
Nested Class Summary
Nested classes/interfaces inherited from interface uk.ac.manchester.spinnaker.storage.BufferManagerStorage
BufferManagerStorage.Region
-
Constructor Summary
Constructors Constructor Description SQLiteBufferStorage(BufferManagerDatabaseEngine connectionProvider)
Create an instance. -
Method Summary
Modifier and Type Method Description void
addRecordingContents(BufferManagerStorage.Region region, byte[] contents)
Extract some bytes to the database.byte[]
getContents(BufferManagerStorage.Region region)
Retrieves some bytes from the database.List<CoreLocation>
getCoresWithStorage()
Get a list of all cores that have data stored in the database.ProxyInformation
getProxyInformation()
Get the proxy information from the database.List<Integer>
getRegionsWithStorage(HasCoreLocation core)
Get a list of all regions for a particular core that have data stored in the database.void
insertMockExtraction()
protected static void
setArguments(PreparedStatement statement, Object... args)
Set the arguments to a prepared statement.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface uk.ac.manchester.spinnaker.storage.BufferManagerStorage
addRecordingContents, deleteRegionContents, storeDSEContents, storeRegionContents
Methods inherited from interface uk.ac.manchester.spinnaker.storage.ProxyAwareStorage
getProxyInformation
-
Constructor Details
-
SQLiteBufferStorage
Create an instance.- Parameters:
connectionProvider
- The connection provider that will be asked for how to talk SQL to the database.
-
-
Method Details
-
insertMockExtraction
- Specified by:
insertMockExtraction
in interfaceBufferManagerStorage
- Throws:
StorageException
-
addRecordingContents
public void addRecordingContents(BufferManagerStorage.Region region, byte[] contents) throws StorageExceptionDescription copied from interface:BufferManagerStorage
Extract some bytes to the database. The bytes represent the contents of a recording region of a particular SpiNNaker core.- Specified by:
addRecordingContents
in interfaceBufferManagerStorage
- Parameters:
region
- The recording region doing the recording.contents
- The bytes to append.- Throws:
StorageException
- If anything goes wrong.
-
getContents
Description copied from interface:BufferManagerStorage
Retrieves some bytes from the database. The bytes represent the contents of a recording region of a particular SpiNNaker core.- Specified by:
getContents
in interfaceBufferManagerStorage
- Parameters:
region
- The (DSE) region descriptor.- Returns:
- The region contents.
- Throws:
StorageException
- If anything goes wrong.
-
getCoresWithStorage
Description copied from interface:BufferManagerStorage
Get a list of all cores that have data stored in the database. Warning: this is a potentially expensive operation!- Specified by:
getCoresWithStorage
in interfaceBufferManagerStorage
- Returns:
- A list of cores for which something is stored.
- Throws:
StorageException
- If anything goes wrong.
-
getRegionsWithStorage
Description copied from interface:BufferManagerStorage
Get a list of all regions for a particular core that have data stored in the database.- Specified by:
getRegionsWithStorage
in interfaceBufferManagerStorage
- Parameters:
core
- The core that has the memory regions.- Returns:
- A list of region IDs for which something is stored.
- Throws:
StorageException
- If anything goes wrong.
-
getProxyInformation
Description copied from interface:ProxyAwareStorage
Get the proxy information from the database.- Specified by:
getProxyInformation
in interfaceProxyAwareStorage
- Returns:
- The proxy information, or
null
if none defined. When there is no proxy, only direct connections to SpiNNaker are possible. - Throws:
StorageException
- If anything goes wrong.
-
setArguments
protected static void setArguments(PreparedStatement statement, Object... args) throws SQLExceptionSet the arguments to a prepared statement. Convenience method.
-