From b27e6cb2ecb704b89d21b097260cb2f14769c042 Mon Sep 17 00:00:00 2001 From: marisa Date: Fri, 23 Feb 2024 13:24:03 -0300 Subject: [PATCH] Better singleton names --- source/db/db.d | 2 +- source/main.d | 20 ++++++++++---------- source/singletons.d | 4 ++-- source/webfinger.d | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/source/db/db.d b/source/db/db.d index 249e347..cea80f6 100644 --- a/source/db/db.d +++ b/source/db/db.d @@ -57,7 +57,7 @@ struct DBSettings { } } -class DB { +class Database { protected DBSettings m_settings; protected EntityMetaData m_schema; protected DataSource m_ds; diff --git a/source/main.d b/source/main.d index bbb8a52..c0e7dad 100644 --- a/source/main.d +++ b/source/main.d @@ -35,13 +35,13 @@ Config loadConfig() { } void initRequestPool(Config cfg) { - Rp = new RequestPool(); - Rp.startBackground(); + RP = new RequestPool(); + RP.startBackground(); } void initDatabase(Config cfg) { - Db = new DB(DBSettings.fromJson(cfg.v["db"])); - Db.connect(); + DB = new Database(DBSettings.fromJson(cfg.v["db"])); + DB.connect(); } void main() { @@ -50,8 +50,8 @@ void main() { commonInit(); scope (exit) { - Db.close(); - Rp.stop(); + DB.close(); + RP.stop(); } ASObject actor = apResolveRemoteUsername("@marisa@ak.gensokyo.shop"); @@ -70,7 +70,7 @@ void main() { // headers["Accept"] = "application/activity+json"; // } - // Response rs = Rp.request(followers, true); + // Response rs = RP.request(followers, true); // infoF!"followers: %s"(rs.responseBody); } @@ -105,11 +105,11 @@ void main() { // } // } // -// Db = new DB(dbSettings); -// Db.connect(); +// DB = new DB(dbSettings); +// DB.connect(); // // scope (exit) -// Db.close(); +// DB.close(); // // return 0; //} diff --git a/source/singletons.d b/source/singletons.d index b20d380..c03556a 100644 --- a/source/singletons.d +++ b/source/singletons.d @@ -3,5 +3,5 @@ module singletons; import db.db; import net.request_pool; -DB Db; -RequestPool Rp; +Database DB; +RequestPool RP; diff --git a/source/webfinger.d b/source/webfinger.d index 0e2b6cf..88cdfce 100644 --- a/source/webfinger.d +++ b/source/webfinger.d @@ -46,7 +46,7 @@ PRequest buildAcctRequest(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) throw new Exception("Invalid webfinger response");