File synchronization method, apparatus, device, storage medium, and program product

By identifying target file events in the source device and synchronizing the files, the problem of low file synchronization reliability is solved, and the reliability and consistency of file transfer are achieved.

CN115658631BActive Publication Date: 2026-07-03CHINA CONSTRUCTION BANK +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2022-11-07
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In existing technologies, when a source device synchronizes files to a target device, a large number of files can lead to file loss, resulting in low reliability of file synchronization.

Method used

By obtaining the resource quantity and remaining resource quantity of file events from the source device, the target file event is determined, and the target file event is executed to synchronize the file with the target device, thus avoiding transmission failures caused by excessively large files.

Benefits of technology

It improves the reliability of file synchronization, avoids file transfer failures, and ensures that files remain consistent between the target device and the source device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115658631B_ABST
    Figure CN115658631B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a file synchronization method, device, equipment, storage medium and program product, and belong to the field of data processing. The method comprises: obtaining at least one file event in a source device in a preset storage space, the file event comprising at least one of the following: a new file event, a deleted file event, an updated file event and a file transmission interruption event; obtaining a resource amount required by each file event in the source device and a resource remaining amount of the source device; determining a target file event in the at least one file event according to the resource remaining amount and the resource amount required by each file event; and executing the target file event to synchronize the file in the source device to a target device. The reliability of file synchronization is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more particularly to a file synchronization method, apparatus, device, storage medium, and program product. Background Technology

[0002] Files on the source device (file storage device) may be lost due to various disasters and emergencies. To prevent file loss, backup management of the file data on the source device can be implemented.

[0003] In related technologies, a target device can be set for the source device, and updated files in the source device can be periodically synchronized to the target device to ensure that the files in the target device are identical to those in the source device. However, if a large number of files are sent from the source device to the target device, file loss may occur, resulting in low reliability of file synchronization. Summary of the Invention

[0004] This application provides a file synchronization method, apparatus, device, storage medium, and program product to solve the problem of low reliability in file synchronization.

[0005] In a first aspect, embodiments of this application provide a file synchronization method applied to a source device, the method comprising:

[0006] At least one file event from the source device is obtained in the preset storage space, and the file event includes at least one of the following: file addition event, file deletion event, file update event, and file transfer interruption event;

[0007] Obtain the amount of resources required for each file event in the source device, and the remaining resources of the source device;

[0008] Based on the remaining resource amount and the resource amount required by each file event, determine the target file event from the at least one file event;

[0009] Execute the target file event to synchronize the files in the source device to the target device.

[0010] In one possible implementation, determining a target file event from the at least one file event based on the remaining resources of the source device and the resource requirements of each file event includes:

[0011] Based on the remaining resources and the resources required for each file event, a candidate file event is determined from the at least one file event, wherein the resources required for the candidate file event are less than the remaining resources;

[0012] The target file event is determined from the candidate file events based on the remaining resource amount and the resource amount required by the candidate file events.

[0013] In one possible implementation, determining the target file event from the candidate file events based on the remaining resource amount and the resource amount required by the candidate file events includes:

[0014] The candidate file events are sorted in descending order of the required resource amount;

[0015] The first N candidate file events are determined as the target file events; wherein N is an integer greater than or equal to 1, the total amount of resources required by the first N candidate file events is less than the remaining amount of resources, and the total amount of resources required by the first N+1 candidate file events is greater than the remaining amount of resources.

[0016] In one possible implementation, the source device is equipped with a monitoring program; before acquiring at least one file event from the source device in a preset storage space, the program further includes:

[0017] Determine the preset monitoring path;

[0018] The monitoring program detects files in the preset monitoring path, and generates at least one file event when a file in the preset monitoring path changes.

[0019] Store the at least one file event in the preset storage space.

[0020] In one possible implementation, the source device is provided with a synchronization program; executing the target file event to synchronize files in the source device to the target device includes:

[0021] If the target file event is a new file, an updated file, or a file transfer interruption event, then the target file corresponding to the target file event is obtained through the synchronization program, and the target file is sent to the target device;

[0022] If the target file event is a file deletion event, the synchronization program determines the target file name corresponding to the target file event and sends the target file name to the target device so that the target device deletes the file corresponding to the target file name.

[0023] In one possible implementation, the target file event is a file transfer interruption event; obtaining the target file corresponding to the target file event through the synchronization program includes:

[0024] The synchronization program obtains the file transfer progress, first file identifier, and file storage location in the target file event;

[0025] The synchronization program retrieves the first file from the file storage location based on the first file identifier.

