A cloud synchronization method, electronic device, storage medium and chip

Cloud server synchronization technology allows users to efficiently synchronize files across different electronic devices, solving the problem of inconsistent file updates and improving synchronization efficiency and consistency.

CN120075239BActive Publication Date: 2026-03-20HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-23
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

When users synchronize files between different electronic devices, especially from desktop computers to laptops, there are inconveniences, leading to inconsistent file updates and data loss.

Method used

File synchronization is achieved through a cloud server. The first electronic device obtains the synchronized version information from the cloud, compares the differences between the synchronized files on the cloud and the local device, determines the processing method for the differences based on the file type and attribute information, and writes and updates the differences locally.

Benefits of technology

This approach achieves smaller difference file data size, simpler synchronization process, improved synchronization efficiency and consistency, and saves cloud server space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075239B_ABST
    Figure CN120075239B_ABST
Patent Text Reader

Abstract

The application provides a cloud synchronization method, an electronic device, a storage medium and a chip, and relates to the technical field of cloud synchronization. When a second electronic device synchronizes a file to a cloud server, the cloud server stores the file type and a cloud-side unique identifier of the file. When a first electronic device synchronizes the file from the cloud server, a difference file is obtained by comparing the cloud-side unique identifier of the cloud-side synchronization file and the cloud-side unique identifier of the local synchronization file. The processing mode (for example, a writing mode or deleting a local file) of each difference file is determined according to the file type and attribute information. The difference file (a file that has not been synchronized from the cloud server by the first electronic device) in the cloud-side synchronization file (a file that has been synchronized in the cloud server due to changes) is obtained through the cloud synchronization mode, the difference file has a small data volume and a simple process, and the synchronization is better due to the determination of the processing mode of the difference file according to the file type and attribute information.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of cloud synchronization, and in particular to a cloud synchronization method, an electronic device, a storage medium and a chip. BACKGROUND

[0002] A user can have multiple electronic devices, such as a mobile phone, a tablet computer, a desktop computer, a laptop computer, etc. The user can use different electronic devices in different situations, for example, the user usually uses a desktop computer to edit and process files in the desktop computer when working; when the user is on a business trip, the user can carry a laptop computer and use the laptop computer to edit and process files in the laptop computer.

[0003] When the user edits and processes a file A using a desktop computer in an office, it is inconvenient for the user to view the file A in the desktop computer or edit the file A in the desktop computer using a laptop computer during a business trip. SUMMARY

[0004] The present application provides a cloud synchronization method, an electronic device, a storage medium and a chip, and the electronic device can obtain the latest files synchronized to a cloud server by the other electronic device through the cloud server, and the process is simple.

[0005] To achieve the above-mentioned purpose, the first aspect of the present application adopts the following technical solution:

[0006] A cloud synchronization method, comprising:

[0007] A first electronic device obtains cloud-side synchronization version information from a cloud server, wherein the cloud-side synchronization version information includes the file type of a cloud-side synchronization file, the cloud-side synchronization file is a synchronization file in a historical synchronization process recorded on the cloud server, and the cloud-side synchronization file includes a synchronization file synchronized to the cloud server by a second electronic device;

[0008] The first electronic device compares the cloud-side unique identifier of the cloud-side synchronization file in the cloud-side synchronization version information with the cloud-side unique identifier (uuid) of a local synchronization file in local synchronization version information, to obtain a difference file of the cloud-side synchronization file and the local synchronization file, wherein the local synchronization file is a synchronization file in a historical synchronization process recorded by the first electronic device;

[0009] The first electronic device obtains attribute information (such as path, name, hash value, etc.) of the difference file with the file types of addition and modification from the cloud server;

[0010] The first electronic device obtains the processing mode of the difference file according to the file type and attribute information of the difference file;

[0011] The first electronic device writes the first difference file in the electronic device, and the first difference file is a difference file in a writing processing mode.

[0012] In the present application, the difference file (a file that has not been synchronized from the cloud server by the first electronic device) in the cloud-side synchronization file (a file that has been synchronized in the cloud server due to a change) is obtained through the cloud synchronization mode, and the difference file has a small data volume and a simple process. In addition, the processing mode of the difference file is determined according to the file type and attribute information, and the synchronization is better.

[0013] As an implementation form of the first aspect, the cloud server stores at most N versions of cloud-side synchronization version information, and the cloud-side synchronization version information further includes a cloud-side synchronization version number, and the local synchronization version information includes a local synchronization version number, the cloud-side synchronization version number is the latest synchronization version number in the cloud server, and the local synchronization version number is the latest synchronization version number in the first electronic device.

[0014] Before the first electronic device compares the cloud-side unique identifier of the cloud-side synchronization file in the cloud-side synchronization version information with the cloud-side unique identifier of the local synchronization file in the local synchronization version information to obtain the difference file of the cloud-side synchronization file and the local synchronization file, the method further includes:

[0015] The first electronic device calculates a first difference value of the cloud-side synchronization version number and the local synchronization version number.

[0016] The first electronic device determines that the first difference value is less than or equal to N.

[0017] In the present application, the cloud server is configured to store cloud-side synchronization version information that does not exceed a certain number (for example, N), which can save cloud server space. When the first difference value of the cloud-side synchronization version number and the local synchronization version number is less than or equal to N, the file in the local device can be updated according to the difference file, and the synchronization efficiency is improved.

[0018] As an implementation form of the first aspect, the first electronic device obtains the processing mode of the difference file according to the file type and attribute information of the difference file, including:

[0019] If the file type of the difference file is added, the first electronic device searches for a first file with the same cloud-side unique identifier as the difference file in the electronic device.

[0020] If the first file with the same cloud-side unique identifier as the difference file is found in the electronic device, the first electronic device determines whether the hash values of the difference file and the first file are consistent.

[0021] If the hash values of the difference file and the first file are consistent, the first electronic device determines that the processing mode of the difference file is to write the first electronic device in a mode of covering the first file;

[0022] If the hash values of the difference file and the first file are inconsistent, the first electronic device determines that the processing mode of the difference file is to write the first electronic device in a mode of renaming.

[0023] As an implementation manner of the first aspect, the method further comprises:

[0024] If the first electronic device does not find the first file with the same cloud-side unique identifier as the difference file in the first electronic device, the first electronic device finds a second file with the same name as the difference file in a first path of the first electronic device, and the first path is a local path of the difference file recorded in the cloud server;

[0025] If the second file with the same name as the difference file does not exist in the first path, the first electronic device determines that the processing mode of the difference file is to write the first electronic device;

[0026] If the second file with the same name as the difference file exists in the first path, the first electronic device determines whether the hash values of the difference file and the second file are consistent;

