Callback during sync for Hazaar\File\Dir #203

Closed
opened 2020-09-29 07:41:06 +00:00 by jamie · 3 comments
jamie commented 2020-09-29 07:41:06 +00:00 (Migrated from git.hazaar.io)

Problem

The Hazaar\File\Dir class has a sync function that will sync files from one directory to another. This works across media backends as well. Because of this, the process an take some time and may be prone to communications errors on remote storage backends such as Dropbox and SharePoint.

Solution

To help eleviate these issues and allow a bit more customisation when using the sync function, I would like to be able to supply a callback function as an argument. This callback is triggered for various events such as file copy start/finish, dir copy start/finish and any errors. The callback can also be passed the source/target file/directory as well as the exception/error that occurred. The reason we wouldn't want to throw an exception internally is because we may want to carry on copying files even if an error occurs, or even get the sync to retry.

Returns

  • true, null or void - Everything is fine and the sync should carry on.
  • false - Then the sync did something wrong and should retry.
**Problem** The `Hazaar\File\Dir` class has a `sync` function that will sync files from one directory to another. This works across media backends as well. Because of this, the process an take some time and may be prone to communications errors on remote storage backends such as Dropbox and SharePoint. **Solution** To help eleviate these issues and allow a bit more customisation when using the sync function, I would like to be able to supply a callback function as an argument. This callback is triggered for various events such as file copy start/finish, dir copy start/finish and any errors. The callback can also be passed the source/target file/directory as well as the exception/error that occurred. The reason we wouldn't want to throw an exception internally is because we may want to carry on copying files even if an error occurs, or even get the sync to retry. **Returns** * `true`, `null` or `void` - Everything is fine and the sync should carry on. * `false` - Then the sync did something wrong and should retry.
jamie commented 2020-09-29 07:41:10 +00:00 (Migrated from git.hazaar.io)

created merge request !96 to address this issue

created merge request !96 to address this issue
jamie commented 2020-09-29 07:41:10 +00:00 (Migrated from git.hazaar.io)

mentioned in merge request !96

mentioned in merge request !96
jamie commented 2020-09-30 06:48:56 +00:00 (Migrated from git.hazaar.io)

mentioned in commit c3634dffbb3e4645423f28b9f90d4d6dc48cb374

mentioned in commit c3634dffbb3e4645423f28b9f90d4d6dc48cb374
jamie (Migrated from git.hazaar.io) closed this issue 2020-09-30 06:48:56 +00:00
jamie self-assigned this 2025-09-04 01:15:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/framework#203
No description provided.