Synchronize remote linked notebooks
| 640 | |
| 641 | // Synchronize remote linked notebooks |
| 642 | bool SyncRunner::syncRemoteLinkedNotebooksActual() { |
| 643 | QLOG_TRACE_IN(); |
| 644 | LinkedNotebookTable ltable(db); |
| 645 | QList<qint32> lids; |
| 646 | ltable.getAll(lids); |
| 647 | bool fs; |
| 648 | for (int i=0; i<lids.size(); i++) { |
| 649 | LinkedNotebook book; |
| 650 | qint32 usn = ltable.getLastUpdateSequenceNumber(lids[i]); |
| 651 | qint32 startingUSN = usn; |
| 652 | ltable.get(book, lids[i]); |
| 653 | int chunkSize = 5000; |
| 654 | |
| 655 | // If the share key is set, we need to authenticate |
| 656 | if (!comm->authenticateToLinkedNotebookShard(book)) { |
| 657 | |
| 658 | // If we can't authenticate, we just gid of the notebook |
| 659 | // because the user probably stopped sharing. |
| 660 | qint32 linkedLid=0; |
| 661 | LinkedNotebookTable ntable(db); |
| 662 | linkedLid = ntable.getLid(book.guid); |
| 663 | ntable.expunge(book.guid); |
| 664 | emit notebookExpunged(linkedLid); |
| 665 | return true; |
| 666 | |
| 667 | //this->communicationErrorHandler(); |
| 668 | //error = true; |
| 669 | //return false; |
| 670 | } |
| 671 | bool more = true; |
| 672 | SyncState syncState; |
| 673 | if (!comm->getLinkedNotebookSyncState(syncState, book)) { |
| 674 | this->communicationErrorHandler(); |
| 675 | error = true; |
| 676 | return false; |
| 677 | } |
| 678 | if (syncState.updateCount <= usn) |
| 679 | more=false; |
| 680 | qint32 startingSequenceNumber = usn; |
| 681 | if (usn == 0) |
| 682 | fs = true; |
| 683 | else |
| 684 | fs = false; |
| 685 | |
| 686 | |
| 687 | // ***** STARTING PASS #1 |
| 688 | while (more && keepRunning) { |
| 689 | SyncChunk chunk; |
| 690 | if (!comm->getLinkedNotebookSyncChunk(chunk, book, usn, chunkSize, fs)) { |
| 691 | more = false; |
| 692 | if (comm->error.type == CommunicationError::EDAMNotFoundException) { |
| 693 | ltable.expunge(lids[i]); |
| 694 | if (!finalSync) |
| 695 | emit(notebookExpunged(lids[i])); |
| 696 | } else { |
| 697 | this->communicationErrorHandler(); |
| 698 | error = true; |
| 699 | QLOG_TRACE_OUT(); |
nothing calls this directly
no test coverage detected