[0027] If the hash values of the difference file and the second file are consistent, the first electronic device determines that the processing mode of the difference file is to write the first electronic device in a mode of covering the second file;

[0028] If the hash values of the difference file and the second file are inconsistent, the first electronic device determines that the processing mode of the difference file is to write the first electronic device in a mode of renaming.

[0029] As an implementation manner of the first aspect, the first electronic device determines the processing mode of the difference file according to the file type and attribute information of the difference file, comprising:

[0030] If the file type of the difference file is modification, the first electronic device finds a third file with the same cloud-side unique identifier as the difference file in the first electronic device;

[0031] If the third file with the same cloud-side unique identifier as the difference file is not found in the first electronic device, the first electronic device determines that the writing mode of the difference file is to write the first electronic device;

[0032] If a third file identical to the cloud-side unique identifier of the difference file is found in the electronic device, the first electronic device determines whether the hash values of the difference file and the third file are identical;

[0033] If the hash values of the difference file and the third file are identical, the first electronic device determines that the writing mode of the difference file is writing into the electronic device;

[0034] If the hash values of the difference file and the third file are not identical, the first electronic device determines that the writing mode of the difference file is writing into the electronic device in the manner of covering the third file.

[0035] As an implementation manner of the first aspect, the first electronic device obtains the processing mode of the difference file according to the file type and attribute information of the difference file, including:

[0036] If the file type of the difference file is deletion, the first electronic device finds a fourth file having the same cloud-side unique identifier as the difference file;

[0037] If the fourth file having the same cloud-side unique identifier as the difference file exists, the first electronic device deletes the fourth file in the electronic device.

[0038] As an implementation manner of the first aspect, after the first electronic device obtains the processing mode of the difference file according to the file type and attribute information of the difference file, the method further includes:

[0039] The first electronic device updates the local file version number in the local synchronization version information of the difference file to the cloud-side file version number in the cloud-side synchronization version information of the difference file;

[0040] The first electronic device updates the local synchronization version number in the local synchronization version information to the cloud-side synchronization version number in the cloud-side synchronization version information.

[0041] As an implementation manner of the first aspect, after the first electronic device writes the first difference file into the electronic device, the method further includes:

[0042] The first electronic device edits the first difference file to obtain a second difference file;

[0043] The first electronic device identifies the file type of the local file;

[0044] The first electronic device sends the second difference file to the cloud server, and the second difference file is a local file with the file type of modification;

[0045] The first electronic device obtains a cloud-side unique identifier of the second difference file from a cloud server;

[0046] The first electronic device adds 1 to a file version number (etag) of the second difference file in local synchronization version information;

[0047] The first electronic device adds 1 to a local synchronization version number (ctag) in the local synchronization version information.

[0048] As an implementation form of the first aspect, after the first electronic device calculates the first difference value of the cloud-side synchronization version number and the local synchronization version number, the method further includes:

[0049] The first electronic device determines that the first difference value is greater than N;

[0050] The first electronic device records a cloud-side unique identifier of a cloud-side synchronization file in the cloud-side synchronization version information;

[0051] The first electronic device obtains attribute information of the cloud-side synchronization file corresponding to the cloud-side unique identifier from the cloud server;

[0052] The first electronic device compares the attribute information of the cloud-side synchronization file and attribute information of a local file to obtain a file type of a difference file, the difference file being the cloud-side synchronization file;

[0053] The first electronic device obtains a processing mode of the difference file according to the file type and the attribute information of the difference file.

[0054] In a second aspect, an electronic device is provided, including a processor configured to invoke a computer program stored in a memory to implement the method of any one of the first aspect.

[0055] In a third aspect, a chip is provided, including a processor coupled with a memory, and the processor executes a computer program stored in the memory to implement the method of any one of the first aspect.

[0056] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, when the computer program is run on an electronic device, the electronic device implements the method of any one of the first aspect.

[0057] In a fifth aspect, an embodiment of the present application provides a computer program product, when the computer program product is run on a device, the device executes the method of any one of the first aspect.

[0058] It can be understood that the beneficial effects of the second aspect to the fifth aspect described above can be referred to the related description in the first aspect described above, and will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0059] Figure 1 A hardware structure schematic diagram of an electronic device provided by an embodiment of the present application;

[0060] Figure 2 A module schematic diagram of an embodiment of the present application for implementing a cloud synchronization scheme;

[0061] Figure 3 A synchronization flow schematic diagram of a plurality of electronic devices under the same account provided by an embodiment of the present application;

[0062] Figure 4 An uplink synchronization flow schematic diagram provided by an embodiment of the present application;

[0063] Figure 5 A content schematic diagram of a cloud side synchronization version information and a local synchronization version information provided by an embodiment of the present application; Figure 4

[0064] An uplink synchronization flow schematic diagram provided by an embodiment of the present application; Figure 6

[0065] A content schematic diagram of a cloud side synchronization version information and a local synchronization version information in the embodiment shown in the figure; Figure 7 Figure 6 A downlink synchronization flow schematic diagram provided by an embodiment of the present application;

[0066] Figure 8 A specific implementation process schematic diagram of S114 in the embodiment provided by the present application and

[0067] Figure 9 A specific implementation process schematic diagram of S115 in the embodiment provided by the present application and Figure 4 Figure 6 A specific implementation process schematic diagram of S109 in the embodiment provided by the present application and

[0068] Figure 10 A specific implementation process schematic diagram of S109 in the embodiment provided by the present application and Figure 4 Figure 6 A specific implementation process schematic diagram of S109 in the embodiment provided by the present application and

[0069] Figure 11 A specific implementation process schematic diagram of S109 in the embodiment provided by the present application and Figure 4 Figure 6 A specific implementation process schematic diagram of S109 in the embodiment provided by the present application and DETAILED DESCRIPTION

[0070] ​​​​In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, and techniques are omitted so as not to obscure the description of the present application with unnecessary detail.

[0071] It should be understood that the term "comprising" as used in the specification and in the claims, indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0072] It should also be understood that, in the embodiments of the present application, "one or more" means one, two, or more than two; "and / or" describes the association relationship of the associated objects, which means that there can be three relationships; for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after it.

[0073] In addition, in the description of the specification and the appended claims, the terms "first", "second", "third", "fourth" and the like are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

[0074] In the present specification, the reference "one embodiment" or "some embodiments" and the like means that a specific feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in other embodiments", "in additional embodiments" and the like appearing in various places in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically noted. The terms "include", "contain", "have" and their variants mean "including but not limited to", unless otherwise specifically noted.

