Skip to content

Commit

Permalink
Merge pull request #5441 from phil-davis/gs_review
Browse files Browse the repository at this point in the history
Suggestions for comments
  • Loading branch information
mrow4a authored Jan 9, 2017
2 parents 3701299 + bc5f7d4 commit fa5eb85
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions src/libsync/owncloudpropagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ quint64 OwncloudPropagator::chunkSize()

quint64 OwncloudPropagator::smallFileSize()
{
// Small filesize item is the file which transfer time
// typicaly will be lower than its bookkeping time.
// A small filesize item is a file whose transfer time
// typically will be lower than its bookkeeping time.
static uint smallFileSize;
if (!smallFileSize) {
smallFileSize = qgetenv("OWNCLOUD_SMALLFILE_SIZE").toUInt();
Expand Down Expand Up @@ -629,7 +629,7 @@ PropagatorJob::JobParallelism PropagateDirectory::parallelism()

void PropagateDirectory::append(PropagatorJob *subJob) {
if (!subJob->isJobsContainer()){
// This is standard job, so increase global counter
// This is a standard job, so increase global counter
_propagator->_standardJobsCount++;
}
_subJobs.append(subJob);
Expand All @@ -645,7 +645,7 @@ bool PropagateDirectory::scheduleNextJob()
_state = Running;

if(_filesJob){
// PropagateFiles is not a standard job, since it is abstract object
// PropagateFiles is not a standard job, since it is an abstract object
PropagateFiles* files = qobject_cast<PropagateFiles*>(_filesJob.take());
append(files);
}
Expand All @@ -655,7 +655,7 @@ bool PropagateDirectory::scheduleNextJob()
return true;
}

// At the begining of the Directory Job, update expected number of Jobs to be synced
// At the beginning of the Directory Job, update the expected number of Jobs to be synced
_totalJobs = _subJobs.count();
if (_firstJob) {
// _firstJob is a standard job, since it does interact with server
Expand All @@ -679,15 +679,15 @@ bool PropagateDirectory::scheduleNextJob()

while (subJobsIterator.hasNext()) {
subJobsIterator.next();
// Get the state of the sub job pointed by call next()
// Get the state of the sub job pointed at by call next()
if (subJobsIterator.value()->_state == Finished) {
// If this items is finished, remove it from the _subJobs as it is not needed anymore
// If this item is finished, remove it from _subJobs as it is not needed anymore
// Note that in this case remove() from QVector will just perform memmove of pointer array items.
PropagatorJob * job = subJobsIterator.value();
subJobsIterator.remove();

// Delete only containers now, we need items in slotSubJobFinished
// Items will be deleted when one will call delete on parent container later
// Items will be deleted later when one of them calls delete on the parent container
if (job->isJobsContainer()){
delete job;
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/libsync/owncloudpropagator.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class PropagatorJob : public QObject {
virtual qint64 committedDiskSpace() const { return 0; }

/**
* As in the description, this class can be job or job container
* This flag will allow to detect it
* As in the description, this class can be a job or job container.
* This flag will allow it to be detected.
*/
virtual bool isJobsContainer() const { return false; }

Expand Down Expand Up @@ -321,7 +321,7 @@ class OwncloudPropagator : public QObject {
*/
QList<PropagateItemJob*> _activeJobList;
qint8 _activeDBJobs; // number of active DB jobs running
qint64 _dbJobsCount; // number of all jobs in which db operations are major factor
qint64 _dbJobsCount; // number of all jobs in which db operations are a major factor
qint64 _standardJobsCount; // number of all jobs which are rare or in which db operations are not a major factor

/** We detected that another sync is required after this one */
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/propagateupload.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ private slots:
class PropagateFiles : public PropagatorJob {
Q_OBJECT
public:
// all the sub files which are equal or smaller _propagator->smallFileSize()
// all the sub files which are equal to or smaller than _propagator->smallFileSize()
QVector<PropagatorJob *> _dbJobs;

// all the sub files which are over _propagator->smallFileSize()
Expand Down
20 changes: 10 additions & 10 deletions src/libsync/propagateuploadbundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ void PropagateFiles::append(PropagateItemJob* subJob) {
}

void PropagateFiles::append(const SyncFileItemPtr &item) {
// In case of bundles, in here we should append BundledUpload jobs with new files to the .top() of _subJobs until reached chunking size
// Role of this class is also to control how much data is going into the container class
// In case of bundles, in here we should append BundledUpload jobs with new files to the .top() of _subJobs until chunking size is reached.
// The role of this class is also to control how much data is going into the container class.
// In version 1.0 append just PUTs

Q_ASSERT((item->_size <= _propagator->chunkSize() && item->_direction == SyncFileItem::Up));
PropagateUploadFileV1* subJob = new PropagateUploadFileV1(_propagator, item);
if (item->_size <= _propagator->smallFileSize()){
_propagator->_dbJobsCount++; // This item db operations take considerably longer then any other factors.
_propagator->_dbJobsCount++; // Db operations for this item take considerably longer then any other factors.
_dbJobs.append(subJob);
} else {
_propagator->_standardJobsCount++; // This item is not a small upload file, so it is standard
Expand All @@ -56,14 +56,14 @@ bool PropagateFiles::scheduleNextJobRoutine(QVector<PropagatorJob *> &subJobs) {
QMutableVectorIterator<PropagatorJob *> subJobsIterator(subJobs);
while (subJobsIterator.hasNext()) {
subJobsIterator.next();
// Get the state of the sub job pointed by call next()
// Get the state of the sub job pointed at by call next()
if (subJobsIterator.value()->_state == Finished) {
// If this items is finish, remove it from the _subJobs list as it is not needed anymore
// If this items is finished, remove it from the _subJobs list as it is not needed anymore
// Note that in this case remove() from QVector will just perform memmove of pointer array items.
PropagatorJob * job = subJobsIterator.value();
subJobsIterator.remove();

// In this case de dont delete job, but save it in _finishedSubJobs queue
// In this case de dont delete the job, but save it in the _finishedSubJobs queue
// We might need this job in slotSubJobFinished
// The PropagateFiles class will be destroyed in PropagateDirectory
// when it will detect that we finished PropagateFiles
Expand Down Expand Up @@ -94,11 +94,11 @@ bool PropagateFiles::scheduleNextJob()
return true;
}

// At the begining of the Directory Job, update expected number of Jobs to be synced
// At the beginning of the Directory Job, update the expected number of Jobs to be synced
_totalJobs = _standardJobs.count() + _dbJobs.count();
}

// Check if there are standard jobs in whole sync waiting for sync or pending
// Check if there are standard jobs in the whole sync waiting for sync or pending
if (_propagator->_standardJobsCount > 0){
// Check if there are already some dbJobs running
if(_propagator->_activeDBJobs > 0){
Expand All @@ -114,14 +114,14 @@ bool PropagateFiles::scheduleNextJob()
// This container does not contain any remaining dbJobs
if(_runningNow > 1){
// There are some jobs running in this container,
// but for sure not dbJobs, search in different container for db jobs
// but they are not dbJobs, so search in a different container for db jobs
return false;
}
return scheduleNextJobRoutine(_standardJobs);
}
}
} else {
// There are no remaining or pending standard jobs in whole sync
// There are no remaining or pending standard jobs in the whole sync
// This also means that _standardJobs is empty
Q_ASSERT(!scheduleNextJobRoutine(_standardJobs));

Expand Down

0 comments on commit fa5eb85

Please sign in to comment.