[0026] The target file is determined in the first file according to the transmission progress through the synchronization program.

[0027] Secondly, embodiments of this application provide a file synchronization device applied to a source device. The device includes: a first acquisition module, a second acquisition module, a first determination module, and a synchronization module, wherein...

[0028] The first acquisition module is used to acquire at least one file event from the source device in a preset storage space, the file event including at least one of the following: a file addition event, a file deletion event, a file update event, and a file transfer interruption event;

[0029] The second acquisition module is used to acquire the amount of resources required for each file event in the source device, and the amount of resources remaining in the source device;

[0030] The first determining module is used to determine the target file event among the at least one file event based on the remaining resource amount and the resource amount required by each file event;

[0031] The synchronization module is used to execute the target file event to synchronize the files in the source device to the target device.

[0032] In one possible implementation, the first determining module is specifically used for:

[0033] Based on the remaining resources and the resources required for each file event, a candidate file event is determined from the at least one file event, wherein the resources required for the candidate file event are less than the remaining resources;

[0034] The target file event is determined from the candidate file events based on the remaining resource amount and the resource amount required by the candidate file events.

[0035] In one possible implementation, the first determining module is specifically used for:

[0036] The candidate file events are sorted in descending order of the required resource amount;

[0037] The first N candidate file events are determined as the target file events; wherein N is an integer greater than or equal to 1, the total amount of resources required by the first N candidate file events is less than the remaining amount of resources, and the total amount of resources required by the first N+1 candidate file events is greater than the remaining amount of resources.

[0038] In one possible implementation, the source device is equipped with a monitoring program; the device further includes a second determining module, a generating module, and a storage module:

[0039] The second determining module is used to determine the preset monitoring path;

[0040] The generation module is used to detect files in the preset monitoring path through the monitoring program, and generate at least one file event when a file in the preset monitoring path changes.

[0041] The storage module is used to store the at least one file event to the preset storage space.

[0042] In one possible implementation, the source device is provided with a synchronization program, and the synchronization module has functions for:

[0043] If the target file event is a new file, an updated file, or a file transfer interruption event, then the target file corresponding to the target file event is obtained through the synchronization program, and the target file is sent to the target device;

[0044] If the target file event is a file deletion event, the synchronization program determines the target file name corresponding to the target file event and sends the target file name to the target device so that the target device deletes the file corresponding to the target file name.

[0045] In one possible implementation, the target file event is a transmission interruption event, and the synchronization module has the following functions:

[0046] The synchronization program obtains the file transfer progress, first file identifier, and file storage location in the target file event;

[0047] The synchronization program retrieves the first file from the file storage location based on the first file identifier.

[0048] The target file is determined in the first file according to the transmission progress through the synchronization program.

[0049] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0050] The memory stores computer-executed instructions;

[0051] The processor executes computer execution instructions stored in the memory, causing the processor to perform the file synchronization method described in any of the first aspects.

[0052] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the file synchronization method described in any of the first aspects.

[0053] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the file synchronization method shown in any of the first aspects.

[0054] This application provides a file synchronization method, apparatus, device, storage medium, and program product. After obtaining at least one file event from a source device in a preset storage space, it can obtain the resource amount required for each file event in the source device and the remaining resource amount of the source device. Based on the remaining resource amount and the resource amount required for each file event, a target file event can be determined from at least one file event. After executing the target file event, files in the source device can be synchronized to the target device. Since the target file event can be determined based on the resource amount required for each file event in the source device and the remaining resource amount of the source device to synchronize files to the target device, file transmission failure due to excessively large files is avoided, thus improving the reliability of file synchronization. Attached Figure Description

[0055] Figure 1 A schematic diagram illustrating the application scenarios provided in the embodiments of this application;

[0056] Figure 2 A flowchart illustrating the file synchronization method provided in this application embodiment;

[0057] Figure 3 A flowchart illustrating another file synchronization method provided for embodiments of this application;

[0058] Figure 4 The present application provides a schematic diagram of the structure of a file synchronization device.

[0059] Figure 5 A schematic diagram of another file synchronization device provided in the embodiments of this application;

[0060] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0061] Figure 1 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application. Please refer to [link / reference]. Figure 1 This includes source device 101 and target device 102.

[0062] Source device 101 can store files and monitor them in real time. When a file stored in source device 101 changes (e.g., is added, deleted, or updated), a corresponding file event is generated, indicating the change. Source device 101 can execute file events to synchronize files in source device 101 to target device 102, ensuring that the files in target device 102 are consistent with those in source device 101.

