mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
used dbu extension for update files
This commit is contained in:
@@ -73,9 +73,9 @@ public:
|
||||
const std::string & getTargetVersion() const {return _targetVersion;}
|
||||
|
||||
// Start recording changes made to the database until it is closed, then write a compact
|
||||
// delta of those changes to outputUrl (empty disables). Returns true if recording is
|
||||
// active. Only the SQLite backend supports it (session extension + database version
|
||||
// >= 0.24); other backends return false.
|
||||
// delta of those changes to outputUrl (empty disables). outputUrl MUST use the ".dbu"
|
||||
// (db update) extension. Returns true if recording is active. Only the SQLite backend
|
||||
// supports it (session extension + database version >= 0.24); other backends return false.
|
||||
// NOTE: recorded changes are held in RAM until the database is closed, so only enable
|
||||
// this when the expected set of changes is small.
|
||||
virtual bool trackDatabaseChanges(const std::string & outputUrl) {(void)outputUrl; return false;}
|
||||
|
||||
@@ -51,22 +51,23 @@ public:
|
||||
void setSynchronous(int synchronous);
|
||||
void setTempStore(int tempStore);
|
||||
// Start recording changes made to the database from now until it is closed, then write
|
||||
// a compact patchset delta to outputUrl (empty disables). Can be called before the
|
||||
// connection is opened or on an already-open connection (e.g. after init(), so the
|
||||
// baseline is the current content). Returns true if recording is active. Only effective
|
||||
// if the build/runtime SQLite has the session extension and the database is version >= 0.24.
|
||||
// a compact changeset delta to outputUrl (empty disables). outputUrl MUST use the ".dbu"
|
||||
// (db update) extension. Can be called before the connection is opened or on an already-open
|
||||
// connection (e.g. after init(), so the baseline is the current content). Returns true if
|
||||
// recording is active. Only effective if the build/runtime SQLite has the session extension
|
||||
// and the database is version >= 0.24.
|
||||
// NOTE: the SQLite session extension holds ALL recorded changes in RAM until the database
|
||||
// is closed (there is no incremental spill to disk), so only enable this when the expected
|
||||
// set of changes is small (e.g. appending a few sessions), not for rewriting a whole map.
|
||||
virtual bool trackDatabaseChanges(const std::string & outputUrl);
|
||||
|
||||
// Apply a change delta previously written by trackDatabaseChanges() onto the database at
|
||||
// databasePath. The file is decompressed (same codec as the other rtabmap blobs) then
|
||||
// applied with the SQLite session extension. With rewind=false, databasePath must be at the
|
||||
// same state the delta was recorded from; with rewind=true, the delta is inverted first to
|
||||
// undo it, so databasePath must be at the post-update state. Returns true on success; on
|
||||
// failure returns false and, if errorMsg is not null, sets a human-readable message.
|
||||
// Requires a SQLite library built with the session extension (both at build and runtime).
|
||||
// Apply a ".dbu" change delta previously written by trackDatabaseChanges() onto the database
|
||||
// at databasePath. The file (which must have the ".dbu" extension) is decompressed (same codec
|
||||
// as the other rtabmap blobs) then applied with the SQLite session extension. With rewind=false,
|
||||
// databasePath must be at the same state the delta was recorded from; with rewind=true, the
|
||||
// delta is inverted first to undo it, so databasePath must be at the post-update state. Returns
|
||||
// true on success; on failure returns false and, if errorMsg is not null, sets a human-readable
|
||||
// message. Requires a SQLite library built with the session extension (both build and runtime).
|
||||
static bool applyChangesFromFile(
|
||||
const std::string & databasePath,
|
||||
const std::string & changesetPath,
|
||||
|
||||
@@ -183,7 +183,8 @@ public:
|
||||
std::string getDatabaseVersion() const;
|
||||
std::string getDatabaseUrl() const;
|
||||
// Record changes made to the database until it is closed, then write a compact delta
|
||||
// to outputUrl (empty disables). Returns true if recording started. See DBDriver.
|
||||
// to outputUrl (empty disables). outputUrl MUST use the ".dbu" (db update) extension.
|
||||
// Returns true if recording started. See DBDriver.
|
||||
bool trackDatabaseChanges(const std::string & outputUrl);
|
||||
double getDbSavingTime() const;
|
||||
int getMapId(int id, bool lookInDatabase = false) const;
|
||||
|
||||
@@ -147,9 +147,10 @@ public:
|
||||
Transform getMapCorrection() const {return _mapCorrection;}
|
||||
const Memory * getMemory() const {return _memory;}
|
||||
// Record changes made to the working database from now until it is closed, then write a
|
||||
// compact delta to outputUrl (empty disables). Call after init(), so the delta reflects
|
||||
// only what is added/modified afterwards. Returns true if recording started (requires the
|
||||
// SQLite session extension and a database version >= 0.24). See DBDriver.
|
||||
// compact delta to outputUrl (empty disables). outputUrl MUST use the ".dbu" (db update)
|
||||
// extension. Call after init(), so the delta reflects only what is added/modified afterwards.
|
||||
// Returns true if recording started (requires the SQLite session extension and a database
|
||||
// version >= 0.24). See DBDriver.
|
||||
// NOTE: recorded changes are held in RAM until the database is closed, so only enable this
|
||||
// when the expected set of changes is small (e.g. appending a few sessions).
|
||||
bool trackDatabaseChanges(const std::string & outputUrl);
|
||||
|
||||
@@ -260,6 +260,14 @@ void DBDriverSqlite3::startChangeTracking()
|
||||
bool DBDriverSqlite3::trackDatabaseChanges(const std::string & outputUrl)
|
||||
{
|
||||
UDEBUG("outputUrl=%s", outputUrl.c_str());
|
||||
// The delta file must use the ".dbu" (db update) extension so it is clearly identifiable
|
||||
// and can be applied/rewound with rtabmap-dbupdate.
|
||||
if(!outputUrl.empty() && UFile::getExtension(outputUrl).compare("dbu") != 0)
|
||||
{
|
||||
UERROR("Database change tracking output \"%s\" must have a \".dbu\" (db update) extension; "
|
||||
"change tracking is disabled.", outputUrl.c_str());
|
||||
return false;
|
||||
}
|
||||
_trackChangesOutput = outputUrl;
|
||||
#ifdef RTABMAP_WITH_SQLITE3_SESSION
|
||||
// If the connection is already open (e.g. set after connect(), as rtabmap-reprocess
|
||||
@@ -297,6 +305,11 @@ bool DBDriverSqlite3::applyChangesFromFile(
|
||||
bool rewind,
|
||||
std::string * errorMsg)
|
||||
{
|
||||
if(UFile::getExtension(changesetPath).compare("dbu") != 0)
|
||||
{
|
||||
if(errorMsg) *errorMsg = uFormat("Update file \"%s\" must have a \".dbu\" (db update) extension.", changesetPath.c_str());
|
||||
return false;
|
||||
}
|
||||
#ifdef RTABMAP_WITH_SQLITE3_SESSION
|
||||
if(!sqlite3_compileoption_used("ENABLE_SESSION"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user