[0075] The cloud synchronization method provided by the embodiments of the present application can be applied to an electronic device to backup data in the electronic device to a cloud server. The electronic device can be a tablet computer, a mobile phone, a wearable device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. Among them, multiple electronic devices under the same account can participate in the cloud synchronization method provided by the present application, and the specific type of the electronic device is not limited by the embodiments of the present application.

[0076] Figure 1 A structural schematic diagram of an electronic device is shown. The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0077] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different component arrangements. The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0078] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated in one or more processors. For example, the processor 110 is configured to execute the cloud backup method in the embodiments of the present application.

[0079] The processor 110 can also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has recently used or is likely to use again. If the processor 110 needs to use the instructions or data again, it can be retrieved directly from the memory. This avoids repeated accesses and reduces the latency of the processor 110, thus improving the efficiency of the system.

[0080] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 performs various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area.

[0081] In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc. The application data, application resource index file, etc. in the embodiments of the present application can be stored in the internal memory.

[0082] The audio module 170 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio inputs into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some functional modules of the audio module 170 can be disposed in the processor 110.

[0083] The speaker 170A, also known as a "loudspeaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0084] The touch sensor 180K, also known as a "touch panel". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the touch event type. The visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, which is different from the position where the display screen 194 is located. For example, the operations in the cloud backup interface provided in the embodiments of the present application, etc.

[0085] The electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.

[0086] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode (AMOLED), a flex light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 can include 1 or N display screens 194, N being a positive integer greater than 1. For example, the electronic device 100 in the embodiments of the present application can include one or more display screens 194. Figure 2 The interface shown is displayed by the display.

[0087] The camera 193 is used to capture still images or videos. In some embodiments, the electronic device 100 can include 1 or N cameras 193, N being a positive integer greater than 1.

[0088] The embodiments of the present application do not particularly limit the specific structure of the execution subject of the cloud synchronization method, as long as the code of the cloud synchronization method of the embodiments of the present application is run to communicate according to the cloud synchronization method provided by the embodiments of the present application. For example, the execution subject of the cloud synchronization method provided by the embodiments of the present application can be a functional module capable of calling and executing programs in the electronic device, or a communication device applied to the electronic device, such as a chip.

[0089] A user can have multiple electronic devices, such as a mobile phone, a tablet computer, a desktop computer, a portable computer, etc. The user can use different electronic devices in different situations, for example, the user usually uses a desktop computer to edit files in the desktop computer when working; the user can carry a portable computer and use the portable computer to edit files in the portable computer when on a business trip.

[0090] When a user edits a file A on a desktop computer in an office, it is inconvenient for the user to view or edit the file A on the desktop computer using a portable computer during a business trip.

[0091] Embodiments of the present application provide a cloud synchronization scheme, which can synchronize file data in an electronic device to a cloud server, and synchronize file data in the cloud server to a local device. In this way, a user can view or edit file data synchronized to the cloud server by another electronic device.

[0092] In order to enable the user to view or edit file data using an electronic device and obtain the latest file data, each electronic device performs a downlink synchronization process to download the latest synchronized file data from the cloud server to the local device (the electronic device) before viewing the file data, and then edits the latest synchronized file data on the local device. After the editing, an uplink synchronization process is performed to synchronize the edited file data on the local device to the cloud server, so that the cloud server stores the latest edited file data. In this way, another electronic device can obtain the latest edited file data from the cloud server when editing the same file again.

[0093] Reference Figure 2 The principle of the cloud synchronization scheme provided by embodiments of the present application is shown in the figure. Embodiments of the present application take the cloud synchronization scheme of a gallery application in an electronic device as an example. In actual applications, other file data can also be synchronized, which is not limited by the present application.

[0094] The electronic device has a gallery application and a cloud application. The gallery application can store pictures and videos, and a user can view pictures and videos in the gallery application, add pictures and videos in the gallery application, delete pictures and videos in the gallery application, and edit pictures and videos in the gallery application (for example, add graffiti in a picture). The cloud application is used to synchronize data in the gallery application and data on the cloud server.

[0095] The gallery application has a synchronization data management module, a DB storage module, a receiving module, and a providing module.

[0096] The synchronization data management module is used to synchronize various information in the gallery application, including attribute information of each album in the gallery (for example, name, creation time, file quantity, etc.), files in the gallery application (for example, picture files and video files), attribute information of each file in the gallery application (for example, name, size, geographical location, etc.), and the like. Among them, the albums in the gallery also include various albums, such as albums of the same person, screenshot albums, photo albums, collection albums, Bluetooth sharing albums, and the like.

[0097] The synchronization data management module is also configured to manage cloud-side unique identifiers (UUIDs) of the respective synchronization files, etags (recording the latest synchronization version number and file type of the synchronization file) of the respective synchronization files, and ctags (the latest synchronization version number of cloud synchronization) of cloud synchronization.

[0098] The synchronization data management module is also configured to obtain difference files in a downlink synchronization process, handle write modes in file conflict processing, identify local addition, deletion and modification data in an uplink synchronization process, and generate corresponding thumbnails (or LCD pictures); and is further configured to be responsible for download management of thumbnails (or LCD thumbnails) and source files.

[0099] The DB storage module is configured to store structured data into a DB, store thumbnails into a designated hidden directory, and store original files into a corresponding directory.

[0100] The receiving module is configured to accept a synchronization broadcast and the like issued by a cloud application.

[0101] The providing module is configured to respond to a capability query of the gallery by the cloud application and a synchronization triggering operation and the like.

[0102] The SDK is a bridge for communication between the gallery application and the cloud application, and provides various interfaces for the gallery application to implement different functions. For example, a calling interface is provided to the gallery application, and the gallery application triggers synchronization, state query, file download and the like through the calling interface; a callback interface is provided to the gallery application, and the gallery application implements control of the downlink and uplink processes of synchronization through the callback interface.

[0103] The cloud server has a synchronization service and a storage service. The synchronization service is configured to communicate with the electronic device to implement various functions, and the storage service is configured to store various files synchronized by the gallery application. The synchronization service and the storage service can be located in different servers, for example, the cloud server includes a synchronization server and a storage server.

[0104] As described above, the embodiments of the present application can implement synchronization of data in multiple electronic devices on a cloud server. The cloud synchronization scheme provided by the embodiments of the present application is described below by taking cloud synchronization of multiple electronic devices as an example.

[0105] Reference is made to Figure 3 The cloud synchronization process between the electronic device A, the electronic device B and the electronic device C provided by the embodiments of the present application is shown in FIG. 1. Each of the electronic devices can perform a downlink synchronization process and an uplink synchronization process as a first electronic device.

