Skip to content

Commit

Permalink
Fix cbl-log and cblite for latest 3.2 API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
borrrden committed Apr 25, 2024
1 parent 7571ab2 commit d51cc90
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions cbl-log/cbl-log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

#include "LogDecoder.hh"
#include "Logging.hh"
#include "Tool.hh"
#include "MultiLogDecoder.hh"
#include <vector>
Expand Down Expand Up @@ -268,4 +269,29 @@ namespace litecore {
fprintf(stderr, "%s (%s:%u, in %s)", messageStr.c_str(), file, line, fn);
throw runtime_error(messageStr);
}
}

namespace litecore {
static void getObjectPathRecur(const LogDomain::ObjectMap& objMap, LogDomain::ObjectMap::const_iterator iter,
std::stringstream& ss) {
// pre-conditions: iter != objMap.end()
if ( iter->second.second != 0 ) {
auto parentIter = objMap.find(iter->second.second);
if ( parentIter == objMap.end() ) {
// the parent object is deleted. We omit the loggingClassName
ss << "/#" << iter->second.second;
} else {
getObjectPathRecur(objMap, parentIter, ss);
}
}
ss << "/" << iter->second.first << "#" << iter->first;
}

std::string LogDomain::getObjectPath(unsigned obj, const ObjectMap& objMap) {
auto iter = objMap.find(obj);
if ( iter == objMap.end() ) { return ""; }
std::stringstream ss;
getObjectPathRecur(objMap, iter, ss);
return ss.str() + "/";
}
}
2 changes: 1 addition & 1 deletion litecp/DBEndpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void DbEndpoint::startReplicationWith(RemoteEndpoint &remote, bool pushing) {
params.collections = replicationCollections.data();

C4Error err;
startReplicator(c4repl_new(_db, remote.url(), remote.databaseName(), params, &err), err);
startReplicator(c4repl_new(_db, remote.url(), remote.databaseName(), params, C4STR("cblite_cli"), &err), err);
}


Expand Down

0 comments on commit d51cc90

Please # to comment.