Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update expensify_prod branch #1707

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions BedrockServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ void BedrockServer::syncWrapper()
SINFO("Exiting syncWrapper");
}

shared_ptr<SQLitePool> BedrockServer::getDBPool() {
return _dbPool;
}

void BedrockServer::sync()
{
// Parse out the number of worker threads we'll use. The DB needs to know this because it will expect a
Expand Down
3 changes: 3 additions & 0 deletions BedrockServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ class BedrockServer : public SQLiteServer {
// else. In the future, when all command queues are removed, this will not be the case, but right now, you can not rely on the command having completed when this returns.
void runCommand(unique_ptr<BedrockCommand>&& command, bool isBlocking = false, bool hasDedicatedThread = true);

// Expose the DB pool to plugins.
shared_ptr<SQLitePool> getDBPool();

private:
// The name of the sync thread.
static constexpr auto _syncThreadName = "sync";
Expand Down
10 changes: 10 additions & 0 deletions libstuff/libstuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,16 @@ bool SParseList(const char* ptr, list<string>& valueList, char separator) {
return (!component.empty());
}

// --------------------------------------------------------------------------
set<string> SParseSet(const string& value, char separator) {
set<string> valueSet;
list<string> strings = SParseList(value, separator);
for (const string& str : strings) {
valueSet.insert(str);
}
return valueSet;
}

STable SParseCommandLine(int argc, char* argv[]) {
// Just walk across and find the pairs, then put the remainder on a list in the method
STable results;
Expand Down
1 change: 1 addition & 0 deletions libstuff/libstuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ list<int64_t> SParseIntegerList(const string& value, char separator = ',');
set<int64_t> SParseIntegerSet(const string& value, char separator = ',');
bool SParseList(const char* value, list<string>& valueList, char separator = ',');
bool SParseList(const string& value, list<string>& valueList, char separator = ',');
set<string> SParseSet(const string& value, char separator = ',');
list<string> SParseList(const string& value, char separator = ',');

// Concatenates things into a string. "Things" can mean essentially any
Expand Down