[0063] In related technologies, updated files on the source device are typically synchronized to the target device periodically to ensure that the files on the target device are identical to those on the source device. However, if a large number of files are sent from the source device to the target device, file loss may occur, resulting in low reliability of file synchronization.

[0064] In this embodiment, after obtaining file events from the source device, the target file events to be synchronized can be determined based on the resource requirements of each file event and the remaining resources of the source device, and then synchronized from the source device to the target device. In this process, the target file events to be synchronized can be determined based on the remaining resources of the source device, avoiding file transfer failures due to excessively large files and improving the reliability of file synchronization.

[0065] The method described in this application will now be illustrated through specific embodiments. It should be noted that the following embodiments may exist independently or in combination with each other; identical or similar content will not be repeated in different embodiments.

[0066] Figure 2 This is a flowchart illustrating the file synchronization method provided in an embodiment of this application. Please refer to... Figure 2 The method may include:

[0067] S201. Obtain at least one file event from the source device in the preset storage space.

[0068] The execution entity in this application embodiment can be a source device or a file synchronization device installed in the source device. The file synchronization device can be implemented by software or by a combination of software and hardware.

[0069] The source device has a preset storage space where file events can be stored. This preset storage space can include file events, file identifiers corresponding to the file events, and the file storage location corresponding to the file events.

[0070] When the storage state of a file changes on the source device, or when file transfer fails, a corresponding file event is generated. File events can include at least one of the following: file creation event, file deletion event, file update event, and file transfer interruption event.

[0071] For example, if a new file 1 is added to the source device, a file event 1 corresponding to file 1 can be generated and stored in a preset storage space.

[0072] For example, the preset storage space can be as shown in Table 1.

[0073] Table 1

[0074] Event identifier Event Types File Identifier File storage location File event 1 New type File Identifier 1 File storage location 1 File event 2 Deletion type Document Identifier 2 File storage location 2 File event 2 Update type Document Identifier 3 File storage location 3 …… …… ……

[0075] S202. Obtain the amount of resources required for each file event in the source device, as well as the remaining resources of the source device.

[0076] The resources required for a file event include: the amount of central processing unit (CPU) usage, memory usage, and network bandwidth usage required to execute the file event.

[0077] Different types of file events require different amounts of resources. For example, delete file events require fewer resources, while add or update file events require more. For add or update file events, the larger the file to be transferred, the more resources are required to execute that file event.

[0078] The remaining resources of the source device include: the remaining CPU resources, memory resources, and network bandwidth resources of the source device.

[0079] S203. Based on the remaining resources and the resources required by each file event, determine the target file event in at least one file event.

[0080] The target file event can be determined as follows: Based on the remaining resources and the resources required by each file event, select candidate file events from at least one file event, where the resources required by the candidate file events are less than the remaining resources; and then determine the target file event from the candidate file events based on the remaining resources and the resources required by the candidate file events.

[0081] File events whose resource requirements are less than the available resources can be identified as candidate file events. For example, suppose there are 5 file events: file event 1, file event 2, file event 3, file event 4, and file event 5, and the resource requirements for each file event are shown in Table 2.

[0082] Table 2

[0083] File events resource quantity File event 1 25% File event 2 10% File event 3 30% File event 4 15% File event 5 5%

[0084] Assuming the source device has 20% of its resources remaining, the candidate file events include file event 2, file event 4, and file event 5, and the target file event is determined from file event 2, file event 4, and file event 5.

[0085] S204. Execute the target file event to synchronize files in the source device to the target device.

[0086] The target device can back up files from multiple source devices. This target device can... Figure 1 The target device 102 in the embodiment.

[0087] Files in the source device can be synchronized to the target device in the following ways: If the target file event is a file addition event, file update event, or file transfer interruption event, the target file corresponding to the target file event is obtained through the synchronization program and sent to the target device; if the target file event is a file deletion event, the target file name corresponding to the target file event is determined through the synchronization program and sent to the target device so that the target device deletes the file corresponding to the target file name.

[0088] Synchronization procedures can be set on both the source and target devices.

[0089] Optionally, the sync program can use the daemon mode of a remote sync program (Rsync).

[0090] The file synchronization method provided in this application, after acquiring at least one file event from the source device in a preset storage space, can determine a target file event from the at least one file event based on the resource requirements of each file event in the source device and the remaining resources of the source device. The target file event can then be executed to synchronize files in the source device to the target device. In this process, because the target file event can be determined based on the resource requirements of each file event in the source device and the remaining resources of the source device, file synchronization to the target device is possible, avoiding file transfer failures due to excessively large files and improving the reliability of file synchronization.

