|
osgEarth 2.1.1
|
#include "Sqlite3CacheOptions"#include <osgEarth/FileUtils>#include <osgEarth/TaskService>#include <osgDB/FileNameUtils>#include <osgDB/FileUtils>#include <osgDB/ReaderWriter>#include <OpenThreads/Mutex>#include <OpenThreads/ScopedLock>#include <cstring>#include <fstream>#include <sqlite3.h>
Include dependency graph for Sqlite3Cache.cpp:Go to the source code of this file.
Classes | |
| struct | AsyncCache |
| struct | MetadataRecord |
| struct | MetadataTable |
| struct | ImageRecord |
| struct | LayerTable |
| struct | AsyncPurge |
| struct | AsyncInsert |
| struct | AsyncUpdateAccessTime |
| struct | AsyncUpdateAccessTimePool |
| struct | ThreadTable |
| class | Sqlite3Cache |
| class | Sqlite3CacheFactory |
Defines | |
| #define | LC "[Sqlite3Cache] " |
| #define | USE_TRANSACTIONS |
| #define | USE_L2_CACHE |
| #define | UPDATE_ACCESS_TIMES |
| #define | UPDATE_ACCESS_TIMES_POOL |
| #define | MAX_REQUEST_TO_RUN_PURGE 100 |
| #define | PURGE_GENERAL |
Typedefs | |
| typedef std::map< std::string, osg::ref_ptr< LayerTable > > | LayerTablesByName |
Functions | |
| static sqlite3 * | openDatabase (const std::string &path, bool serialized) |
| #define LC "[Sqlite3Cache] " |
Definition at line 46 of file Sqlite3Cache.cpp.
| #define MAX_REQUEST_TO_RUN_PURGE 100 |
Definition at line 55 of file Sqlite3Cache.cpp.
| #define PURGE_GENERAL |
Definition at line 57 of file Sqlite3Cache.cpp.
| #define UPDATE_ACCESS_TIMES |
Definition at line 53 of file Sqlite3Cache.cpp.
| #define UPDATE_ACCESS_TIMES_POOL |
Definition at line 54 of file Sqlite3Cache.cpp.
| #define USE_L2_CACHE |
Definition at line 49 of file Sqlite3Cache.cpp.
| #define USE_TRANSACTIONS |
Definition at line 48 of file Sqlite3Cache.cpp.
| typedef std::map<std::string,osg::ref_ptr<LayerTable> > LayerTablesByName |
Definition at line 932 of file Sqlite3Cache.cpp.
| static sqlite3* openDatabase | ( | const std::string & | path, |
| bool | serialized | ||
| ) | [static] |
Definition at line 66 of file Sqlite3Cache.cpp.
{
//Try to create the path if it doesn't exist
std::string dirPath = osgDB::getFilePath(path);
//If the path doesn't currently exist or we can't create the path, don't cache the file
if (!osgDB::fileExists(dirPath) && !osgDB::makeDirectory(dirPath))
{
OE_WARN << LC << "Couldn't create path " << dirPath << std::endl;
}
sqlite3* db = 0L;
// not sure if SHAREDCACHE is necessary or wise
int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
flags |= serialized ? SQLITE_OPEN_FULLMUTEX : SQLITE_OPEN_NOMUTEX;
int rc = sqlite3_open_v2( path.c_str(), &db, flags, 0L );
if ( rc != 0 )
{
OE_WARN << LC << "Failed to open cache \"" << path << "\": " << sqlite3_errmsg(db) << std::endl;
return 0L;
}
// make sure that writes actually finish
sqlite3_busy_timeout( db, 60000 );
return db;
}
Here is the caller graph for this function:
1.7.3