[0106] The electronic device A, the electronic device B and the electronic device C log in the same account; in the case that the data in the gallery application of any one of the electronic device A, the electronic device B and the electronic device C changes, the changed electronic device (for example, the electronic device A) and other electronic devices (for example, the electronic device B and the electronic device C) will all perform the cloud synchronization process.

[0107] Step (0), the gallery application of the electronic device A receives the operation of the user.

[0108] In the embodiments of the present application, the operation of triggering synchronization can include multiple cases:

[0109] Case (1) the operation of the user clicking the icon of the gallery application to start the gallery application.

[0110] Case (2) the operation of the user opening any album after starting the gallery application.

[0111] Case (3) the operation of the user starting the editing interface of any file in the gallery application.

[0112] Other operations are not listed one by one, and in actual application, the operation or condition of the electronic device performing the synchronization process can be set according to actual needs. For example, a fixed period can also be set to perform the cloud synchronization process.

[0113] Of course, in order to make the editing process of the file based on the latest version of the file data on the cloud server, the synchronization process is usually triggered before the detailed content of the file is displayed.

[0114] Step (1) the electronic device A performs the down synchronization process in response to the operation, to synchronize the synchronization file in the cloud server to the electronic device A. The synchronization file is: the file that is changed by other electronic devices and synchronized to the cloud server between the last synchronization and the current synchronization. The changed file can be a new file, a modified file and a deleted file, etc.

[0115] After the down synchronization process is completed, the user can perform editing processing on the downloaded latest version of the file, and after the editing processing is completed, the down synchronization process can be triggered to synchronize the latest version of the file to the cloud server, so that the user can download the latest version of the file data when viewing the file on other electronic devices.

[0116] Step (2) the up synchronization process is performed to synchronize the changed file in the electronic device to the cloud server, the changed file being: the file that is changed in the electronic device between the last synchronization and the current synchronization in the electronic device. The changed file can also be a new file, a modified file and a deleted file, etc.

[0117] Step (3) after the electronic device A ends the uplink synchronization process, sends a synchronization instruction to the cloud server.

[0118] In practical application, step (3) can be set in step (2), that is, the end of the uplink synchronization process is equivalent to the cloud server sending a synchronization instruction.

[0119] Step (4) after the cloud server responds to the synchronization instruction of the electronic device A, in the case of determining that there is a change file, sends a synchronization broadcast, which can be sent to the electronic device B and the electronic device C currently logged in the same account as the electronic device A. In the case of determining that there is no change file, no synchronization broadcast is issued.

[0120] For the electronic device B, the following process is executed:

[0121] Step (5) after the electronic device B receives the synchronization broadcast sent by the cloud server, executes the downlink synchronization process.

[0122] In this step, the change file (i.e. the synchronization file) uploaded by the electronic device A to the cloud server can be downloaded to the electronic device B, and the process is similar to step (1).

[0123] Step (6) the electronic device B executes the uplink synchronization process.

[0124] In the embodiment of the application, if the electronic device B executes the downlink synchronization process and finds that there is a change file between the last synchronization and the current synchronization on the electronic device B, the uplink synchronization process also needs to be executed.

[0125] In theory, the electronic device A will trigger the execution of the downlink synchronization process before editing the file each time, and will also execute the uplink synchronization process after editing the file, so there may be no other change files in the electronic device A except the file changed this time. However, the electronic device A may have changed the file in the case that the electronic device A is not logged in the account, so when step (6) is executed, there may be other change files.

[0126] Similarly, the electronic device B, like the electronic device A, needs to trigger the execution of the downlink synchronization process before the uplink synchronization process each time the file is changed, so after the electronic device B executes step (5), there will be no change file, so the process (6) will not be executed. However, the electronic device B may have changed the file in the case that the electronic device B is not logged in the account, so after step (5) is executed, step (6) will also be executed.

[0127] The electronic device generally performs a downlink synchronization process first, and then performs an uplink synchronization process. In this way, in the case that the electronic device is not logged in to the account, the missed changed file can be downloaded to the electronic device first, so that the user obtains the latest synchronization file of the cloud server.

[0128] Of course, in actual application, if the electronic device B performs to step (5), and there is no changed file in the local, step (6) does not need to be performed.

[0129] As another example, if the file in the gallery application of the electronic device B is changed, after the uplink synchronization process of the electronic device B is completed, the cloud server will also trigger the electronic device A and the electronic device C to perform the synchronization process, so as to synchronize the latest uplink synchronization file to the electronic device A and the electronic device C.

[0130] If the file in the gallery application of the electronic device B is not changed, step (6) is not performed, and the electronic device A and the electronic device C will not be triggered to perform the synchronization process again.

[0131] For the electronic device C, the same process as the electronic device B is performed.

[0132] After the electronic device C receives the synchronization broadcast sent by the cloud server in step (5), the downlink synchronization process is performed.

[0133] In step (6), the electronic device C performs the uplink synchronization process.

[0134] The detailed process is not described here.

[0135] Reference Figure 4 The downlink synchronization process schematic diagram provided by the embodiment of the present application is the process of synchronizing the data in the gallery application from the cloud server.

[0136] In S101, the gallery application receives a viewing operation of a file.

[0137] In the embodiment of the present application, the user can perform operations such as deleting, moving, copying, and editing the file in the gallery in the gallery application. Before performing these operations, the file needs to be viewed first. The file in the gallery application includes a photo and a video.

[0138] In S102, in response to the viewing operation, the gallery application sends a cloud-side synchronization version acquisition request to the cloud application, and the acquisition request carries an account A logged in by the electronic device.

[0139] In the embodiment of the present application, the basis for the multiple electronic devices to realize the cloud synchronization of the gallery application includes that the multiple electronic devices log in to the same account.

[0140] In the embodiments of the present application, the information transmission between the gallery application and the cloud application can be realized through the SDK, and the illustration is not shown.

[0141] In S103, after receiving the acquisition request of the cloud-side synchronization version, the cloud application sends an acquisition request of the cloud-side synchronization version to the cloud server, and the request carries the account A.

[0142] In S104, after receiving the acquisition request of the cloud-side synchronization version, the cloud server searches the cloud-side synchronization version information of the gallery application carrying the account A.

[0143] Referring to Figure 5 The cloud-side synchronization version information (cloud) includes: the cloud-side synchronization version number (recorded in ctag), the cloud-side unique identifier (uuid) of the cloud-side synchronization file, the synchronization version number (recorded in etag), and the file type (recorded in item).

[0144] The cloud-side synchronization version number ctag=50 indicates that the changed file has been synchronized to the cloud server for 50 times, and the changed file synchronized to the cloud server is recorded as a synchronization file, and the changed file synchronized each time can be different.

