Code Monkey home page Code Monkey logo

nesync's People

Contributors

fxdeniz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nesync's Issues

Add moved folder to table view

When adding row to the table

  1. Check whether folder exist (by old folder name) in db
    1. If file exist in db
    2. If file is not exist
      • Ignore file

poc-1 Refactoring

  • Replace hard-coded column indexes of table models with named constants
  • Modularize DialogAddNewFile::on_buttonSelectNewFile_clicked() if possible
  • Create repository class for color code constants
  • Move UI related code into separate method in every window (MainWindow, Dialog or Tab)
  • #26
  • Provide factory method for TableModelNewAddedFiles::TableItem
  • #47
  • #48
  • #67
  • #66
  • #82

[poc_uc-1] Add new file

Provide a way to user for adding new file into system.

Steps of use case

  1. Open dialog and allow user for selecting file which is about be added into db.

    • fxdeniz/XdBackup#3
    • fxdeniz/XdBackup#5
    • When adding new file check for these cases:
    • #6
    • #7
    • #8
    • #9
    • #10
  2. Addition must be done through background task

  3. If addition successful:

  4. If addition failed:

  5. Group added files

[poc_uc-2] Add new folder

Steps of use case

  1. Open dialog and allow user to enter name of new folder

  • When adding new folder check for these cases:
  1. If new folder added successfully:

  2. If new folder adding failed:

Add moved files to table view

When adding row to the table

  1. Check whether file exist (by old file name) in db
    1. If file exist in db
    2. If file is not exist
      • Ignore file

Run linting tools in every part of the project at the end of poc-1

Run clang tools for linting. Messages from these tools were ignored at the beginning. Warnings must be handled comprehensively.

Few warnings I remember:

  • FileStorageManager.cpp gives warning in range based for loops. It's related with reference counting when accessing smart pointers.

`FileStorageManager` consumes high memory when hashing

This happens whenever FileStorageManager::addUnRegisteredFile() is called.
Memory consumption is related with file size.
Problems comes from this statement QString fileHash = this->getHashOf(sourceFile.readAll()); call to sourceFile.readAll() must be replaced something more efficent.

[poc_uc-4] Display file events

Steps of use case:

  1. FileMonitoringManager have to receive paths to files from FileStorageManager

  2. When file event occurred, this event should be listed in table view of File Monitor
    Some types of events may require these checks from database.

    There are few type of events that can be displayed:

    1. When file from prediction list not found in user's file system:
    2. When unpredicted folder detected in user's file system:
    3. When unpredicted file detected in user's file system:
    4. When user created folder in user's file system:
    5. When user created file in user's file system:
    6. When user deleted folder in user's file system:
    7. When user deleted file in user's file system:
    8. When user moved (including renaming) folder in user's file system:
    9. When user moved (including renaming) file in user's file system:
    10. When user modified file in user's file system:
    11. When user modified and moved (or vice versa) file in user's file system:
  3. After each event, table view should be refreshed

[poc_uc-3] File explorer navigation

Steps of use case:

  1. All request to back-end must be done through always running background task

    • Task must provide interface for getting path list to files and folders contained in given directory
  2. File explorer must start root folder opened

  3. File explorer must allow user viewing user content

  4. User must navigate using back and forward buttons

`FileMonitoringManager::addTargetsFromPredictionList()` has logic error for missing predicted items

FileMonitoringManager::addTargetsFromPredictionList() designed to emit some signals, when item from prediction list is not exist on user file system. These signals are:

  • signalPredictedFileNotFound()
  • signalPredictedFolderNotFound()

And pseudo code for catching this scenario is here:

QFileInfo info(currentPath);

if(info.isFile())  --------------->   // Check 1
{
    if(info.exists())
        processFile();
   else
        emit signalPredictedFileNotFound(currentPath);
}
else if(info.isDir())  --------------->   // Check 2
{
    if(info.exists())
        processDir();
    else
        emit signalPredictedFolderNotFound(currentPath);
}
else --------------->   // Else condition
    emit signalPredictionTargetNotRecognized(currentPath);

But this logic has an error. That is, we first need to check whether QFileInfo info(currentPath) exist or not. Then, we need to run Check 1 and Check 2. When QFileInfo info(currentPath) not exist, Check 1 and Check 2 always fails. And this makes, signalPredictedFileNotFound() and signalPredictedFolderNotFound() invalid. Since they are never going to be emitted.

New logic should be:

QFileInfo info(currentPath);

if(info.exist())
{
    if(info.isFile())  --------------->   // Check 1
        processFile();
    else if(info.isDir())  --------------->   // Check 2
        processDir();
}
else --------------->   // Else condition
    emit signalPredictionTargetNotRecognized(currentPath);

Therefore, these signals are unnecessary:

  • signalPredictedFileNotFound()
  • signalPredictedFolderNotFound()

typo in `RowInserter::insertFileVersion()` causes instability

There is a typo in the first line of this function which is QSqlQuery query(this->getTableName()); typo is this->getTableName() it should be replaced with this->getDb()

This was a very subtle yet critical bug. It went under radar until FileStorageManager used in multi-threaded context.

I encountered very weird bugs and debug messages such as "Database driver is not loaded". LoL

Underlying problem was that, when FileStorageManager run in a multi-threaded environment, every connection requires unique name. But this typo caused database dependency to not properly delivered to RowInserter instance. As a result, QSqlQuery used fallback mechanism to use default connection. But, there was no default connection.

It was a very critical bug, caused unexplained catastrophic failures in the system.
Now it's solved.

[Insert more coffee here for sleepless nights]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.