Class SQLiteDataSpecStorage
java.lang.Object
uk.ac.manchester.spinnaker.storage.sqlite.SQLiteDataSpecStorage
- All Implemented Interfaces:
DatabaseAPI
,DSEStorage
,ProxyAwareStorage
public class SQLiteDataSpecStorage extends Object implements DSEStorage
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.DSEStorage
DSEStorage.Ethernet
-
Constructor Summary
Constructors Constructor Description SQLiteDataSpecStorage(DSEDatabaseEngine connectionProvider)
Create an instance. -
Method Summary
Modifier and Type Method Description int
getAppId()
Get the system wide app id.ProxyInformation
getProxyInformation()
Get the proxy information from the database.HashMap<Integer,RegionInfo>
getRegionPointersAndContent(CoreLocation xyp)
Gets a map of region ids to pointers and content Maps only regions with a none zero size.LinkedHashMap<Integer,Integer>
getRegionSizes(CoreLocation core)
Get a map of region id to size for regions with a none zero size.MemoryLocation
getStartAddress(CoreLocation xyp)
Gets the start address for the metadata on this core.List<CoreLocation>
listCoresToLoad(DSEStorage.Ethernet ethernet, boolean loadSystemCores)
Get a list of all cores that need to be done for a particular ethernet.List<DSEStorage.Ethernet>
listEthernetsToLoad()
Get a list of all ethernets that need to have DSE loading done on them.protected static void
setArguments(PreparedStatement statement, Object... args)
Set the arguments to a prepared statement.void
setRegionPointer(CoreLocation xyp, int regionNum, int pointer)
Set the pointer for where to write the region data to.void
setStartAddress(CoreLocation xyp, MemoryLocation start)
Record the start address for the metadata on this core.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.ProxyAwareStorage
getProxyInformation
-
Constructor Details
-
SQLiteDataSpecStorage
Create an instance.- Parameters:
connectionProvider
- The connection provider that will be asked for how to talk SQL to the database.
-
-
Method Details
-
listEthernetsToLoad
Description copied from interface:DSEStorage
Get a list of all ethernets that need to have DSE loading done on them.- Specified by:
listEthernetsToLoad
in interfaceDSEStorage
- Returns:
- The list of ethernets.
- Throws:
StorageException
- If the database access fails.
-
listCoresToLoad
public List<CoreLocation> listCoresToLoad(DSEStorage.Ethernet ethernet, boolean loadSystemCores) throws StorageExceptionDescription copied from interface:DSEStorage
Get a list of all cores that need to be done for a particular ethernet.- Specified by:
listCoresToLoad
in interfaceDSEStorage
- Parameters:
ethernet
- The ethernet we're loading onto.loadSystemCores
- Iftrue
, just list system cores. Iffalse
, just list application (non-system) cores.- Returns:
- The list of core locations.
- Throws:
StorageException
- If the database access fails.
-
getRegionSizes
Description copied from interface:DSEStorage
Get a map of region id to size for regions with a none zero size.- Specified by:
getRegionSizes
in interfaceDSEStorage
- Parameters:
core
- Coordinates to get the region sizes for- Returns:
- Sorted Map of Region number to size. For the regions with a none zero size
- Throws:
StorageException
- If the database access fails.
-
getRegionPointersAndContent
public HashMap<Integer,RegionInfo> getRegionPointersAndContent(CoreLocation xyp) throws StorageExceptionDescription copied from interface:DSEStorage
Gets a map of region ids to pointers and content Maps only regions with a none zero size. The content may be null is no data added- Specified by:
getRegionPointersAndContent
in interfaceDSEStorage
- Parameters:
xyp
- Coordinates for the core- Returns:
- map of region number to object holding pointer and content
- Throws:
StorageException
- If the database access fails.
-
setStartAddress
Description copied from interface:DSEStorage
Record the start address for the metadata on this core.- Specified by:
setStartAddress
in interfaceDSEStorage
- Parameters:
xyp
- Coordinates for the corestart
- Where the load metadata starts.- Throws:
StorageException
- If the database access fails.
-
getStartAddress
Description copied from interface:DSEStorage
Gets the start address for the metadata on this core.- Specified by:
getStartAddress
in interfaceDSEStorage
- Parameters:
xyp
- Coordinates for the core- Returns:
- The location of the start of the metadata region
- Throws:
StorageException
- If the database access fails.
-
setRegionPointer
Description copied from interface:DSEStorage
Set the pointer for where to write the region data to.- Specified by:
setRegionPointer
in interfaceDSEStorage
- Parameters:
xyp
- Coordinates for the coreregionNum
- region number for this pointerpointer
- start address for this regions metadata- Throws:
StorageException
- If the database access fails.
-
getAppId
Description copied from interface:DSEStorage
Get the system wide app id.- Specified by:
getAppId
in interfaceDSEStorage
- Returns:
- the app id
- Throws:
StorageException
- If the database access fails.
-
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.
-