[0091] Below, in conjunction with Figure 3 The file synchronization method shown in the embodiments of this application will be further described in detail.

[0092] Figure 3 This is a flowchart illustrating the file synchronization method provided in an embodiment of this application. Please refer to... Figure 3The method may include:

[0093] S301. Determine the preset monitoring path.

[0094] The monitoring path for files or directories can be determined in the source device according to requirements.

[0095] S302. The monitoring program detects files in the preset monitoring path and generates at least one file event when a file in the preset monitoring path changes.

[0096] A monitoring program can be configured in the source device.

[0097] Optionally, the monitoring program can use the real-time monitoring tool Inotify.

[0098] Alternatively, the monitoring task can be performed using the Inotifywait command in the Inotify tool.

[0099] The monitoring program can be used to determine changes in file events, as well as to identify file identifiers and file storage locations.

[0100] S303. Store at least one file event to a preset storage space.

[0101] Optionally, the default storage space can be a Linux pipe.

[0102] For example, if a monitoring program detects a file change at a preset monitoring path, it can generate a file event and store the file event in a Linux pipe.

[0103] For example, if the files in the source device change and a new file 1 is added, then the file event 1 corresponding to the newly added file 1 can be stored in the preset storage space.

[0104] S304. Obtain at least one file event from the source device in the preset storage space.

[0105] For example, assuming that file event 1 is stored in the pre-stored storage space, file event 1 can be retrieved from the pre-stored storage space.

[0106] S305. Obtain the amount of resources required for each file event in the source device, as well as the remaining resources of the source device.

[0107] It should be noted that the execution process of S305 can be found in the execution process of S202, and will not be repeated here.

[0108] S306. Based on the remaining resources and the resources required for each file event, determine the candidate file event from at least one file event.

[0109] Among them, the amount of resources required for the candidate file event is less than the amount of resources remaining.

[0110] S307. Sort the candidate file events in descending order of the required resources. For example, suppose three candidate file events are identified as file event 2, file event 4, and file event 5, and the required resources for the three candidate file events are shown in Table 2. Then the order is file event 4, file event 2, and file event 5.

[0111] S308. Determine the first N candidate file events from the candidate file events as the target file events, where N is an integer greater than or equal to 1.

[0112] The target file event can be determined as follows: if the total amount of resources required by the first N candidate file events is less than the remaining resources, and the total amount of resources required by the first N+1 candidate file events is greater than the remaining resources, then the first N candidate file events are determined as the target file events.

[0113] For example, assuming the remaining resource is 50%, file event 1 requires 40% of the resource and file event 2 requires 30% of the resource, then file event 1 is identified as the target file event.

[0114] For example, assuming the remaining resource is 50%, file event 1 requires 30% of the resource, file event 2 requires 12%, and file event 3 requires 10%, then file event 1 and file event 2 are identified as the target file events.

[0115] S309. Determine whether the target file event is a file deletion event.

[0116] If so, then execute S310.

[0117] If not, then execute S311.

[0118] S310. The target file name corresponding to the target file event is determined through the synchronization program, and the target file name is sent to the target device so that the target device deletes the file corresponding to the target file name.

[0119] Optionally, the target device can delete the target file based on the source device name, the target file storage location, and the target file name.

[0120] S311. Determine whether the target file event is a file transfer interruption event.

[0121] If so, then execute S312-S314.

[0122] If not, then execute S315.

[0123] S312. Obtain the file transfer progress, first file identifier, and file storage location in the target file event through the synchronization program.

[0124] File transfer progress refers to the progress of file transfer corresponding to the event of the source device sending the target file to the target device. For example, if file 1 is sent to the target device and the transfer is interrupted at 30%, then the file transfer progress of file 1 is 30%.

[0125] The first file identifier refers to the identifier of the file corresponding to the target file event.

[0126] The file storage location refers to the storage location of the first file on the source device.

[0127] Based on the target file event, the corresponding file transfer progress, first file identifier, and file storage location can be obtained from the preset storage space.

[0128] S313. Obtain the first file from the file storage location through the synchronization program based on the first file identifier.

[0129] S314. Based on the file transfer progress, determine the target file in the first file through the synchronization program, and send the target file to the target device.

[0130] Optionally, based on the file transfer progress, the remaining portion of the target file can be sent from the point where the file transfer stopped. For example, assuming the file transfer progress of file 1 is 30%, the transfer of file 1 can continue from the point where the file transfer progress is 30%.