[0145] The cloud-side unique identifier uuid of the cloud-side synchronization file is a unique identifier assigned by the cloud server to each synchronization file, which is used to distinguish different synchronization files, for example, synchronization file 1, synchronization file 2, synchronization file 3, and synchronization file 4.

[0146] The synchronization version number etag of the cloud-side synchronization file 3 is 48, indicating that the cloud-side synchronization file 3 is the changed file at the 48th synchronization.

[0147] The file type is the change type determined from the perspective of the cloud server when the electronic device synchronizes to the cloud server (the last synchronization of the cloud server). The file type can be set as: added, modified, deleted, etc.

[0148] The added file is a file that does not originally exist in the cloud server and is uploaded from the electronic device side.

[0149] The modified file is a file that originally exists in the cloud server and is changed (for example, the uuid is the same, the file name is the same, and the hash value is changed) from the electronic device side.

[0150] The deleted file is a file that originally exists in the cloud server but is deleted from another electronic device side.

[0151] In S105, the cloud server sends the cloud-side synchronization version information to the cloud application.

[0152] S106, after the cloud application receives the cloud-side synchronization version information, the cloud-side synchronization version information is compared with the ctag in the local synchronization version information to determine the synchronization type: incremental synchronization (difference less than or equal to 20).

[0153] Referring to Figure 5 the local synchronization version information before the client-side synchronization of the electronic device in FIG. 1. The local synchronization version information is the cloud-side synchronization version information that the electronic device stores locally in the last synchronization. Therefore, the specific meaning of the local synchronization version information is the same as that of the cloud-side synchronization version information, and will not be explained in detail.

[0154] Referring to Figure 5 As shown in FIG. 1, according to the ctag of the client-side of the electronic device = 45, it is determined that the last time the electronic device synchronizes from the cloud server is the 45th synchronization, and the file 2 is synchronized in the 45th synchronization.

[0155] The difference between the cloud-side synchronization version information and the local synchronization version information is the difference file, which is the synchronization file missing in the electronic device. Therefore, the difference file can be determined according to the difference between the two.

[0156] In theory, when the file in the gallery application in any electronic device changes, the electronic device synchronizes the file change to the cloud server, and the cloud server maintains the latest file change of the gallery application. The cloud server can also synchronize the latest file change of the gallery application to other electronic devices.

[0157] However, in actual application, the user may use an electronic device that is not logged in to the account to process the local file of the electronic device, which causes the electronic device to have no way to synchronize the latest file change of the gallery application in the electronic device to the cloud server, so that the file data in the cloud server and the gallery application in the electronic device are out of synchronization.

[0158] Or, the user uses an electronic device that is logged in to the account to process the local file of the electronic device, and the electronic device synchronizes the latest file change of the gallery application in the electronic device to the cloud server through the synchronization process, but because another electronic device is not logged in to the same account, the other electronic device that is not logged in to the same account has no way to synchronize the latest file change of the gallery application in the cloud server to the electronic device.

[0159] The above will cause the received cloud-side ctag and the ctag stored locally in the electronic device to be inconsistent.

[0160] The cloud server does not keep every synchronization record, and usually keeps a certain number of synchronization records, for example, the last 20 ctag versions can be kept. Therefore, when the version number difference between the cloud side ctag1 and the electronic device side ctag2 is less than or equal to 20, the synchronization file that exists in ctag1 but does not exist in ctag2 is found, and the difference file is obtained, which is the missing file change of the electronic device. The electronic device can update the file in the electronic device to the latest version of the file according to the related information of the difference file.

[0161] As an example, in the electronic device A, the etag version of file 1 is recorded as 32, the etag version of file 2 is recorded as 45, and the ctag version is 45.

[0162] In the cloud server, the etag version of file 1 is recorded as 32, the etag version of file 2 is recorded as 45, the etag version of file 3 is recorded as 48, the etag version of file 4 is recorded as 50, and the ctag version is 50.

[0163] The difference between the ctag version of the cloud server and the ctag version recorded in the electronic device A is calculated as 15.

[0164] As described above, the cloud server can keep the synchronization information of the last 20 ctag versions, and if the version difference between the electronic device A and the cloud server is less than 20, it means that the file 1 and the file 2 in the electronic device A are synchronized with the cloud server. Therefore, the electronic device A only needs to perform incremental synchronization, that is, synchronize the difference files: file 3 and file 4 between the electronic device and the cloud server.

[0165] S107, the cloud application sends the cloud side synchronization version information of the difference file: ctag, uu id, etag and item to the gallery application according to the synchronization type.

[0166] S108, after the gallery application receives the cloud side synchronization version information of the difference file, the cloud side unique identifier is recorded.

[0167] S109, the gallery application deletes the difference file with the file type of deletion from the local. For details, refer to the description of the subsequent steps.

[0168] S110, the gallery application sends a downlink request of the attribute information of the difference file with the file types of addition and modification to the cloud application, carrying the cloud side unique identifier.

[0169] S111, after the cloud application receives the downlink request of the attribute information, the cloud application sends a downlink request of the attribute information of the difference file to the cloud server (carrying the cloud side unique identifier).

[0170] S112, after the cloud server receives the attribute information downlink request, the cloud server sends attribute information of the difference file corresponding to the cloud side unique identifier to the cloud application, including name, size, file path, Hash value, etc.

[0171] S113, after the cloud application receives the attribute information of the difference file, the cloud application sends attribute information of the difference file to the gallery application, including name, size, file path, Hash value, etc.

[0172] S114, the attribute information of the difference file of the newly added file type is compared with the attribute information of the local file, and the processing strategy of the difference file of the newly added type is obtained, including overwrite, download rename write and direct write.

[0173] For details, refer to the description of subsequent embodiments.

[0174] S115, the attribute information of the difference file of the modified file type is compared with the attribute information of the local file, and the processing strategy of the difference file of the modified type is obtained, including overwrite, download rename write and direct write.

[0175] For details, refer to the description of subsequent embodiments.

[0176] S116, the gallery application updates the etag of each difference file.

[0177] Taking file 3 in Figure 5 as an example, the etag is updated to 48; the etag of file 4 is updated to 50.

[0178] S117, the gallery application sends the etag and the cloud side unique identifier of the difference file to the cloud application.

[0179] S118, after the cloud application receives the etag and the cloud side unique identifier of the difference file, the cloud application sends a download request of the source file (for example, a thumbnail or an original file, etc.) of the difference file to the cloud server, where the download request carries the uuid of the file to be downloaded.

[0180] S119, after the cloud server receives the download request, the cloud server sends the corresponding source file to the cloud application.

[0181] S120, after the cloud application receives the source file, the cloud application sends the source file to the gallery application.

