diff options
Diffstat (limited to 'modules/database/db_redis.cpp')
-rw-r--r-- | modules/database/db_redis.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/modules/database/db_redis.cpp b/modules/database/db_redis.cpp index 2dc2004bb..81c0a6197 100644 --- a/modules/database/db_redis.cpp +++ b/modules/database/db_redis.cpp @@ -25,7 +25,7 @@ class Data : public Serialize::Data delete it->second; } - std::iostream& operator[](const Anope::string &key) anope_override + std::iostream& operator[](const Anope::string &key) override { std::stringstream* &stream = data[key]; if (!stream) @@ -33,7 +33,7 @@ class Data : public Serialize::Data return *stream; } - std::set<Anope::string> KeySet() const anope_override + std::set<Anope::string> KeySet() const override { std::set<Anope::string> keys; for (std::map<Anope::string, std::stringstream *>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -41,7 +41,7 @@ class Data : public Serialize::Data return keys; } - size_t Hash() const anope_override + size_t Hash() const override { size_t hash = 0; for (std::map<Anope::string, std::stringstream *>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -57,7 +57,7 @@ class TypeLoader : public Interface public: TypeLoader(Module *creator, const Anope::string &t) : Interface(creator), type(t) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class ObjectLoader : public Interface @@ -68,7 +68,7 @@ class ObjectLoader : public Interface public: ObjectLoader(Module *creator, const Anope::string &t, int64_t i) : Interface(creator), type(t), id(i) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class IDInterface : public Interface @@ -77,7 +77,7 @@ class IDInterface : public Interface public: IDInterface(Module *creator, Serializable *obj) : Interface(creator), o(obj) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class Deleter : public Interface @@ -87,7 +87,7 @@ class Deleter : public Interface public: Deleter(Module *creator, const Anope::string &t, int64_t i) : Interface(creator), type(t), id(i) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class Updater : public Interface @@ -97,7 +97,7 @@ class Updater : public Interface public: Updater(Module *creator, const Anope::string &t, int64_t i) : Interface(creator), type(t), id(i) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class ModifiedObject : public Interface @@ -107,7 +107,7 @@ class ModifiedObject : public Interface public: ModifiedObject(Module *creator, const Anope::string &t, int64_t i) : Interface(creator), type(t), id(i) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class SubscriptionListener : public Interface @@ -115,7 +115,7 @@ class SubscriptionListener : public Interface public: SubscriptionListener(Module *creator) : Interface(creator) { } - void OnResult(const Reply &r) anope_override; + void OnResult(const Reply &r) override; }; class DatabaseRedis : public Module, public Pipe @@ -151,7 +151,7 @@ class DatabaseRedis : public Module, public Pipe obj->UpdateCache(data); std::vector<Anope::string> args; - args.push_back("HGETALL"); + args.emplace_back("HGETALL"); args.push_back("hash:" + t->GetName() + ":" + stringify(obj->id)); /* Get object attrs to clear before updating */ @@ -159,7 +159,7 @@ class DatabaseRedis : public Module, public Pipe } } - void OnNotify() anope_override + void OnNotify() override { for (std::set<Serializable *>::iterator it = this->updated_items.begin(), it_end = this->updated_items.end(); it != it_end; ++it) { @@ -171,13 +171,13 @@ class DatabaseRedis : public Module, public Pipe this->updated_items.clear(); } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); this->redis = ServiceReference<Provider>("Redis::Provider", block->Get<const Anope::string>("engine", "redis/main")); } - EventReturn OnLoadDatabase() anope_override + EventReturn OnLoadDatabase() override { if (!redis) { @@ -205,25 +205,25 @@ class DatabaseRedis : public Module, public Pipe return EVENT_STOP; } - void OnSerializeTypeCreate(Serialize::Type *sb) anope_override + void OnSerializeTypeCreate(Serialize::Type *sb) override { if (!redis) return; std::vector<Anope::string> args; - args.push_back("SMEMBERS"); + args.emplace_back("SMEMBERS"); args.push_back("ids:" + sb->GetName()); redis->SendCommand(new TypeLoader(this, sb->GetName()), args); } - void OnSerializableConstruct(Serializable *obj) anope_override + void OnSerializableConstruct(Serializable *obj) override { this->updated_items.insert(obj); this->Notify(); } - void OnSerializableDestruct(Serializable *obj) anope_override + void OnSerializableDestruct(Serializable *obj) override { Serialize::Type *t = obj->GetSerializableType(); @@ -240,7 +240,7 @@ class DatabaseRedis : public Module, public Pipe } std::vector<Anope::string> args; - args.push_back("HGETALL"); + args.emplace_back("HGETALL"); args.push_back("hash:" + t->GetName() + ":" + stringify(obj->id)); /* Get all of the attributes for this object */ @@ -251,7 +251,7 @@ class DatabaseRedis : public Module, public Pipe this->Notify(); } - void OnSerializableUpdate(Serializable *obj) anope_override + void OnSerializableUpdate(Serializable *obj) override { this->updated_items.insert(obj); this->Notify(); @@ -284,7 +284,7 @@ void TypeLoader::OnResult(const Reply &r) } std::vector<Anope::string> args; - args.push_back("HGETALL"); + args.emplace_back("HGETALL"); args.push_back("hash:" + this->type + ":" + stringify(id)); me->redis->SendCommand(new ObjectLoader(me, this->type, id), args); @@ -358,14 +358,14 @@ void Deleter::OnResult(const Reply &r) me->redis->StartTransaction(); std::vector<Anope::string> args; - args.push_back("DEL"); + args.emplace_back("DEL"); args.push_back("hash:" + this->type + ":" + stringify(this->id)); /* Delete hash object */ me->redis->SendCommand(NULL, args); args.clear(); - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("ids:" + this->type); args.push_back(stringify(this->id)); @@ -378,7 +378,7 @@ void Deleter::OnResult(const Reply &r) *value = r.multi_bulk[i + 1]; args.clear(); - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("value:" + this->type + ":" + key->bulk + ":" + value->bulk); args.push_back(stringify(this->id)); @@ -421,7 +421,7 @@ void Updater::OnResult(const Reply &r) *value = r.multi_bulk[i + 1]; std::vector<Anope::string> args; - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("value:" + this->type + ":" + key->bulk + ":" + value->bulk); args.push_back(stringify(this->id)); @@ -431,13 +431,13 @@ void Updater::OnResult(const Reply &r) /* Add object id to id set for this type */ std::vector<Anope::string> args; - args.push_back("SADD"); + args.emplace_back("SADD"); args.push_back("ids:" + this->type); args.push_back(stringify(obj->id)); me->redis->SendCommand(NULL, args); args.clear(); - args.push_back("HMSET"); + args.emplace_back("HMSET"); args.push_back("hash:" + this->type + ":" + stringify(obj->id)); typedef std::map<Anope::string, std::stringstream *> items; @@ -447,11 +447,11 @@ void Updater::OnResult(const Reply &r) std::stringstream *value = it->second; args.push_back(key); - args.push_back(value->str()); + args.emplace_back(value->str()); std::vector<Anope::string> args2; - args2.push_back("SADD"); + args2.emplace_back("SADD"); args2.push_back("value:" + this->type + ":" + key + ":" + value->str()); args2.push_back(stringify(obj->id)); @@ -528,7 +528,7 @@ void SubscriptionListener::OnResult(const Reply &r) Log(LOG_DEBUG) << "redis: notify: got modify for object id " << obj_id << " of type " << type; std::vector<Anope::string> args; - args.push_back("HGETALL"); + args.emplace_back("HGETALL"); args.push_back("hash:" + type + ":" + id); me->redis->SendCommand(new ModifiedObject(me, type, obj_id), args); @@ -556,7 +556,7 @@ void SubscriptionListener::OnResult(const Reply &r) std::stringstream *value = it->second; std::vector<Anope::string> args; - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("value:" + type + ":" + k + ":" + value->str()); args.push_back(id); @@ -565,7 +565,7 @@ void SubscriptionListener::OnResult(const Reply &r) } std::vector<Anope::string> args; - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("ids:" + type); args.push_back(stringify(s->id)); @@ -609,7 +609,7 @@ void ModifiedObject::OnResult(const Reply &r) std::stringstream *value = it->second; std::vector<Anope::string> args; - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("value:" + st->GetName() + ":" + key + ":" + value->str()); args.push_back(stringify(this->id)); @@ -642,7 +642,7 @@ void ModifiedObject::OnResult(const Reply &r) std::stringstream *value = it->second; std::vector<Anope::string> args; - args.push_back("SADD"); + args.emplace_back("SADD"); args.push_back("value:" + st->GetName() + ":" + key + ":" + value->str()); args.push_back(stringify(obj->id)); @@ -651,7 +651,7 @@ void ModifiedObject::OnResult(const Reply &r) } std::vector<Anope::string> args; - args.push_back("SADD"); + args.emplace_back("SADD"); args.push_back("ids:" + st->GetName()); args.push_back(stringify(obj->id)); |