aboutsummaryrefslogtreecommitdiff
path: root/jobs/syncjob.cpp
AgeCommit message (Collapse)Author
2017-10-14Make JoinState (de)serializable library-wideKitsune Ral
2017-10-13All jobs: Drop ConnectionData parameter from the constructorKitsune Ral
Having to pass ConnectionData to each and every job class was nothing but boilerplate since the very beginning. Removing it required to prepend BaseJob::start() with ConnectionData-setting code, and to provide a way to alter the request configuration depending on the (late-coming) ConnectionData object. This is a new responsibility of BaseJob::start(); the previous BaseJob::start() contents have moved to BaseJob::sendRequest() (which is now invoked on retries, instead of start()).
2017-09-21Merge branch 'master' into kitsune-invite-kickKitsune Ral
2017-09-20Minor optimisations in sync data parsingKitsune Ral
2017-09-09Kicking, inviting, exposing rooms in Invite stateKitsune Ral
Kicking and inviting use generated job classes. Rooms in Invite state are stored separately in the hash from those in Join/Leave state because The Spec says so. For clients, this means that the same room may appear twice in the rooms map if it's been left and then the user was again invited to it. The code in Quaternion that properly processes this will arrive shortly.
2017-09-04Use SyncJob::SyncData as a plain memberRoman Plášil
2017-09-03More fixesRoman Plášil
2017-09-02Use status return type for parseJsonRoman Plášil
2017-08-16Implement saving save to enable incremental sync even after shutdownRoman Plášil
2017-05-22Refactored EventsKitsune Ral
The biggest change is we have no pimpls in Event objects anymore - because it's two new's instead of one per Event, and we have thousands and even more of Events created during initial sync. The other big change is introduction of RoomEvent, so that now the structure of events almost precisely reflects the CS API spec. The refactoring made UnknownEvent unnecessary as a separate class; a respective base class (either RoomEvent or Event) is used for this purpose now. All the other changes are consequences of these (mostly of RoomEvent introduction).
2017-05-13More code cleanup and tweaks; fine-tuning logs; performance improvementsKitsune Ral
After adding some profiling it became clear that to recalculate the room name and emit namesChanged() upon each member event is a waste, especially when there are thousands of those coming at initial sync (*cough* Matrix HQ room). So the room name is recalculated only once and unconditionally (in most cases this will boil down to checking whether name/canonicalAlias changed after processing the events batch), and namesChanged is only emitted once per batch, if any name or alias changed.
2017-05-13Refactored logging enhancementsKitsune Ral
logging.h/logging.cpp is now a full-fledged pair for all things logging. Two more categories added, EPHEMERAL and SYNCJOB, that control logging for ephemeral events and SyncJob, respectively (in particular, switching off EPHEMERAL greatly reduces the logspam about moving read markers and how many users have read up to which event).
2017-05-09Code cleanup and tweaking (partially driven by clang-tidy)Kitsune Ral
Mainly it's about const-ification (in particular, passing const-refs instead of values) and deleting unneeded declarations/#includes. Since the changes alter the external interface, this is submitted as a PR for peer review. One of unneeded declarations/definitions is a virtual destructor in BaseJob descendants. Since a job object should be deleted through QObject::deleteLater() anyway (and it's the only correct way of disposing of the object), all deletions will call the stack of destructors through virtual QObject::~QObject(). Therefore even BaseJob could get on with a non-virtual destructor but for the sake of clarity BaseJob::~BaseJob() is still declared virtual.
2017-04-30Port to categorized loggingElvis Angelaccio
This greatly reduces the noise made by quaternion. To enable full logging, export the following variable: QT_LOGGING_RULES="libqmatrixclient.*.debug=true"
2017-04-02Renamed JobHttpType to more fitting HttpVerb; removed Job from enum valuesKitsune Ral
2017-03-25Jobs retry on network and timeout errorsKitsune Ral
As of now, the retry logic (see BaseJob::finishJob() method) invokes the same network request several times with increasing timeouts and retry intervals. Some additional signals and accessors are also provided to control the behaviour from inheriting classes (see a notable example with SyncJob in the same commit) and clients (support of retries in Quaternion comes in a respective commit shortly).
2017-02-28Renamed logging_util.h to util.h and moved (improved) Owning<> and lookup() ↵Kitsune Ral
there Because these fall outside of SyncJob and Event context, respectively. In addition, Owning<> has gained a move assignment operator (because we have a move constructor) and assign() convenience method to take ownership over an existing container; also, Owning<>::release() is done the right way now (the previous version was copying the return value to a new container instead of releasing the old container).
2016-11-01Removed unused #includesKitsune Ral
2016-10-17Changed the order of arguments in SyncJob::SyncJob()Kitsune Ral
2016-10-15BaseJob: Use saved parameters instead of overriding apiPath(), query() and ↵Kitsune Ral
data() in each job class
2016-10-07Fixed massive leaks of Event objectsKitsune Ral
2016-08-31QList<Event*> -> using Events=QVector<Event*>Kitsune Ral
2016-08-23Merge pull request #18 from Fxrh/kitsune-use-qvector-with-nonpointersFelix Rohrbach
Replaced QList<> with QVector<> where appropriate + minor code cleanup
2016-08-22Replaced QList<> with QVector<> where appropriate + minor code cleanupKitsune Ral
See https://marcmutz.wordpress.com/effective-qt/containers/ for the background and http://lists.qt-project.org/pipermail/development/2015-July/022283.html for the relevant flamewar in Qt dev mailing list.
2016-07-27Introduce Status class + BaseJob::{checkReply,parseReply,parseJson} now ↵Kitsune Ral
return it This better fixes the contract for derived job classes and simplifies error reporting. Methods error() and errorString() are kept for back-compatibility; status() returns a combination of them, conveniently packed into a Status object. For a quick status check, Status::good() is provided.
2016-07-26Log creation/deletion of jobs (especially SyncJob)Kitsune Ral
Due to signal-slot processing it's not obvious when exactly each job object is deleted.
2016-05-27Use 'override' keyword throughout job classes; constify apiPath(), query(), ↵Kitsune Ral
data() Thanks to CLang model.
2016-05-27Set the object name for each job, to make it clear which job has failedKitsune Ral
And we don't need two log lines for timeouts.
2016-05-26Load a different set of event lists depending on the join state (and ↵Kitsune Ral
actually introduce EventList class) This makes loading of room events more compliant with the spec, not trying to load from keys that are not supposed to be there. As a result of refactoring along the way, a dedicated QList<Event*> subclass is made that remembers the JSON key it should load from and actually load itself from a QJsonArray.
2016-04-05Imported the current source tree from Quaternion/lib.Kitsune Ral