[0182] S121, the gallery application writes the received source file to the local.

[0183] In the embodiments of the present application, the downloaded source file can be written in the form of overwriting local data, or can be written in the form of renaming, or can be directly written.

[0184] S122, the gallery application sends a this-batch-file-completion response to the cloud application.

[0185] In the embodiments of the present application, the process of downloading files from the cloud server is executed in a loop, i.e. after downloading a batch of files, the next batch of files is downloaded, and the process of steps S118 to S122 is executed in a loop once for each batch of files downloaded. The cloud application checks whether all files have been downloaded after receiving a this-batch-file-completion response once.

[0186] S123, after receiving the this-batch-file-completion response, the cloud application checks whether all files have been downloaded.

[0187] S124, the cloud application updates the ctag of the current synchronization, for example, updates the ctag to 50.

[0188] After the downlink process ends, the local synchronization version information on the electronic device side refers to the content of the client after the downlink synchronization in Figure 5 .

[0189] As shown in step S106, the cloud server does not keep a record of each synchronization, and usually keeps a certain number of synchronization records, for example, the most recent 20 (only for example) ctag versions can be kept. Therefore, when the version number difference between the cloud-side ctag1 and the electronic device-side ctag2 is less than or equal to 20, the synchronization files in ctag1 that are not in ctag2 are found, and the difference files are obtained, which are the missing file changes of the electronic device. The electronic device can update the files in the electronic device to the latest version of the files according to the related information of the difference files.

[0190] However, when the version number difference between the cloud-side ctag1 and the electronic device-side ctag2 is greater than 20, there is a missing between the two, and therefore, the changes of each synchronization file need to be determined according to the other information of the cloud-side all synchronization files and the related information in the local files, so that the files in the electronic device can be updated to the latest version of the files according to the changes of the all synchronization files.

[0191] Figure 4 Step S106 in the above is: comparing the ctag in the cloud-side synchronization version information and the ctag in the local synchronization version information, determining the synchronization type: full synchronization (difference greater than 20).

[0192] As an example, referring to Figure 7 , on the electronic device side, the etag version of file 1 is recorded as 32, the etag version of file 2 is recorded as 45, and the ctag version is recorded as 45;

[0193] In the cloud server, the etag version of file 1 is 47, the etag version of file 2 is 47, the etag version of file 3 is 50, the etag version of file 4 is 66, and the ctag version is 66.

[0194] The difference between the ctag version of the cloud server and the ctag version recorded by the electronic device B is 21.

[0195] As described above, the cloud server can keep the synchronization information of the last 20 ctag versions. If the version difference between the electronic device B and the cloud server is greater than 20, it means that the file 1 and the file 2 in the electronic device B and the file 1 and the file 2 in the cloud server cannot be synchronized through the recorded changes, so the electronic device B needs full synchronization, that is, to synchronize all the files in the cloud server: file 1, file 2, file 3 and file 4.

[0196] S107 is the cloud-side synchronization version information of the difference file: ctag, uu id, and etag. There is no need to transmit the file type, and the electronic device needs to compare the attribute information of all cloud-side synchronization files and local files to determine the file type.

[0197] S108, the cloud-side synchronization version information of the difference file: ctag, uu id, and etag.

[0198] Since the file type cannot be determined at this time, S109 is temporarily not executed.

[0199] S110 to S113 can refer to the description in the above embodiments, with the difference that in incremental synchronization, the attribute information of the difference file is obtained; in full synchronization, the attribute information of all cloud-side synchronization files is obtained.

[0200] S125, after obtaining the attribute information of all cloud-side synchronization files, compare with the attribute information of the local files to obtain the file types:

[0201] There is uuid1 in the cloud-side synchronization file, and there is no uuid1 in the local file, so it is determined that uuid1 is added;

[0202] There is no uuid2 in the cloud-side synchronization file, and there is uuid2 in the local file, so it is determined that uuid2 is deleted;

[0203] There is uuid3 in the cloud-side synchronization file, and there is uuid3 in the local file, the hash values are different, and uuid3 is modified.

[0204] Of course, other attribute information can also be added, such as file path, file name, file size, etc. This application will not be repeated.

[0205] S109 is executed after S125.

[0206] Steps S114 to S118, for the difference file in the incremental synchronization, for the synchronization file in the full synchronization, and for the cloud-side synchronization file, and the others are not described herein.

[0207] The downlink synchronization process is used to synchronize the synchronization file of the cloud server to the electronic device, and the uplink synchronization process is used to synchronize the change file of the electronic device to the cloud server.

[0208] After the downlink synchronization process is performed, the uplink synchronization process also needs to be performed. The uplink synchronization process can refer to FIG. 2. Figure 8 In actual application, the latest version of the file can be downloaded by viewing the file; the user edits the file after viewing the file; and after the editing is completed, the edited file can be uploaded to the cloud server through the downlink synchronization process.

[0209] S201, the cloud application sends an uplink notification to the gallery application.

[0210] S202, after the gallery application receives the uplink notification, the gallery application identifies the addition, deletion, modification, and copy of the local file. These files are recorded as change files.

[0211] In the present application, after a file is added locally, the file is marked as an added file, after a file is modified locally, the file is marked as a modified file, after a local file is copied to another file path, the copied new file is marked as a copied file, and after a file is deleted locally, information about the deleted file is marked.

[0212] S203, the gallery application sends attribute information (local unique identifier, size, name, etc.) of the change file to the cloud application.

[0213] S204, after the cloud application receives the attribute information, the cloud application sends a change file reading request to the gallery application according to the attribute information.

[0214] S205, the cloud application reads the change file from the gallery application.

[0215] S206, the cloud application sends the read change file and attribute information of the change file to the cloud server.

[0216] S207, after the cloud server receives the change file and the attribute information, the cloud server stores the change file and the attribute information.

[0217] S208, the cloud server sends information about successful uploading to the cloud application, and the information carries a cloud-side unique identifier of the file successfully uploaded.

[0218] S209, after the cloud application receives the information about successful uploading, the cloud application uploads the structured data.

[0219] The structured data is the attribute information of each file uploaded in batches.

[0220] S210, after the cloud server receives the structured data, the cloud server sends information of successful uploading of the structured data to the cloud application.

[0221] S211, after the cloud application receives the information of successful uploading of the structured data, the cloud application sends the cloud-side unique identifier received previously to the gallery application.

[0222] S212, after the gallery application receives the cloud-side unique identifier of the local file, the gallery application updates the etag version number, the cloud-side unique identifier, the file type, and the like.

[0223] S213, the gallery application sends the etag version number, the cloud-side unique identifier, the file type, and the like of the synchronized file to the cloud application.

