Better singleton names

This commit is contained in:
2024-02-23 13:24:03 -03:00
parent 810bf6b830
commit b27e6cb2ec
4 changed files with 14 additions and 14 deletions

View File

@@ -57,7 +57,7 @@ struct DBSettings {
} }
} }
class DB { class Database {
protected DBSettings m_settings; protected DBSettings m_settings;
protected EntityMetaData m_schema; protected EntityMetaData m_schema;
protected DataSource m_ds; protected DataSource m_ds;

View File

@@ -35,13 +35,13 @@ Config loadConfig() {
} }
void initRequestPool(Config cfg) { void initRequestPool(Config cfg) {
Rp = new RequestPool(); RP = new RequestPool();
Rp.startBackground(); RP.startBackground();
} }
void initDatabase(Config cfg) { void initDatabase(Config cfg) {
Db = new DB(DBSettings.fromJson(cfg.v["db"])); DB = new Database(DBSettings.fromJson(cfg.v["db"]));
Db.connect(); DB.connect();
} }
void main() { void main() {
@@ -50,8 +50,8 @@ void main() {
commonInit(); commonInit();
scope (exit) { scope (exit) {
Db.close(); DB.close();
Rp.stop(); RP.stop();
} }
ASObject actor = apResolveRemoteUsername("@marisa@ak.gensokyo.shop"); ASObject actor = apResolveRemoteUsername("@marisa@ak.gensokyo.shop");
@@ -70,7 +70,7 @@ void main() {
// headers["Accept"] = "application/activity+json"; // headers["Accept"] = "application/activity+json";
// } // }
// Response rs = Rp.request(followers, true); // Response rs = RP.request(followers, true);
// infoF!"followers: %s"(rs.responseBody); // infoF!"followers: %s"(rs.responseBody);
} }
@@ -105,11 +105,11 @@ void main() {
// } // }
// } // }
// //
// Db = new DB(dbSettings); // DB = new DB(dbSettings);
// Db.connect(); // DB.connect();
// //
// scope (exit) // scope (exit)
// Db.close(); // DB.close();
// //
// return 0; // return 0;
//} //}

View File

@@ -3,5 +3,5 @@ module singletons;
import db.db; import db.db;
import net.request_pool; import net.request_pool;
DB Db; Database DB;
RequestPool Rp; RequestPool RP;

View File

@@ -46,7 +46,7 @@ PRequest buildAcctRequest(string uri, string acct) {
} }
JSONValue wfRequestAccount(string uri, string acct) { JSONValue wfRequestAccount(string uri, string acct) {
Response rs = Rp.request(buildAcctRequest(uri, acct), true); Response rs = RP.request(buildAcctRequest(uri, acct), true);
if (checkValidWebfingerResponse(rs) == false) if (checkValidWebfingerResponse(rs) == false)
throw new Exception("Invalid webfinger response"); throw new Exception("Invalid webfinger response");