[0131] S315. Obtain the target file corresponding to the target file event through the synchronization program, and send the target file to the target device.

[0132] Optionally, if the determined target file event is an update file event, the target device, after receiving the target file, deletes the original file and stores the target file.

[0133] For example, assuming that in source device 1, the determined target file event 1 is an update file event, the corresponding target file 1 is obtained, and the target file 1 is sent to the target device. After receiving the target file 1, the target device deletes the original target file 1 and stores the received target file 1.

[0134] For example, assuming that the target file event 2 determined by the source device 1 is a new file event, the corresponding target file 2 is obtained, the target file 2 is sent to the target device, and the target device stores the target file 2 in the corresponding location.

[0135] The file synchronization method provided in this application embodiment includes a monitoring program and a synchronization program in the source device. After setting a monitoring path, the monitoring program can detect files in the preset monitoring path. When a file in the preset monitoring path changes, at least one file event is generated and stored in a preset storage space. Based on the resource requirements of each file event in the source device and the remaining resources of the source device, candidate file events are determined from at least one file event. Based on the remaining resources and the resource requirements of the candidate file events, a target file event is determined from the candidate file events. If the target file event is a file addition, file update, or file transfer interruption event, the synchronization program obtains the target file corresponding to the target file event and sends the target file to the target device. If the target file event is a file deletion event, the synchronization program determines the target file name corresponding to the target file event and sends the target file name to the target device so that the target device deletes the file corresponding to the target file name. In the above process, since the monitoring program can monitor file changes, the target file event can be determined based on resource availability, and the synchronization program can synchronize the target file event, file transfer failures due to excessively large files are avoided, thus improving the reliability of file synchronization.

[0136] Figure 4 This is a schematic diagram of a file synchronization device provided in an embodiment of this disclosure. Please refer to [link / reference]. Figure 4 The file synchronization device may include a first acquisition module 11, a second acquisition module 12, a first determination module 13, and a synchronization module 14, wherein,

[0137] The first acquisition module 11 is used to acquire at least one file event from the source device in the preset storage space. The file event includes at least one of the following: a file addition event, a file deletion event, a file update event, and a file transfer interruption event.

[0138] The second acquisition module 12 is used to acquire the amount of resources required for each file event in the source device, as well as the remaining amount of resources in the source device;

[0139] The first determining module 13 is used to determine the target file event in at least one file event based on the remaining amount of resources and the amount of resources required by each file event;

[0140] Synchronization module 14 is used to execute target file events to synchronize files in the source device to the target device.

[0141] The file synchronization device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0142] In one possible implementation, the first determining module 13 is specifically used for:

[0143] Based on the remaining resources and the resources required by each file event, a candidate file event is determined from at least one file event, where the resources required by the candidate file event are less than the remaining resources.

[0144] The target file event is determined from the candidate file events based on the remaining resources and the amount of resources required by the candidate file events.

[0145] In one possible implementation, the first determining module 13 is specifically used for:

[0146] Sort the selected file events in descending order of the amount of resources required;

[0147] The first N candidate file events are determined as target file events; where N is an integer greater than or equal to 1, the total amount of resources required by the first N candidate file events is less than the remaining amount of resources, and the total amount of resources required by the first N+1 candidate file events is greater than the remaining amount of resources.

[0148] Figure 5 This is a schematic diagram of another file synchronization device provided in an embodiment of this disclosure. Figure 4 Based on the illustrated embodiments, please refer to Figure 5 The file synchronization device also includes a second determining module 15, a generating module 16, and a storage module 17, wherein:

[0149] The second determining module 15 is used to determine the preset monitoring path;

[0150] The generation module 16 is used to detect files in the preset monitoring path through the monitoring program, and generate at least one file event when a file in the preset monitoring path changes.

[0151] The storage module 17 is used to store at least one file event to a preset storage space.

[0152] In one possible implementation, the source device includes a synchronization program, and the synchronization module 14 has functions for:

[0153] If the target file event is a new file, an updated file, or a file transfer interruption event, the target file corresponding to the target file event is obtained through the synchronization program and sent to the target device;

[0154] If the target file event is a file deletion event, the target file name corresponding to the target file event is determined by the synchronization program, and the target file name is sent to the target device so that the target device deletes the file corresponding to the target file name.

[0155] In one possible implementation, the target file event is a transmission interruption event, and the synchronization module 14 has the following functions:

[0156] The file transfer progress, first file identifier, and file storage location are obtained from the target file event through the synchronization program;

[0157] The synchronization program retrieves the first file from its storage location based on the first file identifier.

[0158] The target file is determined in the first file based on the transmission progress through the synchronization program.

[0159] The file synchronization device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0160] This application provides a schematic diagram of the structure of an electronic device. Please refer to [link / reference]. Figure 6 The electronic device 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected via a bus 23.

[0161] Memory 22 stores instructions executed by the computer;

[0162] The processor 21 executes computer execution instructions stored in the memory 22, causing the processor 21 to perform the file synchronization method as shown in the above method embodiment.

[0163] Accordingly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the file synchronization method of the above-described method embodiments.

[0164] Accordingly, embodiments of this application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the file synchronization method shown in the above method embodiments.

[0165] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0166] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0167] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0168] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0169] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0170] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0171] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0172] The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0173] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0174] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A file synchronization method, characterized in that, Applied to a source device, the method includes: At least one file event from the source device is obtained in the preset storage space, and the file event includes at least one of the following: file addition event, file deletion event, file update event, and file transfer interruption event; Obtain the amount of resources required for each file event in the source device, and the remaining resources of the source device; Based on the remaining resource amount and the resource amount required by each file event, determine the target file event from the at least one file event; Execute the target file event to synchronize the files in the source device to the target device; Based on the remaining resources of the source device and the resource requirements of each file event, the target file event is determined from the at least one file event, including: Based on the remaining resources and the resources required for each file event, candidate file events are determined from the at least one file event, wherein the resources required for the candidate file events are less than the remaining resources; based on the remaining resources and the resources required for the candidate file events, a target file event is determined from the candidate file events.

2. The method according to claim 1, characterized in that, Based on the remaining resource amount and the resource amount required by the candidate file events, the target file event is determined from the candidate file events, including: The candidate file events are sorted in descending order of the required resource amount; The first N candidate file events are determined as the target file events; wherein N is an integer greater than or equal to 1, the total amount of resources required by the first N candidate file events is less than the remaining amount of resources, and the total amount of resources required by the first N+1 candidate file events is greater than the remaining amount of resources.

3. The method according to claim 1 or 2, characterized in that, The source device is equipped with a monitoring program; before acquiring at least one file event from the source device in the preset storage space, the program further includes: Determine the preset monitoring path; The monitoring program detects files in the preset monitoring path, and generates at least one file event when a file in the preset monitoring path changes. Store the at least one file event in the preset storage space.

4. The method according to claim 1 or 2, characterized in that, The source device is equipped with a synchronization program; executing the target file event to synchronize files in the source device to the target device includes: If the target file event is a new file, an updated file, or a file transfer interruption event, then the target file corresponding to the target file event is obtained through the synchronization program, and the target file is sent to the target device; If the target file event is a file deletion event, the synchronization program determines the target file name corresponding to the target file event and sends the target file name to the target device so that the target device deletes the file corresponding to the target file name.

5. The method according to claim 4, characterized in that, The target file event is a file transfer interruption event; The target file corresponding to the target file event is obtained through the synchronization program, including: The synchronization program obtains the file transfer progress, first file identifier, and file storage location in the target file event; The synchronization program retrieves the first file from the file storage location based on the first file identifier. The target file is determined in the first file according to the transmission progress through the synchronization program.

6. A file synchronization device, characterized in that, Applied to a source device, the device includes: a first acquisition module, a second acquisition module, a first determination module, and a synchronization module, wherein, The first acquisition module is used to acquire at least one file event from the source device in a preset storage space, the file event including at least one of the following: a file addition event, a file deletion event, a file update event, and a file transfer interruption event; The second acquisition module is used to acquire the amount of resources required for each file event in the source device, and the amount of resources remaining in the source device; The first determining module is used to determine the target file event among the at least one file event based on the remaining resource amount and the resource amount required by each file event; The synchronization module is used to execute the target file event to synchronize the files in the source device to the target device; The first determining module is specifically used for: Based on the remaining resources and the resources required for each file event, candidate file events are determined from the at least one file event, wherein the resources required for the candidate file events are less than the remaining resources; based on the remaining resources and the resources required for the candidate file events, a target file event is determined from the candidate file events.

7. An electronic device, characterized in that, include: Memory and processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the file synchronization method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the file synchronization method according to any one of claims 1 to 5.

9. A computer program product comprising a computer program that, when executed by a processor, implements the file synchronization method according to any one of claims 1 to 5.