Cloud synchronization method, electronic equipment, storage medium and chip
The cloud server realizes file synchronization between multiple electronic devices, which solves the problem of inconvenience in file synchronization when users use different devices in different occasions, and realizes the efficiency and simplicity of file synchronization.
Patent Information
- Application Number
- CN202311584945.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2043-11-23
AI Technical Summary
When users use different electronic devices in different occasions, it is difficult for users to synchronize files between multiple devices, resulting in inconvenience in viewing or editing files.
The specific method includes: the first electronic device obtains the cloud-side synchronization version information from the cloud server, compares the difference between the cloud-side synchronization file and the local synchronization file, obtains the attribute information of the difference file, and determines the processing method of the difference file based on the file type and attribute information.
File synchronization between electronic devices is realized, with small amount of file data, simple process, and better synchronization. Users can view or edit file data synchronized by other electronic devices on cloud servers through one electronic device.
Smart Images

Figure CN120075239A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud synchronization technology, and in particular, to a cloud synchronization method, an electronic device, a storage medium, and a chip. Background Art
[0002] A user may have multiple electronic devices. For example, mobile phones, tablets, desktop computers, portable computers, etc. The user may use different electronic devices in different scenarios. For example, when the user is at work, they often use a desktop computer to edit files on the desktop computer; when the user is on a business trip, they may carry a portable computer and use the portable computer to edit files on the portable computer.
[0003] When the user uses a desktop computer to edit File A in the office and needs to view or edit File A on the desktop computer using a portable computer during a business trip, it will be inconvenient. Summary of the Invention
[0004] This application provides a cloud synchronization method, an electronic device, a storage medium, and a chip. The electronic device can obtain the files that other electronic devices have recently synchronized to the cloud server through the cloud server, and the process is simple.
[0005] To achieve the above object, the first aspect of this application adopts the following technical solution:
[0006] A cloud synchronization method, including:
[0007] The first electronic device obtains cloud-side synchronization version information from the cloud server. The cloud-side synchronization version information includes the file type of the cloud-side synchronized file. The cloud-side synchronized file is the synchronized file in the historical synchronization process recorded on the cloud server. The cloud-side synchronized file includes the synchronized file synchronized by the second electronic device to the cloud server;
[0008] 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 (uuid) of the local synchronized file in the local synchronization version information to obtain the differential file between the cloud-side synchronized file and the local synchronized file. The local synchronized file is the synchronized file in the historical synchronization process recorded by the first electronic device;
[0009] The first electronic device obtains the attribute information (such as path, name, hash value, etc.) of the differential files with the file types of new and modified from the cloud server;
[0010] The first electronic device obtains the processing method of the differential file according to the file type and attribute information of the differential file;
[0011] The first electronic device writes a first difference file in this electronic device, and the first difference file is a difference file with the processing method of writing.
[0012] In this application, through this cloud synchronization method, the difference files (files that the first electronic device has not yet synchronized from the cloud server) in the cloud-side synchronized files (files that have been synchronized on the cloud server due to changes) are obtained. The difference files have a small data volume and a simple process; in addition, since the processing method of the difference files is determined according to the file type and attribute information, the synchronization is better.
[0013] As an implementation manner of the first aspect, the cloud server stores at most N versions of cloud-side synchronization version information. 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; 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 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 of the cloud-side synchronized file and the local synchronized file, the method further includes:
[0015] The first electronic device calculates a first difference between the cloud-side synchronization version number and the local synchronization version number;
[0016] The first electronic device determines that the first difference is less than or equal to N.
[0017] In this application, setting the cloud server to store no more than a certain number (for example, N) of cloud-side synchronization version information can save cloud server space. When the first difference between the cloud-side synchronization version number and the local synchronization version number is less than or equal to N, the files in the local machine can be updated according to the difference file, improving the synchronization efficiency.
[0018] As an implementation manner of the first aspect, the first electronic device obtains the processing method 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 new, the first electronic device searches for a first file with the same cloud-side unique identifier as the difference file in this electronic device;
[0020] 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;
[0021] If the hash values of the difference file and the first file are the same, the first electronic device determines the processing method of the difference file as: writing it to this electronic device in a way that overwrites the first file;
[0022] If the hash values of the difference file and the first file are different, the first electronic device determines the processing method of the difference file as: writing it to this electronic device in a way that renames it.
[0023] As an implementation of the first aspect, the method further includes:
[0024] If the first electronic device does not find a first file with the same cloud - side unique identifier as the difference file in this electronic device, it searches for a second file with the same name as the difference file under the first path of this electronic device, where the first path is the local path of the difference file recorded in the cloud server;
[0025] If there is no second file with the same name as the difference file under the first path, the first electronic device determines the processing method of the difference file as: writing it to this electronic device;
[0026] If there is a second file with the same name as the difference file under the first path, the first electronic device determines whether the hash values of the difference file and the second file are the same;
[0027] If the hash values of the difference file and the second file are the same, the first electronic device determines the processing method of the difference file as: writing it to the local in a way that overwrites the second file;
[0028] If the hash values of the difference file and the second file are different, the first electronic device determines the processing method of the difference file as: writing it to this electronic device in a way that renames it.
[0029] As an implementation of the first aspect, the first electronic device obtains the processing method of the difference file according to the file type and attribute information of the difference file, including:
[0030] If the file type of the difference file is a modification, the first electronic device searches for a third file with the same cloud - side unique identifier as the difference file in this electronic device;
[0031] If the first electronic device does not find a third file with the same cloud - side unique identifier as the difference file in this electronic device, it determines the writing method of the difference file as: writing it to this electronic device;
[0032] If a third file with the same cloud - side unique identifier as the difference file is found on this electronic device, the first electronic device determines whether the hash values of the difference file and the third file are consistent;
[0033] If the hash values of the difference file and the third file are consistent, the first electronic device determines the writing method of the difference file as: writing to this electronic device;
[0034] If the hash values of the difference file and the third file are inconsistent, the first electronic device determines the writing method of the difference file as: writing to this electronic device in a way that overwrites the third file.
[0035] As an implementation manner of the first aspect, the first electronic device obtains the processing method 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 searches for a fourth file with the same cloud - side unique identifier as the difference file;
[0037] If there is a fourth file with the same cloud - side unique identifier as the difference file, the first electronic device deletes the fourth file in this electronic device.
[0038] As an implementation manner of the first aspect, after the first electronic device obtains the processing method 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 to this 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 the cloud - side unique identifier of the second differential file from the cloud server;
[0046] The first electronic device increments by 1 the file version number (etag) of the second differential file in the local synchronization version information;
[0047] The first electronic device increments by 1 the local synchronization version number (ctag) in the local synchronization version information.
[0048] As an implementation manner of the first aspect, 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:
[0049] The first electronic device determines that the first difference is greater than N;
[0050] The first electronic device records the cloud - side unique identifier of the cloud - side synchronized file in the cloud - side synchronization version information;
[0051] The first electronic device obtains the attribute information of the cloud - side synchronized 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 synchronized file with the attribute information of the local file to obtain the file type of the differential file, where the differential file is the cloud - side synchronized file;
[0053] The first electronic device obtains the processing method of the differential file according to the file type and attribute information of the differential file.
[0054] In a second aspect, there is provided an electronic device, including a processor, and the processor is configured to call a computer program stored in a memory to implement the method according to any one of the first aspect of the present application.
[0055] In a third aspect, there is provided a chip, including a processor, the processor is coupled to a memory, and the processor executes a computer program stored in the memory to implement the method according to any one of the first aspect of the present application.
[0056] In a fourth aspect, there is provided a computer - readable storage medium storing a computer program, and when the computer instruction runs on an electronic device, the electronic device is enabled to implement the method according to any one of the first aspect of the present application.
[0057] In a fifth aspect, an embodiment of the present application provides a computer program product, and when the computer program product runs on a device, the device is enabled to execute the method according to any one of the first aspect of the present application.
[0058] It can be understood that the beneficial effects of the above second to fifth aspects can be referred to the relevant descriptions in the above first aspect, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 FIG. is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application;
[0060] Figure 2 FIG. is a schematic diagram of a module for implementing a cloud synchronization scheme provided by an embodiment of the present application;
[0061] Figure 3 FIG. is a schematic diagram of a synchronization process of multiple electronic devices under the same account provided by an embodiment of the present application;
[0062] Figure 4 FIG. is a schematic diagram of an uplink synchronization process provided by an embodiment of the present application;
[0063] Figure 5 is Figure 4 FIG. is a schematic diagram of the content of cloud-side synchronization version information and local synchronization version information provided by the embodiment shown;
[0064] Figure 6 FIG. is a schematic diagram of an uplink synchronization process provided by an embodiment of the present application;
[0065] Figure 7 is Figure 6 FIG. is a schematic diagram of the content of cloud-side synchronization version information and local synchronization version information in the embodiment shown;
[0066] Figure 8 FIG. is a schematic diagram of a downlink synchronization process provided by an embodiment of the present application;
[0067] Figure 9 FIG. is provided by an embodiment of the present application Figure 4 and Figure 6 FIG. is a schematic diagram of the specific implementation process of S114 in;
[0068] Figure 10 FIG. is provided by an embodiment of the present application Figure 4 and Figure 6 FIG. is a schematic diagram of the specific implementation process of S115 in;
[0069] Figure 11 FIG. is provided by an embodiment of the present application Figure 4 and Figure 6 FIG. is a schematic diagram of the specific implementation process of S109 in. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0070] In the following description, specific details such as specific system architectures and technologies are presented for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, those skilled in the art should understand that the present application can also be implemented in other embodiments without these specific details.
[0071] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[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 associated objects, indicating that three relationships may exist; for example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0073] In addition, in the description of the specification and appended claims of the present application, the terms "first", "second", "third", "fourth", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0074] Reference to "one embodiment" or "some embodiments" or the like described in the specification of the present application 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. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "comprising", "including", "having", and their variants all mean "including but not limited to", unless otherwise specifically emphasized in another way.
[0075] A cloud synchronization method provided by an embodiment of the present application can be applied to an electronic device to back up 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), or other electronic devices. Among them, multiple electronic devices under the same account can all participate in the cloud synchronization method provided by the present application, and the specific type of the electronic device is not limited in the embodiments of the present application.
[0076] Figure 1 The schematic structural diagram of an electronic device is shown. The electronic device 100 may 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 headphone interface 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. Among them, the sensor module 180 may 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 schematically 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 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0078] The processor 110 may include one or more processing units. For example, the processor 110 may 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. Among them, different processing units may be independent devices or integrated in one or more processors. For example, the processor 110 is used to execute the cloud backup method in the embodiments of the present application.
[0079] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly retrieved from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0080] The internal memory 121 may be used to store computer-executable program code, and the executable program code includes instructions. The processor 110 executes 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 may include a program storage area and a data storage area.
[0081] In addition, the internal memory 121 may include a high-speed random access memory, and may also include non-volatile memories, 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 files, etc. in the embodiments of the present application may all 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 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110, or some functional modules of the audio module 170 may be provided 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 hands-free calls through the speaker 170A.
[0084] The touch sensor 180K, also known as a "touch panel". The touch sensor 180K may be provided on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch control screen". The touch sensor 180K is used to detect touch operations acting thereon or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual outputs related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K may also be provided on the surface of the electronic device 100, at a different position from the display screen 194. For example, operations in the cloud backup interface provided in the embodiments of the present application.
[0085] The electronic device 100 realizes the display function through the GPU, the display screen 194, the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which 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 or an active matrix organic light-emitting diode (AMOLED), a flexible 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 may include one or N display screens 194, where N is a positive integer greater than 1. For example, in the embodiments of the present application Figure 2 The interface shown is displayed by the display.
[0087] The camera 193 is used to capture static images or videos. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is 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 a cloud synchronization method, as long as it can communicate according to a cloud synchronization method provided by the embodiments of the present application by running the code recording a cloud synchronization method of the embodiments of the present application. For example, the execution subject of a cloud synchronization method provided by the embodiments of the present application may be a functional module in the electronic device that can call and execute programs, or a communication device applied to the electronic device, such as a chip.
[0089] A user may have multiple electronic devices, such as mobile phones, tablets, desktops, portable computers, etc. The user may use different electronic devices in different scenarios. For example, when the user is at work, they often use a desktop computer to edit files in the desktop computer; when the user is on a business trip, they may carry a portable computer and use the portable computer to edit files in the portable computer.
[0090] When a user edits File A on a desktop computer in an office and then needs to view or edit File A on the desktop computer during a business trip using a portable computer, it will be inconvenient.
[0091] The embodiment of the present application provides a cloud synchronization solution, which can synchronize the file data in one electronic device to a cloud server, and other electronic devices synchronize the file data in the cloud server to the local, so that the user can view or edit the file data synchronized on the cloud server by one electronic device through another electronic device.
[0092] In order to enable the user to obtain the latest file data when viewing or editing file data using an electronic device, before each electronic device views the file data, it first executes a downstream synchronization process to download the latest synchronized file data in the cloud server to the local (this electronic device); then edits and processes the latest synchronized file data locally; after the editing and processing, it executes an upstream synchronization process to synchronize the locally edited file data to the cloud server, so that the cloud server stores the latest edited and processed file data, so that other electronic devices can obtain the latest edited file data from the cloud server when editing the same file again.
[0093] Refer to Figure 2 , which is a schematic diagram of the principle of the cloud synchronization solution provided by the embodiment of the present application. The embodiment of the present application takes the cloud synchronization solution of the gallery application in an electronic device as an example. In practical applications, other file data can also be synchronized, and the present application does not make any restrictions.
[0094] An electronic device has a gallery application and a cloud application. The gallery application can store pictures and videos. The user can view pictures and videos in the gallery application, can also add pictures and videos in the gallery application, can also delete pictures and videos in the gallery application, and can also edit and process pictures and videos in the gallery application (for example, add graffiti to pictures, etc.). The cloud application is used to realize the synchronization of 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 realize the synchronization of various information in the gallery application. The various information includes: the attribute information of each album in the gallery (such as name, creation time, number of files, etc.), the files themselves in the gallery application (such as picture files and video files), the attribute information of each file in the gallery application (such as name, size, geographical location, etc.), etc. Among them, there are also various albums in the gallery, such as albums of the same person, screenshot albums, photo albums, favorite albums, Bluetooth sharing albums, etc.
[0097] The synchronous data management module is also used to manage the cloud - side unique identifiers (UUIDs) of each synchronous file, the etags of each synchronous file (recording the latest synchronous version number and file type of the synchronous file), and the ctag of cloud synchronization (the latest synchronous version number of cloud synchronization).
[0098] The synchronous data management module is also used to obtain differential files during the down - link synchronization process, handle the writing method when dealing with file conflicts, etc.; identify locally added, deleted, and modified data during the up - link synchronization process and generate corresponding thumbnails (or LCD images); and is also responsible for the download management of file thumbnails (or LCD thumbnails) and source files.
[0099] The DB storage module is used to store structured data in the DB, store thumbnails in a specified hidden directory, and store original files in corresponding directories.
[0100] The receiving module is used to receive synchronous broadcasts sent by cloud applications, etc.
[0101] The providing module is used to respond to the cloud application's query of the gallery's capabilities and synchronization trigger operations, etc.
[0102] The SDK is a bridge for communication between the gallery application and the cloud application, providing various interfaces for the gallery application to implement different functions. For example, call interfaces are provided to the gallery application, and the gallery application triggers synchronization, status queries, file downloads, etc. through the call interfaces; callback interfaces are provided to the gallery application, and the gallery application controls the down - link and up - link processes of synchronization through the callback interfaces.
[0103] The cloud server has a synchronization service and a storage service. The synchronization service is used to communicate with the electronic device to implement various functions, and the storage service is used 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 achieve the synchronization of data in multiple electronic devices on the cloud server. Taking the cloud synchronization of multiple electronic devices as an example below, the cloud synchronization solution provided by the embodiments of the present application is described.
[0105] Refer to Figure 3 , for the cloud synchronization process among electronic device A, electronic device B, and electronic device C provided by the embodiments of the present application. Each electronic device can act as the first electronic device to execute the down - link synchronization process and the up - link synchronization process.
[0106] Electronic devices A, B, and C log in to the same account; when the data in the gallery application of any one of electronic devices A, B, and C changes, the changed electronic device (e.g., electronic device A) and the other electronic devices (e.g., electronic devices B and C) will both execute the cloud synchronization process.
[0107] Step (0), the gallery application of electronic device A receives an operation from the user.
[0108] In the embodiments of the present application, the operations that can trigger synchronization include multiple situations:
[0109] Situation (1) The operation of the user clicking on the icon of the gallery application to open the gallery application.
[0110] Situation (2) After the gallery application is opened, the operation of the user opening any photo album.
[0111] Situation (3) The operation of the user opening the editing interface of any file in the gallery application.
[0112] Other operations will not be exemplified one by one. In practical applications, the operations or conditions for the electronic device to execute the synchronization process can be set according to actual needs. For example, it can also be set to execute the cloud synchronization process at fixed intervals.
[0113] Of course, in order to make the editing and processing of the file based on the latest version of the file data on the cloud server, the synchronization process is usually triggered before triggering the display of the detailed content of the file.
[0114] Step (1) In response to this operation, electronic device A executes the downlink synchronization process to synchronize the synchronized files in the cloud server to electronic device A. Among them, the synchronized files are: the files that have changed on the cloud server during the period between the last synchronization and the current synchronization by other electronic devices. The changed files can be new files, modified files, deleted files, etc.
[0115] After the downlink synchronization process is completed, the user can edit and process the downloaded latest version of the file. After the editing and processing are completed, the downlink synchronization process can be triggered to synchronize the latest version of the file to the cloud server, so that when the user views the file on other electronic devices, the latest version of the file data can be downloaded.
[0116] Step (2) Execute the uplink synchronization process to synchronize the changed files in the local electronic device to the cloud server. The changed files are: the files that have changed in the local electronic device during the period between the last synchronization and the current synchronization. The changed files can also be new files, modified files, deleted files, etc.
[0117] After the electronic device A finishes the uplink synchronization process in step (3), it sends a synchronization instruction to the cloud server.
[0118] In practical applications, 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] After the cloud server responds to the synchronization instruction of the electronic device A in step (4), when it determines that there are changed files, it sends a synchronization broadcast, and this synchronization broadcast can be sent to the electronic device B and the electronic device C that are currently logged in to the same account as the electronic device A. When it determines that there are no changed files, the synchronization broadcast is no longer issued.
[0120] For the electronic device B, the following process is executed:
[0121] After the electronic device B receives the synchronization broadcast sent by the cloud server in step (5), it executes the downlink synchronization process.
[0122] In this step, the changed files (i.e., synchronization files) uploaded by the electronic device A to the cloud server can be downloaded to the electronic device B, and this process is similar to step (1).
[0123] The electronic device B executes the uplink synchronization process in step (6).
[0124] In the embodiment of the present application, if there are also changed files on the electronic device B during the period between the last synchronization and the current synchronization of the electronic device B after the electronic device B finishes the downlink synchronization process, the uplink synchronization process also needs to be executed.
[0125] Theoretically, before each time the electronic device A edits a file, it will trigger the execution of the downlink synchronization process, and after editing the file, it will also execute the uplink synchronization process. Therefore, in the electronic device A, except for the files changed this time, there may be no other changed files. However, it is possible that the electronic device A has made a change to the file when the account is not logged in. Therefore, when executing step (6), there may still be other changed files.
[0126] Similarly, the electronic device B is the same as the electronic device A. Each time a change operation is performed on a file, it needs to trigger the execution of the downlink synchronization process first and then the uplink synchronization process. Therefore, after the electronic device B executes to step (5), there will be no changed files, so the process (6) will not be executed. However, it is possible that the electronic device B has made a change to the file when the account is not logged in. Therefore, after executing step (5), the process (6) will still be executed.
[0127] An electronic device usually performs a downlink synchronization process first and then an uplink synchronization process. In this way, when the electronic device has not logged in to an account, the missed changed files can be downloaded to the electronic device first, enabling the user to obtain the latest synchronized files from the cloud server.
[0128] Of course, in actual applications, if there are no changed files locally after the electronic device B executes step (5), there is no need to execute step (6).
[0129] As another example, if the files in the gallery application of the electronic device B change, after the uplink synchronization process of the electronic device B ends, the cloud server will also trigger the electronic device A and the electronic device C to execute the synchronization process to synchronize the latest synchronized files uploaded to the cloud to the electronic device A and the electronic device C.
[0130] If none of the files in the gallery application of the electronic device B have changed, step (6) will not be executed, and the electronic device A and the electronic device C will not be triggered to execute the synchronization process again.
[0131] For the electronic device C, it executes the same process as the electronic device B:
[0132] In step (5), after the electronic device C receives the synchronization broadcast sent by the cloud server, it executes the downlink synchronization process.
[0133] In step (6), the electronic device C executes the uplink synchronization process.
[0134] The detailed process will not be elaborated here.
[0135] Refer to Figure 4 , which is a schematic diagram of the downlink synchronization process provided by the embodiment of the present application. This schematic diagram shows the process of the electronic device synchronizing data in the gallery application from the cloud server.
[0136] S101, the gallery application receives a file viewing operation.
[0137] In the embodiment of the present application, the user can perform operations such as deleting, moving, copying, and editing files in the gallery in the gallery application. Before performing these operations, it is first necessary to view the file. The files in the gallery application include photos and videos.
[0138] 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 the account A logged in by this electronic device.
[0139] In the embodiment of the present application, the basis for multiple electronic devices to achieve cloud synchronization of the gallery application is that 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 implemented through the SDK, which is not shown in the figure.
[0141] S103. After the cloud application receives the request for obtaining the cloud-side synchronization version, it sends a request for obtaining the cloud-side synchronization version to the cloud server, and this request carries account A.
[0142] S104. After the cloud server receives the request for obtaining the cloud-side synchronization version, it looks up the cloud-side synchronization version information of the gallery application with the carried account A.
[0143] Refer to Figure 5 As shown, the cloud-side synchronization version information (cloud) includes: the cloud-side synchronization version number (this information is recorded in ctag), the cloud-side unique identifier (uuid) of the cloud-side synchronization file, the synchronization version number (this information is recorded in etag), and the file type (this information is recorded in item).
[0144] The cloud-side synchronization version number ctag = 50, indicating that the changed files have been synchronized to the cloud server 50 times. After the changed files are synchronized to the cloud server, they are recorded as synchronized files, and the changed files synchronized each time may be different.
[0145] The cloud-side unique identifier uuid of the cloud-side synchronization file is the unique identifier assigned by the cloud server to each synchronized file, used to distinguish different synchronized files. For example, synchronized file 1, synchronized file 2, synchronized file 3, and synchronized file 4.
[0146] The synchronization version number etag of the cloud-side synchronization file 3 = 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 upward to the cloud server (the last synchronization of the cloud server). The file type can be set to: new, modified, deleted, etc.
[0148] A new file is a file that originally did not exist in the cloud server and was uploaded from the electronic device side.
[0149] A modified file is a file that originally existed in the cloud server and has changed from the electronic device side (for example, the uuid is the same, the file name is the same, and the hash value has changed).
[0150] A deleted file is a file that originally existed in the cloud server but was deleted from another electronic device side.
[0151] 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, it compares the ctag in the cloud - side synchronization version information with the ctag in the local synchronization version information to determine the synchronization type: incremental synchronization (the difference is less than or equal to 20).
[0153] Refer to Figure 5 the local synchronization version information before the client's downlink synchronization in. The local synchronization version information is the cloud - side synchronization version information of the most recent synchronization stored locally by the electronic device. Therefore, the specific meaning of the local synchronization version information is the same as that of the cloud - side synchronization version information, and no detailed explanation will be given here.
[0154] Refer to Figure 5 As shown, according to the ctag = 45 on the client side of the electronic device, it is determined that the last downlink synchronization from the cloud server on this electronic device was the 45th synchronization, and file 2 was synchronized during the 45th downlink synchronization.
[0155] The difference files between the cloud - side synchronization version information and the local synchronization version information are the synchronization files missing on this electronic device. Therefore, the difference files can be determined based on the difference between the two.
[0156] Theoretically, when the files in the gallery application of any electronic device change, the electronic device synchronizes the file change situation to the cloud server. The cloud server maintains the latest file change situation of the gallery application, and the cloud server can also synchronize the latest file change situation of the gallery application to other electronic devices.
[0157] However, in actual applications, users may use an electronic device without logging in to an account to process the local files of the electronic device, which causes this electronic device to be unable to synchronize the latest file change situation of the gallery application of this electronic device to the cloud server, resulting in out - of - sync file data between the cloud server and the gallery application in the electronic device.
[0158] Or, users use an electronic device logged in to an account to process the local files of the electronic device. This electronic device synchronizes the latest file change situation of the gallery application of this electronic device to the cloud server through the synchronization process. However, since another electronic device is not logged in to the same account, this other non - logged - in - to - the - same - account electronic device is unable to synchronize the latest file change situation of the gallery application on the cloud server to this electronic device.
[0159] The above situations will all cause the received cloud - side ctag and the ctag stored locally by the electronic device to be possibly inconsistent.
[0160] The cloud server does not retain every synchronization record. Usually, a certain number of synchronization records are retained. For example, the most recent 20 ctag versions can be retained. Therefore, when the version number difference between ctag1 on the cloud side and ctag2 on the electronic device side is less than or equal to 20, search for the synchronization files that exist in ctag1 but not in ctag2 to obtain the difference files, which are the file change situations missing from the electronic device. Based on the relevant information of these difference files, the electronic device can update the files in this electronic device to the latest version of the files.
[0161] As an example, in electronic device A, the etag version of file 1 is 32, the etag version of file 2 is 45, and the ctag version is 45;
[0162] On the cloud server, the etag version of file 1 is 32, the etag version of file 2 is 45, the etag version of file 3 is 48, the etag version of file 4 is 50, and the ctag version is 50.
[0163] Calculate the difference between the ctag version of the cloud server and the ctag version recorded by electronic device A as 15.
[0164] As mentioned above, the cloud server can retain the synchronization information of the most recent 20 ctag versions. If the version difference between electronic device A and the cloud server is less than 20, it means that file 1 and file 2 in electronic device A are synchronized with the cloud server. Therefore, electronic device A only needs to perform incremental synchronization, that is, synchronize the difference files between the electronic device and the cloud server: file 3 and file 4.
[0165] S107, the cloud application sends the cloud-side synchronization version information of the difference files to the gallery application according to the synchronization type: ctag, uu id, etag, and item.
[0166] S108, after the gallery application receives the cloud-side synchronization version information of the difference files, it records the cloud-side unique identifier.
[0167] S109, the gallery application deletes the difference files with the file type of deletion from the local. Specifically, refer to the description of the subsequent steps.
[0168] S110, the gallery application sends a downstream request for the attribute information of the difference files 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 downstream request for the attribute information, it sends a downstream request for the attribute information of the difference files to the cloud server (carrying the cloud-side unique identifier).
[0170] S112, after the cloud server receives the downlink request for attribute information, it sends the attribute information of the differential file corresponding to the cloud-side unique identifier to the cloud application: name, size, file path, Hash value, etc.
[0171] S113, after the cloud application receives the attribute information of the differential file, it sends the attribute information of the differential file to the gallery application: name, size, file path, Hash value, etc.
[0172] S114, compare the attribute information of the differential file with the file type of "newly added" with the attribute information of the local file to obtain the processing strategy for the differential file of the newly added type: overwrite write, download and rename write, direct write.
[0173] Specifically, refer to the description of the subsequent embodiments.
[0174] S115, compare the attribute information of the differential file with the file type of "modified" with the attribute information of the local file to obtain the processing strategy for the differential file of the modified type: overwrite write, download and rename write, direct write.
[0175] Specifically, refer to the description of the subsequent embodiments.
[0176] S116, the gallery application updates the etag of each differential file.
[0177] Taking Figure 5 file 3 in as an example, update the etag to 48; update the etag of file 4 to 50.
[0178] S117, the gallery application sends the etag of the differential file and the cloud-side unique identifier to the cloud application.
[0179] S118, after the cloud application receives the etag of the differential file and the cloud-side unique identifier, it sends a download request for the source file (such as a thumbnail or the original file, etc.) of the differential file with the processing strategy of "write" 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, it sends the corresponding source file to the cloud application.
[0181] S120, after the cloud application receives the source file, it 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 a way that overwrites the local data, or in a way that renames it, or can also be directly written.
[0184] S122, The gallery application sends a response indicating the completion of this batch of files to the cloud application.
[0185] In the embodiment of the present application, the process of downloading files from the cloud server is executed cyclically. That is, after downloading a batch of files, the next batch of files is downloaded. Each time a batch of files is downloaded, steps S118 to S122 need to be cyclically executed. Each time the cloud application receives a response indicating the completion of this batch of files, it checks whether all files have been downloaded.
[0186] S123, After the cloud application receives the response indicating the completion of this batch of files, it checks whether all files have been downloaded.
[0187] S124, The cloud application updates the ctag of this synchronization. For example, it updates the ctag to 50.
[0188] After the downstream process ends, the local synchronization version information on the electronic device side refers to Figure 5 the content after the client's downstream synchronization in
[0189] As shown in step S106, the cloud server does not retain every synchronization record. Usually, a certain number of synchronization records are retained. For example, the most recent 20 (for example only) ctag versions can be retained. 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 that exist in ctag1 but not in ctag2 are found, and the difference files, which are the file change situations missing from the electronic device, are obtained. Based on the relevant information of these difference files, the files in this electronic device can be updated to the latest version of the 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 part between them. Therefore, it is necessary to determine the change situations of each synchronization file based on the other information of all the synchronization files on the cloud side and the relevant information in the local files. Thus, based on the change situations of all these synchronization files, the files in this electronic device can be updated to the latest version of the files.
[0191] Figure 4 Step S106 in
[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 45, and the ctag version is 45;
[0193] On the cloud server, the etag version of file 1 recorded 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] Calculate the difference between the ctag version on the cloud server and the ctag version recorded by electronic device B, which is 21.
[0195] As mentioned above, the cloud server can retain the synchronization information of the most recent 20 ctag versions. If the version difference between electronic device B and the cloud server is greater than 20, it means that files 1 and 2 in electronic device B and files 1 and 2 in the cloud server can no longer be synchronized through the recorded change situations. Therefore, electronic device B needs to perform a full synchronization, that is, synchronize all 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 differential file: ctag, uu id, etag. The file type no longer needs to be transmitted, and the electronic device needs to compare the attribute information of all cloud-side synchronized files and local files to determine the file type.
[0197] S108, the cloud-side synchronization version information of the differential file: ctag, uu id, etag.
[0198] Since the file type cannot be determined at this time, S109 is not executed temporarily.
[0199] S110 to S113 can refer to the description in the above embodiments. The difference is that in incremental synchronization, the attribute information of the differential file is obtained; in full synchronization, the attribute information of all cloud-side synchronized files is obtained.
[0200] S125, after obtaining the attribute information of all cloud-side synchronized files, compare it with the attribute information of local files to obtain the types of each file:
[0201] There is uuid1 in the cloud-side synchronized file, but there is no uuid1 locally, so it is determined that uuid1 is newly added;
[0202] There is no uuid2 in the cloud-side synchronized file, but there is uuid2 locally, so it is determined that uuid2 is deleted;
[0203] There is uuid3 in the cloud-side synchronized file and there is uuid3 locally. After comparing, the hash values are different, so 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 list them one by one.
[0205] S109 is moved to be executed after S125.
[0206] Steps S114 to S118, in incremental synchronization, are differential files, and in full synchronization, are cloud-side synchronization files. Others are not elaborated here.
[0207] The downlink synchronization process is used to synchronize the synchronization files of the cloud server to the electronic device; the uplink synchronization process is used to synchronize the changed files of the electronic device to the cloud server.
[0208] After the downlink synchronization process is completed, the uplink synchronization process needs to be executed. The uplink synchronization process can specifically refer to Figure 8 as shown. In practical applications, the latest version of the file can be downloaded by viewing the file; after the user views the file, the file is edited; 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, it identifies the addition, deletion, modification, and copying of local files, etc. These files are recorded as changed files.
[0211] In this application, after a file is newly added locally, the file is marked as a newly added file. After the file is modified locally, the file is marked as a modified file. When a local file is copied under another file path, the copied new file is marked as a copied file; after a file is deleted locally, the information of the deleted file is marked.
[0212] S203, the gallery application sends the attribute information (local unique identifier, size, name, etc.) of the changed files to the cloud application.
[0213] S204, after the cloud application receives the attribute information, it sends a changed file reading request to the gallery application according to the attribute information.
[0214] S205, the cloud application reads the changed files from the gallery application.
[0215] S206, the cloud application sends the read changed files and the attribute information of the changed files to the cloud server.
[0216] S207, after the cloud server receives the changed files and the attribute information, it stores the changed files and the attribute information.
[0217] S208, the cloud server sends an upload success message to the cloud application, and this message carries the cloud-side unique identifier of the successfully uploaded file.
[0218] S209, after the cloud application receives the upload success message, it uploads the structured data.
[0219] The structured data aggregates partial attribute information of each file to be uploaded in batches for database upload.
[0220] S210, after receiving the structured data, the cloud server sends a message indicating successful upload of the structured data to the cloud application.
[0221] S211, after receiving the message indicating successful upload of the structured data, the cloud application sends the cloud-side unique identifier received previously to the gallery application.
[0222] S212, after receiving the cloud-side unique identifier of the local file, the gallery application updates the etag version number, cloud-side unique identifier, file type, etc.
[0223] S213, the gallery application sends the etag version number, cloud-side unique identifier, file type, etc. 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 cyclically, that is, after uploading a batch of files, the next batch of files is uploaded, and steps S206 to S213 need to be cyclically executed for each batch of files uploaded. Each time the cloud application receives the information of an etag, it checks whether all the changed files have been downloaded.
[0225] S214, after receiving 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] Continue with Figure 5 the example shown. After the downstream synchronization process, the etag of file 3 is 48 and the ctag is 50; after the user modifies file 3 and executes the upstream synchronization process, after the upstream synchronization process, since this upstream synchronization process is the 51st synchronization to the cloud server, the etag of file 3 is updated to 51 and the ctag is updated to 51.
[0228] Next, through Figure 9 description Figure 4 the method for determining the processing strategy for newly added files in step S114 of the downstream synchronization process shown.
[0229] A1, receive the information of newly added file A on the cloud side.
[0230] In the embodiment of the present application, the attribute information of the newly added file A on the cloud side includes: the uuid of file A, name, file path of file A, etc.
[0231] Since the gallery applications of multiple electronic devices can be synchronously updated in 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 in electronic device B when electronic device B synchronously updates this version of file A in the cloud server. The attribute information of file A received by electronic device A in the downlink synchronization process is the file path of file A in electronic device B.
[0232] A2. Check whether there is a file B with the same uuid as file A in the local area.
[0233] A3. If there is no file B with the same uuid as file A this time, check whether there is a file C with the same name as file A in the same path as file A.
[0234] A4. If there is no file C with the same name as file A in the same path as file A, write the newly added file A from the cloud side to the local database, record the uuid of the newly added file A from the cloud side, and set dirty to 0.
[0235] In the embodiments of the present application, if there is no file C with the same name as file A in the same path, it means that the uuid and file name of file A and the files in the local area are different, indicating that the newly added file A is a newly added file for this electronic device. Therefore, the newly added file A from the cloud side can be written to the local database, and at the same time, the uuid of the newly added file A from the cloud side needs to be recorded, and dirty is set to 0 (no need to upload when going upstream).
[0236] A5. If there is a file C with the same name as file A in the same path as file A, determine whether the data of file A and the data of file C are consistent.
[0237] A6. If the data of file A and the data of file C are inconsistent, write the newly added file A from the cloud side to the local database in a renamed manner, set dirty to 2, and send the local ID of the renamed file A in the subsequent upstream process.
[0238] In the embodiments of the present application, if the data of file A and file C are inconsistent, but they are files with the same name in the same file path. Therefore, file A and file C may belong to different versions of the same file. In this case, file A needs to be written in a renamed manner, set dirty to 2 (need to upload when going upstream), so as to be synchronized to the cloud server in the subsequent upstream synchronization process, and the local ID of file A also needs to be transmitted together in the upstream process.
[0239] A7. If the data of file A and the data of file C are consistent, overwrite the local file C with the newly added file A from the cloud side, record the uuid of the newly added file A from the cloud side, and transmit the local ID in the subsequent upstream synchronization process.
[0240] In the embodiments of the present application, if the data of File A and File C is consistent and they are files with the same name under the same file path, therefore, File A and File C are the same file. In this case, the newly added File A on the cloud side can overwrite File C, record the uuid of the newly added File A on the cloud side, set dirty to 0, and return the local ID.
[0241] As mentioned above, in step A2, when checking whether there is a File B with the same uuid as File A locally, there is still a 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 is consistent.
[0243] A6, if the judgment result in step A8 is that the data of File B and File A is inconsistent, then write the newly added File A on the cloud side to the local database in a renamed manner, set dirty to 2, and return the local ID in the subsequent upstream synchronization process.
[0244] A7, if the judgment result in step A8 is that the data of File B and File A is consistent, then overwrite the local File B with the newly added File A on the cloud side, record the uuid of the newly added File A on the cloud side, and return the local ID in the subsequent upstream synchronization process.
[0245] Next, through Figure 10 description Figure 4 the method for determining the processing strategy for modified files in step S115 of the following downstream synchronization process is shown.
[0246] B1, receive the information that the file D on the cloud side is modified.
[0247] B2, check whether there is a File E with the same uuid as File D locally.
[0248] B3, if there is no File E with the same uuid as File D, then write the modified File D on the cloud side to the local database, record the uuid of the modified File D on the cloud side, and set dirty to 0.
[0249] B4, if there is a File E with the same uuid as File D, then check whether there is a conflict between File D and File E.
[0250] In the embodiments of the present application, if the file names and data of File D and File E are the same, it is conflict-free; if any one is inconsistent, it is conflicted.
[0251] B5, if there is no conflict between File D and File E, then overwrite the local File E with the modified File D on the cloud.
[0252] B6. If there is a conflict between file D and file E, the file on the cloud side is renamed and then overwrites the local file, sets dirty to 2, and updates it during uplink.
[0253] The following Figure 11 describes Figure 4 the determination method of the processing strategy for the deleted file in step S109 of the downlink synchronization process shown below.
[0254] C1. Receive the information that the file F on the cloud side is deleted.
[0255] C2. Check whether there is a file G on the local side with the same local ID as file F.
[0256] C3. If no file G with the same local ID as file F is found on the local side, return the local ID to the cloud side.
[0257] C4. If a file G with the same local ID as file F is found on the local side, delete the local file G.
[0258] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0259] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program runs on an electronic device, it can implement the steps in each of the above method embodiments.
[0260] The embodiments of the present application also provide a computer program product. When the computer program product runs on an electronic device or a wireless router, the electronic device can implement the steps in each of the above method embodiments.
[0261] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-mentioned embodiment methods of this application, a computer program can be used to instruct relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code to a first device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electrical carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.
[0262] The embodiment of the present application also provides a chip. The chip includes a processor, and the processor is coupled to a memory. The processor calls the 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 descriptions of each embodiment have their own focuses. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0264] Those of ordinary skill in the art can realize that the units and method steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0265] The above embodiments are only used to illustrate the technical solutions of this application, rather than to limit it; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of this application, and should all be included in the protection scope of this application.
Claims
1. A cloud synchronization method, characterized in that, it includes: The first electronic device obtains cloud-side synchronization version information from the cloud server. The cloud-side synchronization version information includes the file types of the cloud-side synchronized files. The cloud-side synchronized files are the synchronized files in the historical synchronization process recorded on the cloud server, and the cloud-side synchronized files include the synchronized files synchronized by the second electronic device to the cloud server; The first electronic device compares the cloud-side unique identifiers of the cloud-side synchronized files in the cloud-side synchronization version information with the cloud-side unique identifiers of the local synchronized files in the local synchronization version information to obtain the differential files between the cloud-side synchronized files and the local synchronized files. The local synchronized files are the synchronized files in the historical synchronization process recorded by the first electronic device; The first electronic device obtains the attribute information of the differential files with the file types of new and modified from the cloud server; The first electronic device obtains the processing method of the differential files according to the file types and attribute information of the differential files; The first electronic device writes the first differential file into this electronic device. The first differential file is the differential file with the processing method of writing.
2. The method according to claim 1, characterized in that, At most N versions of cloud-side synchronization version information are stored in the cloud server. The cloud-side synchronization version information further includes: the cloud-side synchronization version number, and the local synchronization version information includes the local synchronization version number. The cloud-side synchronization version number is the latest synchronization version number in the cloud server; the local synchronization version number is the latest synchronization version number in the first electronic device; Before the first electronic device compares the cloud-side unique identifiers of the cloud-side synchronized files in the cloud-side synchronization version information with the cloud-side unique identifiers of the local synchronized files in the local synchronization version information to obtain the differential files between the cloud-side synchronized files and the local synchronized files, the method further includes: The first electronic device calculates the first difference between the cloud-side synchronization version number and the local synchronization version number; The first electronic device determines that the first difference is less than or equal to N.
3. The method according to claim 1 or 2, characterized in that, The first electronic device obtains the processing method of the differential files according to the file types and attribute information of the differential files, including: If the file type of the differential file is new, the first electronic device searches for the first file with the same cloud-side unique identifier as the differential file in this electronic device; If the first file with the same cloud-side unique identifier as the differential file is found in this electronic device, the first electronic device determines whether the hash values of the differential file and the first file are the same; If the hash values of the differential file and the first file are the same, the first electronic device determines that the processing method of the differential file is: writing into this electronic device in the way of overwriting the first file; If the hash values of the differential file and the first file are different, the first electronic device determines that the processing method of the differential file is: writing into this electronic device in the way of renaming.
4. The method according to claim 3, It is characterized in that The method further includes: If the first electronic device fails to find a first file in the present electronic device that has the same cloud - side unique identifier as the difference file, then the first electronic device searches for a second file with the same name as the difference file under the first path of the present electronic device, where 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, then the first electronic device determines the processing method of the difference file as: writing it into the present electronic device; If there is a second file with the same name as the difference file under the first path, then the first electronic device determines whether the hash values of the difference file and the second file are consistent; If the hash values of the difference file and the second file are consistent, then the first electronic device determines the processing method of the difference file as: writing it into the local by overwriting the second file; If the hash values of the difference file and the second file are inconsistent, then the first electronic device determines the processing method of the difference file as: writing it into the present electronic device by renaming.
5. The method according to any one of claims 1 to 4, It is characterized in that The first electronic device obtaining the processing method of the difference file according to the file type and attribute information of the difference file includes: If the file type of the difference file is modification, then the first electronic device searches for a third file in the present electronic device that has the same cloud - side unique identifier as the difference file; If the first electronic device fails to find a third file in the present electronic device that has the same cloud - side unique identifier as the difference file, then the first electronic device determines the writing method of the difference file as: writing it into the present electronic device; If the first electronic device finds a third file in the present electronic device that has the same cloud - side unique identifier as the difference file, then 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 consistent, then the first electronic device determines the writing method of the difference file as: writing it into the present electronic device; If the hash values of the difference file and the third file are inconsistent, then the first electronic device determines the writing method of the difference file as: writing it into the present electronic device by overwriting the third file.
6. The method according to any one of claims 1 to 5, It is characterized in that The first electronic device obtaining the processing method of the difference file according to the file type and attribute information of the difference file includes: If the file type of the difference file is deletion, then the first electronic device searches for a fourth file that has the same cloud - side unique identifier as the difference file; If there is a fourth file that has the same cloud - side unique identifier as the difference file, then the first electronic device deletes the fourth file in the present electronic device.
7. The method according to claim 1, It is characterized in that After the first electronic device obtains the processing method of the difference file according to the file type and attribute information of the difference file, the method further includes: The first electronic device updates the local file version number in the local synchronization version information of the differential file to the cloud - side file version number in the cloud - side synchronization version information of the differential 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.
8. The method according to claim 7, wherein, after the first electronic device writes the first differential file to this electronic device, the method further includes: The first electronic device edits the first differential file to obtain a second differential file; The first electronic device identifies the file type of the local file; The first electronic device sends the second differential file to the cloud server, and the second differential file is a local file with the file type of modification; The first electronic device obtains the cloud - side unique identifier of the second differential file from the cloud server; The first electronic device increments the file version number of the second differential file in the local synchronization version information by 1; The first electronic device increments the local synchronization version number in the local synchronization version information by 1.
9. The method according to any one of claims 2 to 8, wherein, 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 synchronization version information; The first electronic device obtains the attribute information of the cloud - side synchronized 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 differential file, and the differential file is the cloud - side synchronized file; The first electronic device obtains the processing method of the differential file according to the file type and attribute information of the differential file.
10. An electronic device, wherein, the electronic device includes a processor, and the processor is configured to call a computer program in a memory to execute the method according to any one of claims 1 - 9.
11. A computer - readable storage medium, wherein, the computer - readable storage medium stores computer instructions, and when the computer instructions run on an electronic device, the electronic device is caused to execute the method according to any one of claims 1 - 9.
12. A chip, wherein, the chip includes a processor, and the processor is configured to call a computer program in a memory to execute the method according to any one of claims 1 - 9.
Citation Information
Patent Citations
File sharing method based on cloud storage
CN102882985A
Version synchronization method and device of cross-version control system
CN113971041A
File synchronization method and device, electronic equipment and readable storage medium
CN115086345A
File cloud synchronization method and system and electronic equipment
CN115757312A
Delta propagation in cloud-centric platforms for collaboration and connectivity
US20220134222A1
Cited By
Photo album synchronization method, system and equipment based on swan Mongolia cloud mobile phone and medium
CN121037069A