1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 17:13:13 +02:00

Move serialization from Serializable to a Serialize::Type child.

This commit is contained in:
Sadie Powell
2025-03-12 10:29:11 +00:00
parent 718f2e922a
commit cdcf0e2f9a
40 changed files with 778 additions and 452 deletions
+1 -1
View File
@@ -313,7 +313,7 @@ public:
*data.fs << "OBJECT " << s_type->GetName();
if (base->id)
*data.fs << "\nID " << base->id;
base->Serialize(data);
s_type->Serialize(base, data);
*data.fs << "\nEND\n";
}
+4 -6
View File
@@ -145,7 +145,7 @@ public:
else
{
Data data;
obj->Serialize(data);
t->Serialize(obj, data);
if (obj->IsCached(data))
return;
@@ -402,7 +402,7 @@ void Updater::OnResult(const Reply &r)
}
Data data;
obj->Serialize(data);
st->Serialize(obj, data);
/* Transaction start */
me->redis->StartTransaction();
@@ -526,8 +526,7 @@ void SubscriptionListener::OnResult(const Reply &r)
Log(LOG_DEBUG) << "redis: notify: deleting object id " << obj_id << " of type " << type;
Data data;
s->Serialize(data);
s_type->Serialize(s, data);
/* Transaction start */
me->redis->StartTransaction();
@@ -578,8 +577,7 @@ void ModifiedObject::OnResult(const Reply &r)
if (obj)
{
Data data;
obj->Serialize(data);
st->Serialize(obj, data);
for (auto &[key, value] : data.data)
{
+6 -6
View File
@@ -113,8 +113,12 @@ public:
{
if (this->sql)
{
Serialize::Type *s_type = obj->GetSerializableType();
if (!s_type)
continue;
Data data;
obj->Serialize(data);
s_type->Serialize(obj, data);
if (obj->IsCached(data))
continue;
@@ -125,10 +129,6 @@ public:
if (!this->loaded && !this->imported && !this->import)
continue;
Serialize::Type *s_type = obj->GetSerializableType();
if (!s_type)
continue;
auto create = this->sql->CreateTable(GetTableName(s_type), data);
auto insert = this->sql->BuildInsert(GetTableName(s_type), obj->id, data);
@@ -267,7 +267,7 @@ public:
*/
Data data2;
obj->Serialize(data2);
sb->Serialize(obj, data2);
obj->UpdateCache(data2); /* We know this is the most up to date copy */
}
}
+6 -6
View File
@@ -93,18 +93,18 @@ public:
{
if (obj && this->SQL)
{
Serialize::Type *s_type = obj->GetSerializableType();
if (!s_type)
continue;
Data data;
obj->Serialize(data);
s_type->Serialize(obj, data);
if (obj->IsCached(data))
continue;
obj->UpdateCache(data);
Serialize::Type *s_type = obj->GetSerializableType();
if (!s_type)
continue;
auto create = this->SQL->CreateTable(GetTableName(s_type), data);
for (const auto &query : create)
this->RunQuery(query);
@@ -232,7 +232,7 @@ public:
*/
Data data2;
new_s->Serialize(data2);
obj->Serialize(new_s, data2);
new_s->UpdateCache(data2); /* We know this is the most up to date copy */
}
}