[0224] In the embodiment of the present application, the process of uploading files to the cloud server is executed in a loop, that is, after uploading a batch of files, the next batch of files is uploaded, and the steps S206 to S213 are executed in a loop once for each batch of files uploaded. The cloud application checks whether all the changed files are downloaded once for each etag information received.

[0225] S214, after the cloud application receives the etag information, the cloud application determines that all the changed files have been uploaded.

[0226] S215, the cloud application updates the ctag of this synchronization.

[0227] Continuing with the example shown in Figure 5 , the etag of the file 3 after the downlink synchronization process is 48, and the ctag is 50; after the user modifies the file 3, the uplink synchronization process is performed, and after the uplink synchronization process, since this uplink synchronization process is the 51st synchronization to the cloud server, the etag of the file 3 is updated to 51, and the ctag is updated to 51.

[0228] The following describes Figure 9 the determination manner of the processing strategy of the newly added file in the step S114 of the downlink synchronization process shown in Figure 4 .

[0229] A1, the information of the cloud-side newly added file A is received.

[0230] In the embodiment of the present application, the attribute information of the cloud-side newly added file A includes: the uuid of the file A, the name, the file path of the file A, and the like.

[0231] Because the gallery applications of multiple electronic devices can be updated synchronously on the cloud server, the gallery applications of multiple electronic devices can also be synchronized. The file path of file A is the file path of file A on electronic device B when file A is synchronized and updated to this version on the cloud server. The attribute information of file A received by electronic device A during the downlink synchronization process is the file path of file A on electronic device B.

[0232] A2, search locally for a file B that has the same UUID as file A.

[0233] A3. If no file B with the same UUID as file A exists in this case, then search for a file C with the same name as file A in the same path as file A.

[0234] A4. If a file C with the same name as file A does not exist in the same path as file A, then write the newly added file A to the local database, record the UUID of the newly added file A, and set dirty to 0.

[0235] In this embodiment of the application, if there is no file C with the same name as file A under the same path, it means that the UUID and file name of file A and the file in the local machine are different. This means that the newly added file A is a new file for this electronic device. Therefore, the newly added file A on the cloud side can be written to the local database. At the same time, the UUID of the newly added file A on the cloud side also needs to be recorded, and the dirty setting is 0 (no need to upload during uplink).

[0236] A5. If a file C with the same name as file A exists in the same path as file A, then determine whether the data in file A and the data in file C are consistent.

[0237] A6. If the data in file A is inconsistent with the data in file C, then the newly added file A on the cloud side is written to the local database in the form of a rename, with the dirty setting set to 2. In the subsequent uplink process, the local ID of the renamed file A is sent.

[0238] In this embodiment of the application, if the data of file A and file C are inconsistent, but they are files with the same name under the same file path, then file A and file C may be different versions of the same file. In this case, file A needs to be renamed and the dirty value set to 2 (to be uploaded during the uplink) so that it can be synchronized to the cloud server in the subsequent uplink synchronization process. The local ID of file A also needs to be transmitted during the uplink process.

[0239] A7. If the data in file A is consistent with the data in file C, then the newly added file A on the cloud side will overwrite the local file C, and the UUID of the newly added file A on the cloud side will be recorded and transmitted in the subsequent uplink synchronization process.

[0240] In this embodiment of the application, if the data of file A and file C are the same and they belong to the same file path with the same name, then file A and file C are the same file. In this case, file A can be added on the cloud side to overwrite file C, and the UUID of file A added on the cloud side can be recorded. The dirty value can be set to 0, and the local ID can be returned.

[0241] As mentioned earlier, in step A2, if a file B with the same UUID as file A exists locally, there is another possibility:

[0242] A8. If a file B with the same UUID as file A is found locally, then determine whether the data of file B and file A are consistent.

[0243] A6. If the judgment result of step A8 is that file B and file A are inconsistent, then write the newly added file A on the cloud side to the local database by renaming it, set dirty to 2, and return the local ID in the subsequent uplink synchronization process.

[0244] A7. If the judgment result of step A8 is that file B and file A are consistent, then the newly added file A on the cloud side will overwrite the local file B, and the UUID of the newly added file A on the cloud side will be recorded and returned to the local ID in the subsequent uplink synchronization process.

[0245] The following is through Figure 10 describe Figure 4 The method for determining the processing strategy for modified files in step S115 of the downlink synchronization process shown.

[0246] B1 received information from the cloud side regarding the modification of file D.

[0247] B2, search locally for a file E with the same UUID as file D.

[0248] B3. If there is no file E with the same UUID as file D, then write the cloud-side modified file D into the local database, record the UUID of the cloud-side modified file D, and set dirty to 0.

[0249] B4. If a file E exists with the same UUID as file D, check if there is a conflict between file D and file E.

[0250] In this embodiment of the application, files D and E have the same file name and identical data, which means there is no conflict; if either of them is inconsistent, there is a conflict.

[0251] B5. If there is no conflict between file D and file E, then modify file D in the cloud and overwrite local file E.

[0252] B6, if file D and file E have conflicts, then the cloud-side file is renamed to cover the local file, dirty is set to 2, and the cloud-side file is updated when uploading.

[0253] The following describes the determination manner of the processing strategy of the deleted file in step S109 of the downlink synchronization procedure shown in the figure. Figure 11 Description Figure 4 The following describes the determination manner of the processing strategy of the deleted file in step S109 of the downlink synchronization procedure shown in the figure.

[0254] C1, receiving the information that the cloud-side file F is deleted.

[0255] C2, searching locally whether there is a file G with the same local ID as file F.

[0256] C3, if no file G with the same local ID as file F is found locally, returning the local ID to the cloud side.

[0257] C4, if a file G with the same local ID as file F is found locally, deleting the local file G.

[0258] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0259] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the computer program can implement the steps in each method embodiment described above when running on an electronic device.

[0260] The embodiments of the present application also provide a computer program product, which, when running on an electronic device or a wireless router, enables the electronic device to implement the steps in each method embodiment described above.

[0261] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the computer program for instructing the related hardware to complete all or part of the processes in the above-mentioned embodiments can be stored in a computer readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiments when executed by a processor. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the first device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunications signal and a software distribution medium. For example, a U disk, a mobile hard disk, a magnetic disk or an optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunications signal.

[0262] The embodiments of the present application also provide a chip, which includes a processor and a memory. The processor is coupled with the memory. The processor invokes a computer program stored in the memory to implement the steps of any method embodiment of the present application. The chip can be a single chip or a chip module composed of multiple chips.

[0263] In the above embodiments, the description of each embodiment has its own focus. The parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0264] Those skilled in the art can appreciate that the units and method steps of the examples described in combination with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0265] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalent ones. Such modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A cloud synchronization method, characterized in that, include: The first electronic device obtains cloud-side synchronization version information from the cloud server. The cloud-side synchronization version information includes a cloud-side synchronization version number, a file type of the cloud-side synchronization file, and a cloud-side unique identifier. The cloud-side synchronization version number is the latest synchronization version number in the cloud server. The cloud-side synchronization version number is related to the number of cloud-side synchronizations. The cloud-side synchronization file is a synchronization file recorded in the historical synchronization process on the cloud server. The cloud-side synchronization file includes the synchronization file synchronized to the cloud server by the second electronic device. The first electronic device calculates the first difference between the cloud-side synchronization version number in the cloud-side synchronization version information and the local synchronization version number in the local synchronization version information of the first electronic device. The cloud server stores a maximum of N versions of cloud-side synchronization version information, and the local synchronization version number of the first electronic device is the latest synchronization version number synchronized from the cloud server in the first electronic device. When the first difference is less than or equal to N, the first electronic device compares the cloud-side unique identifier of the cloud-side synchronized file in the cloud-side synchronization version information with the cloud-side unique identifier of the local synchronized file in the local synchronization version information to obtain the difference file between the cloud-side synchronized file and the local synchronized file. The local synchronized file is the synchronized file recorded by the first electronic device in the historical synchronization process. The difference file represents the synchronized file that exists in the cloud-side synchronization version information but does not exist in the local synchronization version information. The difference file represents the file changes that the first electronic device is missing. The first electronic device obtains attribute information of difference files with file types of addition and modification from the cloud server, and the file type of the cloud-side synchronized files is addition, modification or deletion; The first electronic device determines the processing method for the difference file based on the file type and attribute information of the difference file; The first electronic device writes a first difference file to itself, and the first difference file is a difference file processed by writing. If the first difference is greater than N, the first electronic device synchronizes the cloud-side synchronization file corresponding to the cloud-side unique identifier recorded in the cloud-side synchronization version information of the cloud server from the cloud server.

2. The method as described in claim 1, characterized in that, The first electronic device determines the processing method for the difference file based on its file type and attribute information, including: If the file type of the difference file is newly added, the first electronic device searches for a first file in the electronic device that has the same cloud-side unique identifier as the difference file; If a first file with the same cloud-side unique identifier as the difference file is found in this electronic device, the first electronic device determines whether the hash values ​​of the difference file and the first file are consistent. If the hash values ​​of the difference file and the first file are the same, the first electronic device determines that the processing method of the difference file is: to write it into the electronic device by overwriting the first file; If the hash values ​​of the difference file and the first file are inconsistent, the first electronic device determines that the difference file should be processed by renaming it and writing it into the electronic device.

3. The method as described in claim 2, characterized in that, The method further includes: If the first electronic device does not find a first file with the same cloud-side unique identifier as the difference file in the electronic device, it searches for a second file with the same name as the difference file in the first path of the electronic device. The first path is the local path of the difference file recorded in the cloud server. If there is no second file with the same name as the difference file under the first path, the first electronic device determines that the processing method of the difference file is: write it to this electronic device; If a second file with the same name as the differing file exists under the first path, the first electronic device determines whether the hash values ​​of the differing file and the second file are the same; If the hash values ​​of the difference file and the second file are the same, the first electronic device determines that the processing method of the difference file is: to write it locally by overwriting the second file; If the hash values ​​of the difference file and the second file are inconsistent, the first electronic device determines that the difference file should be processed by renaming it and writing it into the electronic device.

4. The method according to any one of claims 1 to 3, characterized in that, The first electronic device determines the processing method for the difference file based on its file type and attribute information, including: If the file type of the difference file is "modified", the first electronic device searches for a third file with the same cloud-side unique identifier as the difference file within the electronic device. If no third file with the same cloud-side unique identifier as the difference file is found in this electronic device, then the first electronic device determines that the writing method of the difference file is: writing to this electronic device; If a third file with the same cloud-side unique identifier as the difference file is found in this electronic device, the first electronic device determines whether the hash values ​​of the difference file and the third file are consistent. If the hash values ​​of the difference file and the third file are the same, then the first electronic device determines that the writing method of the difference file is: writing to this electronic device; If the hash values ​​of the difference file and the third file are inconsistent, the first electronic device determines that the difference file is written to the electronic device by overwriting the third file.

5. The method according to any one of claims 1 to 3, characterized in that, The first electronic device determines the processing method for the difference file based on its file type and attribute information, including: If the file type of the difference file is deletion, the first electronic device searches for a fourth file that has the same cloud-side unique identifier as the difference file; If a fourth file exists that has the same cloud-side unique identifier as the difference file, then the first electronic device deletes the fourth file from its own electronic device.

6. The method as described in claim 1, characterized in that, After the first electronic device determines the processing method for the difference file based on its file type and attribute information, the method further includes: The first electronic device updates the local file version number in the local synchronization version information of the difference file to the cloud-side file version number in the cloud-side synchronization version information of the difference file; The first electronic device updates the local synchronization version number in the local synchronization version information to the cloud-side synchronization version number in the cloud-side synchronization version information.

7. The method as described in claim 6, characterized in that, After the first electronic device writes the first difference file to itself, the method further includes: The first electronic device edits the first difference file to obtain a second difference file; The first electronic device identifies the file type of the local file; The first electronic device sends the second difference file to the cloud server. The second difference file is a local file with the file type "modified". The first electronic device obtains the cloud-side unique identifier of the second difference file from the cloud server; The first electronic device increments the file version number of the second difference file in the locally synchronized version information by 1; The first electronic device increments the local synchronization version number in the local synchronization version information by 1.

8. The method according to any one of claims 1 to 3, characterized in that, After the first electronic device calculates the first difference between the cloud-side synchronization version number and the local synchronization version number, the method further includes: The first electronic device determines that the first difference is greater than N; The first electronic device records the cloud-side unique identifier of the cloud-side synchronized file in the cloud-side synchronized version information; The first electronic device obtains the attribute information of the cloud-side synchronization file corresponding to the cloud-side unique identifier from the cloud server; The first electronic device compares the attribute information of the cloud-side synchronized file with the attribute information of the local file to obtain the file type of the difference file, wherein the difference file is the cloud-side synchronized file. The first electronic device determines the processing method for the difference file based on the file type and attribute information of the difference file.

9. An electronic device, characterized in that, The electronic device includes a processor for invoking a computer program in memory to perform the method as described in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-8.

11. A chip, characterized in that, The chip includes a processor for calling a computer program in memory to perform the method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • File sharing method based on cloud storage

    CN102882985A