CN114258525A - Data updating method and device, terminal equipment and computer readable storage medium - Google Patents
Data updating method and device, terminal equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN114258525A CN114258525A CN201980099526.0A CN201980099526A CN114258525A CN 114258525 A CN114258525 A CN 114258525A CN 201980099526 A CN201980099526 A CN 201980099526A CN 114258525 A CN114258525 A CN 114258525A
- Authority
- CN
- China
- Prior art keywords
- file
- update
- data
- updating
- downloaded
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 62
- 238000012795 verification Methods 0.000 claims abstract description 51
- 230000005540 biological transmission Effects 0.000 claims description 26
- 238000004590 computer program Methods 0.000 claims description 21
- 230000008569 process Effects 0.000 description 9
- 230000006870 function Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000011218 segmentation Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000005192 partition Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The application discloses a data updating method, a device, a terminal device and a computer readable storage medium, wherein the data updating method comprises the following steps: if an active updating request is received when automatic updating operation is executed, checking a temporary file obtained by executing the automatic updating operation, wherein all data of the temporary file are partial data of an updated file; if the verification is passed, determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file; according to the address of the initial data to be downloaded in the update file, corresponding data are continuously downloaded from the source address for storing the update file, so that the update file is continuously transmitted; and if the update file is successfully continuously transmitted, updating the data according to the downloaded update file. By the method, the flow overhead of the CDN and the user is reduced, and the updating time for the user to actively update the application A is reduced.
Description
The present application relates to the field of data updating technologies, and in particular, to a data updating method, apparatus, terminal device, and computer-readable storage medium.
Application distribution software (e.g., a software store) has two primary functions, supporting the new downloading of un-downloaded applications and the updating of installed applications. Wherein, the updating is realized in two ways: the first is active updating, and the second is automatic updating. The active updating means that a user actively starts application distribution software, and an updating process is started by clicking an updating button; and the automatic updating does not need user interaction, as long as the user sets an automatic updating switch, the system can regularly check whether the application on the terminal equipment is updated, and if the application on the terminal equipment is updated, the downloading and the updating are automatically initiated.
In the existing method, if there is overlap between the active update action and the automatic update action, for example, a user initiates an active update request in the process of applying automatic update, the automatic update operation is cancelled to avoid traffic loss caused by repeated downloading, but the method still causes data traffic waste of a Content Delivery Network (CDN) of the user and an enterprise, and increases time consumed by user update.
Content of application
One of the purposes of the embodiment of the application is as follows: the utility model provides a data update method, device, terminal equipment and computer readable storage medium, aims at solving the problem that the data traffic of CDN is wasted and the time consumed by user update increases when the application is updated by the existing update method.
In a first aspect, a data updating method is provided, including:
if an active updating request is received when automatic updating operation is executed, checking a temporary file obtained by executing the automatic updating operation, wherein all data of the temporary file are partial data of an updated file;
if the verification is passed, determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file;
according to the address of the initial data to be downloaded in the update file, corresponding data are continuously downloaded from the source address for storing the update file, so that the update file is continuously transmitted;
and if the update file is successfully continuously transmitted, updating the data according to the downloaded update file.
In a second aspect, there is provided a data updating apparatus comprising:
an active update request receiving unit, configured to verify a temporary file obtained by performing an automatic update operation if an active update request is received while performing the automatic update operation, where all data of the temporary file is partial data of an update file;
the address determining unit of the initial data is used for determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file if the verification is passed;
the update file continuous transmission unit is used for continuously downloading corresponding data from a source address for storing the update file according to the address of the initial data to be downloaded in the update file so as to realize continuous transmission of the update file;
and the data updating unit is used for updating the data according to the downloaded update file if the update file is successfully continuously transmitted.
In a third aspect, a terminal device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
if an active updating request is received when automatic updating operation is executed, checking a temporary file obtained by executing the automatic updating operation, wherein all data of the temporary file are partial data of an updated file;
if the verification is passed, determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file;
according to the address of the initial data to be downloaded in the update file, corresponding data are continuously downloaded from the source address for storing the update file, so that the update file is continuously transmitted;
and if the update file is successfully continuously transmitted, updating the data according to the downloaded update file.
In a fourth aspect, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program which, when executed by a processor, implements the method according to any of the first aspects.
In a fifth aspect, a computer program product is provided, which, when run on a terminal device, causes the terminal device to perform the method as described in the first aspect above.
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments or exemplary technologies will be briefly described below.
Fig. 1 is a flow chart of a data updating method provided by an embodiment of the present application;
FIG. 2 is a schematic diagram of a data updating apparatus according to another embodiment of the present application;
fig. 3 is a schematic structural diagram of a terminal device according to another embodiment of the present application.
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The data updating method provided by the embodiment of the application is mainly applied to scenes when the active updating and the automatic updating are overlapped. For example, if the application a of the server has an update file, the identifier that needs to be updated appears on the application a installed on the terminal device, and if the application a is an automatic update application set by the user, the software store of the terminal device automatically downloads the update file of the application a in the background. If the user manually initiates an active update request in the process of downloading the update file of the application a, the downloaded partial update file, namely the temporary file, is checked first, and if the check is passed, the non-downloaded update file is downloaded according to the temporary file, so that the downloaded temporary file does not need to be downloaded again, thereby reducing the flow overhead of the CDN and the user, and reducing the update time for the user to actively update the application a.
In order to explain the technical solutions of the present application, the following detailed descriptions are made with reference to specific drawings and examples.
Fig. 1 shows a flowchart of a data updating method provided by an embodiment of the present application, which is detailed as follows:
step S11, if an active update request is received when an automatic update operation is executed, checking a temporary file obtained by executing the automatic update operation, wherein all data of the temporary file are partial data of an update file;
in this embodiment, if the application interface installed in the terminal device displays "update" or displays other identifiers used for indicating update, it indicates that the application corresponding to the application interface needs to be updated. And if the application is set to be automatically updated, automatically executing an updating operation to acquire an updating file corresponding to the application in an automatic updating mode, wherein the updating file is stored in the server. When the update file corresponding to the application is automatically acquired, if the user sends an active update request, the active update request is responded, and the acquired temporary file is verified. The verification here is mainly to verify the integrity of the temporary file.
It should be noted that if an active update request is not received when the automatic update operation is performed, that is, the entire update file is downloaded in an automatic update manner, then the "update" will not be displayed on the application interface any more, and of course, if other identifiers for indicating the update are initially displayed, then after the entire update file is downloaded in an automatic update manner, other identifiers for indicating the update will not be displayed any more.
Step S12, if the verification is passed, determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file;
specifically, if the data included in the temporary file passes the verification, the data length L1 of the temporary file passing the verification is determined, and the address where the last bit of data in the data string with the data length L1+1 is located is used as the address of the start data to be downloaded in the update file. For example, assume that the data of the update file is: 1111000, if the data in the temporary file is 1111, the address of "0" in "11110" is used as the address of the initial data to be downloaded in the update file.
Step S13, according to the address of the initial data to be downloaded in the update file, continuously downloading the corresponding data from the source address storing the update file to realize the continuous transmission of the update file;
specifically, the source address of the update file may be preset, or, to further ensure the accuracy of the obtained source address of the update file, the source address of the update file may be obtained before the temporary file is automatically obtained when the automatic update operation is performed, so that the source address of the update file obtained by the automatic update method is obtained before the data is downloaded by the active update method, and then the corresponding data is continuously downloaded from the source address of the update file.
And step S14, if the update file is successfully continuously transmitted, updating the data according to the downloaded update file.
And if the update file is downloaded successfully, updating the data of the corresponding application according to the update file.
In the embodiment of the application, the address of the update file of the initial data to be downloaded is determined according to the data included in the temporary file, and the temporary file is obtained by executing automatic update operation, so that after an active update request is received, corresponding data is continuously downloaded from the source address of the update file according to the address of the initial data to be downloaded, that is, after the update mode is changed from automatic update to active update, only the part of the update file which is not downloaded is required to be continuously downloaded on the basis of the temporary file, and therefore the downloaded temporary file is not required to be downloaded again, the flow overhead of the CDN and the user is reduced, and the update time of the user for actively updating the application a is reduced.
In some embodiments, in order to implement effective verification on the temporary file, the update file needs to be divided into at least 2 paragraphs in advance, and verification values corresponding to the divided at least 2 paragraphs are determined, where 1 paragraph corresponds to 1 verification value. At this time, before the step S11, the method includes:
acquiring a check value for checking the temporary file and a length value of paragraphs obtained by dividing the updated file in advance, wherein the number of the check value is greater than or equal to 2, and the number of the check value is the same as the number of the paragraphs divided by the updated file; and at least 2 check values corresponding to at least 2 paragraphs obtained by dividing the update file are used as check values for checking the temporary file.
Correspondingly, the verifying the temporary file obtained by executing the automatic update operation in step S11 specifically includes:
a1, segmenting the temporary file obtained by executing automatic updating operation according to the length value; specifically, the data included in the temporary file is segmented according to the length values of the paragraphs obtained by dividing the update file. It should be noted that, if different segments obtained after the update file is divided correspond to different length values, in the process of segmenting the temporary file, the sequence of the corresponding length values needs to be determined in combination with the sequence of the segments obtained by dividing the update file. It should be noted that, if the data length of the remaining unsegmented data of the temporary file is smaller than the data length of the corresponding sequential paragraph of the updated file partition, the remaining unsegmented data of the temporary file is discarded. For example, assuming that the data of the update file is 1111000, the update file is divided into 3 paragraphs in advance: 111; 10; 00; firstly segmenting the temporary file into data with the data length equal to '111', if the temporary file comprises other data besides the '111', continuously segmenting the data with the data length equal to '10' from the temporary file, if the temporary file does not have other data, stopping segmenting, if the temporary file still has residual data, but the data length of the residual data is less than the data length corresponding to '00', and discarding the residual data of the temporary file.
A2, carrying out segmentation verification on the segmented temporary file according to the verification value; in this step, different paragraphs of the updated file are operated according to a Message-Digest Algorithm (MD 5) to obtain MD5 values corresponding to the different paragraphs, and the MD5 values corresponding to the different paragraphs are used as check values corresponding to the different paragraphs. Specifically, the data after the temporary file is segmented is checked according to the check values of different paragraphs, for example, the 1 st paragraph data of the temporary file is operated according to the MD5 algorithm to obtain a corresponding MD5 value, the MD5 value is compared with the MD5 value corresponding to the 1 st paragraph of the updated file, if the MD5 value is the same as the MD5 value, it indicates that the 1 st paragraph data of the temporary file passes the check, and if the MD5 value is not the same as the MD5 value, it indicates that the 1 st paragraph data of the temporary file does not pass the check.
Correspondingly, the step S12 specifically includes:
b1, if all the segment checks pass, determining the address of the initial data to be downloaded in the update file according to the data of the last paragraph included in the temporary file; in particular, the address of the start data to be downloaded in the update file is determined from the data of the last paragraph comprised by the temporary file (usually only the last data is needed). Here, the last paragraph refers to a paragraph ordered at the end of the segmentation order, and the segmentation order refers to the order in which the temporary file is segmented.
And B2, if the segment check part passes, determining the address of the initial data to be downloaded in the update file according to the data of the first failed-check paragraph included in the temporary file. Specifically, if the segment check passes part and does not pass part, the address of the start data to be downloaded in the update file is determined only according to the data of the first segment that does not pass part (usually, only the last data is needed). In some embodiments, in order to improve the verification speed, if it is determined that a paragraph fails to be verified, the paragraphs subsequent to the paragraph in the temporary file are not verified.
In some embodiments, the obtaining a check value used for checking the temporary file and a length value of a paragraph obtained by dividing the update file in advance specifically includes:
if the updated file is detected to exist and the updating mode is automatic updating, automatically acquiring a check value for checking the temporary file and a length value of a paragraph obtained by dividing the updated file in advance;
after the automatically obtaining the check value for checking the temporary file and the length value of the paragraph obtained by dividing the updated file in advance, the method includes:
and automatically acquiring the temporary file.
In this embodiment, in order to obtain the check value for checking in time, when the automatic update starts, the check value for checking the temporary file and the length value of the paragraph obtained by dividing the update file in advance are first obtained, and then the temporary file for updating is obtained. In addition, because the check value and the length value used for checking are obtained when the automatic updating is started, the obtained check value and the obtained length value can be ensured to be the latest, and the checking accuracy is ensured.
In some embodiments, if the temporary file downloaded in the automatic update mode fails to be verified, the complete update file needs to be downloaded, and at this time, the data update method further includes:
and if all the segment checks are not passed, deleting the temporary file and re-downloading the updated file.
In this embodiment, verification may be performed on all paragraphs of the temporary file, and it is further determined whether verification of all paragraphs fails. In order to further increase the updating speed, when the verification of the first paragraph of the temporary file is judged to be failed, the verification of all the segments is directly judged to be failed. At this time, the source address of the storage update file may be obtained first, and then the update file may be downloaded again according to the source address of the storage update file. It should be noted that, after the update file is downloaded again according to the source address of the stored update file, the newly downloaded update file is verified, and if the verification fails, it indicates that there may be a problem with the source address of the update file, at this time, the terminal device initiates a request for obtaining the source address of the stored update file to the server, so as to obtain the source address of the new update file, and then performs the re-download of the update file according to the source address of the new update file.
In some embodiments, if the update file obtained by performing the automatic update operation is stored in a first folder, and the update file obtained by performing the active update operation is stored in a second folder, in order to ensure the accuracy of the address where the downloaded update file is stored, after the checking passes, the method includes:
copying the temporary file from the first folder to the second folder.
In this embodiment, after the verification passes, the temporary file may be copied from the first folder to the second folder, and then the address of the initial data to be downloaded in the update file is determined according to the data included in the temporary file; alternatively, after the verification is passed and the address of the initial data to be downloaded in the update file is determined according to the data included in the temporary file, the temporary file may be copied from the first folder to the second folder, which is not limited herein.
In some embodiments, since the act of copying the temporary file occupies certain system resources, in order to save system resources, the operation of copying the temporary file is performed only when the attribute of the first folder and the attribute of the second folder are specific attributes, where the copying the temporary file from the first folder to the second folder includes:
and if the attribute of the first folder is hidden and the attribute of the second folder is displayed, copying the temporary file from the first folder to the second folder.
In this embodiment, the attribute of the first folder is hidden, and the attribute of the second folder is displayed, that is, the updated file downloaded by the terminal device in the automatic updating mode is stored in the first folder and is invisible to the user, and the updated file downloaded by the active updating mode is stored in the second folder and is visible to the user. In order to facilitate the user to be able to view the downloaded update file subsequently, the temporary file is copied from the first folder to the second folder.
In some embodiments, to determine whether the update file is successfully retransmitted, before the step S14, the method includes:
comparing the size of the continuously transmitted update file with the standard size of the update file acquired in advance;
correspondingly, the step S14 specifically includes:
and if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, updating the data according to the downloaded update file.
In this embodiment, whether the update file is continuously transmitted successfully is determined according to the size of the continuously transmitted update file, and if the size of the continuously transmitted update file is equal to the standard size of the pre-obtained update file, it indicates that the continuously transmitted update file is continuously transmitted successfully. The standard size of the update file can be acquired before the temporary file is automatically acquired when the automatic update operation is executed, so that the standard size of the latest update file can be ensured, and the accuracy of judging whether continuous transmission is successful is improved.
In some embodiments, to further ensure that a more accurate update file is obtained, the update file that is continuously transmitted is checked, and at this time, if the size of the update file that is continuously transmitted is equal to the standard size of the update file that is obtained in advance, the update of the data according to the update file that is downloaded includes:
and if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, verifying the update file after continuous transmission, and if the verification is passed, updating the data according to the downloaded update file.
In this embodiment, the updated file after being continuously transmitted may be checked through the MD5 values corresponding to all data included in the updated file in the server, specifically, the MD5 value corresponding to the updated file after being continuously transmitted is calculated, and then the MD5 value corresponding to the updated file after being continuously transmitted is compared with the MD5 value corresponding to all data included in the updated file in the server, if the two values are equal, the check is passed, and if the two values are not equal, the check is not passed. If the verification is not passed, segmenting the update file which is successfully retransmitted, so that the number of the segmented paragraphs and the data length of each paragraph are equal to the number of the paragraphs which are divided by the update file stored in the server in advance and the data length of the corresponding paragraph, then respectively verifying the paragraphs which are divided by the update file which is successfully retransmitted segment by segment, determining the address of the initial data to be downloaded in the update file according to the verification result, and downloading the corresponding data from the update file stored in the server according to the address.
In some embodiments, in order to facilitate the user to know that the downloading of the update file is currently performed by means of automatic update, after receiving the active update request in step S11, the method includes:
determining a ratio value according to the ratio of the temporary file and the updated file obtained by executing the automatic updating operation; and displaying the proportional value.
In this step, the size of the update file needs to be acquired in advance. Specifically, the size of the temporary file is determined, and then the size of the temporary file is compared with the size of the update file acquired in advance to obtain a ratio value of the temporary file to the update file. In this embodiment, the user can know the downloading progress of the current update file by displaying the ratio value.
In some embodiments, in order to facilitate the user to further confirm the updating manner, after receiving the active updating request in step S11, the method includes:
and displaying the information which is automatically updated at present, and prompting a user to confirm whether to switch from the automatic updating mode to the active updating mode.
In this embodiment, if the user confirms that the automatic update mode is switched to the active update mode, the temporary file obtained by executing the automatic update operation is verified. Otherwise, the updating file is continuously downloaded in an automatic updating mode.
Corresponding to the above data updating, fig. 2 shows a schematic structural diagram of a data updating apparatus provided in the embodiment of the present application, and for convenience of explanation, only the relevant parts of the embodiment of the present application are shown.
The data update apparatus 2 includes: an active update request receiving unit 21, an address determining unit 22 for initial data, an update file resuming unit 23, and a data updating unit 24. Wherein:
an active update request receiving unit 21, configured to verify a temporary file obtained by performing an automatic update operation if an active update request is received when the automatic update operation is performed, where all data of the temporary file is partial data of an update file;
in this embodiment, if the application interface installed in the terminal device displays "update" or displays other identifiers used for indicating update, it indicates that the application corresponding to the application interface needs to be updated. And if the application is set to be automatically updated, automatically executing an updating operation to acquire an updating file corresponding to the application in an automatic updating mode, wherein the updating file is stored in the server.
An address determining unit 22 of the start data, configured to determine, if the verification passes, an address of the start data to be downloaded in the update file according to data included in the temporary file;
the update file continuous transmission unit 23 is configured to continuously download corresponding data from a source address storing the update file according to the address of the start data to be downloaded in the update file, so as to implement continuous transmission of the update file;
specifically, the source address of the update file may be set in advance, or, in order to further ensure the accuracy of the source address of the obtained update file, the source address of the update file may be obtained before the temporary file is automatically obtained when the automatic update operation is performed.
And the data updating unit 24 is configured to, if the update file is successfully continuously transmitted, update data according to the downloaded update file.
In the embodiment of the application, the address of the update file of the initial data to be downloaded is determined according to the data included in the temporary file, and the temporary file is obtained by executing automatic update operation, so that after an active update request is received, corresponding data is continuously downloaded from the source address of the update file according to the address of the initial data to be downloaded, that is, after the update mode is changed from automatic update to active update, only the part of the update file which is not downloaded is required to be continuously downloaded on the basis of the temporary file, and therefore the downloaded temporary file is not required to be downloaded again, the flow overhead of the CDN and the user is reduced, and the update time of the user for actively updating the application a is reduced.
In some embodiments, in order to implement effective verification on the temporary file, the update file needs to be divided into at least 2 paragraphs in advance, and verification values corresponding to the divided at least 2 paragraphs are determined, where 1 paragraph corresponds to 1 verification value. In this case, the data update apparatus 2 includes:
a check value obtaining unit, configured to obtain a check value used for checking the temporary file and a length value of a paragraph obtained by dividing the update file in advance, where the number of the check values is greater than or equal to 2, and the number of the check values is the same as the number of the paragraphs divided by the update file;
correspondingly, the active update request receiving unit 21 checks the temporary file obtained by executing the automatic update operation, and is specifically configured to:
segmenting a temporary file obtained by executing automatic updating operation according to the length value; carrying out subsection verification on the temporary file after the subsection according to the verification value;
it should be noted that, if different segments obtained after the update file is divided correspond to different length values, in the process of segmenting the temporary file, the sequence of the corresponding length values needs to be determined in combination with the sequence of the segments obtained by dividing the update file. It should be noted that, if the data length of the remaining unsegmented data of the temporary file is smaller than the data length of the corresponding sequential paragraph of the updated file partition, the remaining unsegmented data of the temporary file is discarded. The check value may be an MD5 value.
Correspondingly, the address determining unit 22 of the start data is specifically configured to:
if all the segment checks pass, determining data to be downloaded in the update file according to the data of the last paragraph included in the temporary file; and if the segment check part passes, determining the data to be downloaded in the update file according to the data of the first failed-check paragraph included in the temporary file.
Specifically, if all segment checks pass, the address of the start data to be downloaded in the update file is determined according to the data of the last segment included in the temporary file (usually, only the last data is needed). If the segment passes the check part and does not pass the check part, the address of the initial data to be downloaded in the update file is determined only according to the data of the first paragraph (usually only the last data is needed) which does not pass the check. In some embodiments, in order to improve the verification speed, if it is determined that a paragraph fails to be verified, the paragraphs subsequent to the paragraph in the temporary file are not verified.
In some embodiments, the check value obtaining unit specifically includes:
if the updated file is detected to exist and the updating mode is automatic updating, automatically acquiring a check value for checking the temporary file and a length value of a paragraph obtained by dividing the updated file in advance;
correspondingly, the data updating device further comprises:
and the temporary file acquisition unit is used for automatically acquiring the temporary file.
In this embodiment, since the check value and the length value used for checking are obtained when the automatic update starts, it can be ensured that both the obtained check value and the obtained length value are latest, thereby ensuring the accuracy of the checking.
In some embodiments, if the temporary file downloaded in the automatic update mode fails to be verified, the complete update file needs to be downloaded, and at this time, the data update apparatus further includes:
and the update file re-downloading unit is used for deleting the temporary file and re-downloading the update file if all the segment checks fail.
In this embodiment, verification may be performed on all paragraphs of the temporary file, and it is further determined whether verification of all paragraphs fails. In order to further increase the updating speed, when the verification of the first paragraph of the temporary file is judged to be failed, the verification of all the segments is directly judged to be failed. At this time, the source address of the storage update file may be obtained first, and then the update file may be downloaded again according to the source address of the storage update file. It should be noted that, after the update file is downloaded again according to the source address of the stored update file, the newly downloaded update file is verified, and if the verification fails, it indicates that there may be a problem with the source address of the update file, at this time, the terminal device initiates a request for obtaining the source address of the stored update file to the server, so as to obtain the source address of the new update file, and then performs the re-download of the update file according to the source address of the new update file.
In some embodiments, if the update file obtained by performing the automatic update operation is stored in a first folder, and the update file obtained by performing the active update operation is stored in a second folder, in order to ensure the accuracy of the address where the downloaded update file is stored, the data update apparatus further includes:
a temporary file copying unit configured to copy the temporary file from the first folder to the second folder.
In some embodiments, since the action of copying the temporary file occupies certain system resources, in order to save system resources, the operation of copying the temporary file is performed only when the attribute of the first folder and the attribute of the second folder are specific attributes, and at this time, the temporary file copying unit is specifically configured to:
and if the attribute of the first folder is hidden and the attribute of the second folder is displayed, copying the temporary file from the first folder to the second folder.
In some embodiments, in order to determine whether the update file is successfully retransmitted, the data updating apparatus further includes:
the size comparison unit is used for comparing the size of the updated file after continuous transmission with the standard size of the updated file acquired in advance;
correspondingly, the data updating unit is specifically configured to:
and if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, updating the data according to the downloaded update file.
The standard size of the update file can be acquired before the temporary file is automatically acquired when the automatic update operation is executed, so that the standard size of the latest update file can be ensured, and the accuracy of judging whether continuous transmission is successful is improved.
In some embodiments, in order to further ensure that a more accurate update file is obtained, the update file that is continuously transmitted is checked, at this time, the data updating unit 24 is specifically configured to:
and if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, verifying the update file after continuous transmission, and if the verification is passed, updating the data according to the downloaded update file.
In this embodiment, the updated file after being continuously transmitted may be checked through the MD5 values corresponding to all data included in the updated file in the server, specifically, the MD5 value corresponding to the updated file after being continuously transmitted is calculated, and then the MD5 value corresponding to the updated file after being continuously transmitted is compared with the MD5 value corresponding to all data included in the updated file in the server, if the two values are equal, the check is passed, and if the two values are not equal, the check is not passed. If the verification is not passed, segmenting the update file which is successfully retransmitted, so that the number of the segmented paragraphs and the data length of each paragraph are equal to the number of the paragraphs which are divided by the update file stored in the server in advance and the data length of the corresponding paragraph, then respectively verifying the paragraphs which are divided by the update file which is successfully retransmitted segment by segment, determining the address of the initial data to be downloaded in the update file according to the verification result, and downloading the corresponding data from the update file stored in the server according to the address.
In some embodiments, in order to make the user know that the downloading of the update file is currently being performed by means of automatic update, the data update apparatus further includes:
a scale value display unit for determining a scale value according to a ratio of the temporary file to the update file obtained by performing the automatic update operation; and displaying the proportional value.
In some embodiments, in order to make the user know that the downloading of the update file is currently being performed by means of automatic update, the data update apparatus further includes:
and the updating mode switching prompting unit is used for displaying the information which is automatically updated at present and prompting a user to confirm whether to switch from the automatic updating mode to the active updating mode.
In this embodiment, if the user confirms that the automatic update mode is switched to the active update mode, the temporary file obtained by executing the automatic update operation is verified. Otherwise, the updating file is continuously downloaded in an automatic updating mode.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Fig. 3 is a schematic diagram of a terminal device according to an embodiment of the present application. As shown in fig. 3, the terminal device 3 of this embodiment includes: a processor 30, a memory 31 and a computer program 32 stored in said memory 31 and executable on said processor 30. The processor 30, when executing the computer program 32, implements the steps in the various method embodiments described above, such as the steps S11-S14 shown in fig. 1. Alternatively, the processor 30, when executing the computer program 32, implements the functions of the modules/units in the above-mentioned device embodiments, such as the functions of the modules 21 to 24 shown in fig. 2.
Illustratively, the computer program 32 may be partitioned into one or more modules/units that are stored in the memory 31 and executed by the processor 30 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 32 in the terminal device 3. For example, the computer program 32 may be divided into an active update request receiving unit, an address determining unit for initial data, an update file resuming unit, and a data updating unit, where the specific functions of each unit are as follows:
an active update request receiving unit, configured to verify a temporary file obtained by performing an automatic update operation if an active update request is received while performing the automatic update operation, where all data of the temporary file is partial data of an update file;
the address determining unit of the initial data is used for determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file if the verification is passed;
the update file continuous transmission unit is used for continuously downloading corresponding data from a source address for storing the update file according to the address of the initial data to be downloaded in the update file so as to realize continuous transmission of the update file;
and the data updating unit is used for updating the data according to the downloaded update file if the update file is successfully continuously transmitted.
The terminal device 3 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 30, a memory 31. It will be understood by those skilled in the art that fig. 3 is only an example of the terminal device 3, and does not constitute a limitation to the terminal device 3, and may include more or less components than those shown, or combine some components, or different components, for example, the terminal device may also include an input-output device, a network access device, a bus, etc.
The Processor 30 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 31 may be an internal storage unit of the terminal device 3, such as a hard disk or a memory of the terminal device 3. The memory 31 may also be an external storage device of the terminal device 3, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 3. Further, the memory 31 may also include both an internal storage unit and an external storage device of the terminal device 3. The memory 31 is used for storing the computer program and other programs and data required by the terminal device. The memory 31 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.
Claims (20)
- A method for updating data, comprising:if an active updating request is received when automatic updating operation is executed, checking a temporary file obtained by executing the automatic updating operation, wherein all data of the temporary file are partial data of an updated file;if the verification is passed, determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file;according to the address of the initial data to be downloaded in the update file, corresponding data are continuously downloaded from the source address for storing the update file, so that the update file is continuously transmitted;and if the update file is successfully continuously transmitted, updating the data according to the downloaded update file.
- The data updating method according to claim 1, wherein before checking the temporary file obtained by performing the automatic updating operation if the active updating request is received while performing the automatic updating operation, the method comprises:acquiring a check value for checking the temporary file and a length value of a paragraph obtained by dividing the updated file in advance, wherein the number of the check value is greater than or equal to 2, and the number of the check value is the same as the number of the paragraph divided by the updated file;correspondingly, the verifying the temporary file obtained by executing the automatic update operation specifically includes:segmenting a temporary file obtained by executing automatic updating operation according to the length value;carrying out subsection verification on the temporary file after the subsection according to the verification value;correspondingly, if the verification passes, determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file, specifically including:if all the segment checks pass, determining data to be downloaded in the update file according to the data of the last paragraph included in the temporary file;and if the segment check part passes, determining the data to be downloaded in the update file according to the data of the first failed-check paragraph included in the temporary file.
- The data updating method of claim 2, wherein the obtaining of the check value for checking the temporary file and the length value of the paragraph obtained by dividing the updated file in advance specifically comprises:if the updated file is detected to exist and the updating mode is automatic updating, automatically acquiring a check value for checking the temporary file and a length value of a paragraph obtained by dividing the updated file in advance;after the automatically obtaining the check value for checking the temporary file and the length value of the paragraph obtained by dividing the updated file in advance, the method includes:and automatically acquiring the temporary file.
- The data updating method of claim 2, wherein the data updating method further comprises:and if all the segment checks are not passed, deleting the temporary file and re-downloading the updated file.
- The data updating method of claim 1, wherein if the updated file obtained by performing the automatic updating operation is stored in a first folder and the updated file obtained by performing the active updating operation is stored in a second folder, after the checking passes, the method further comprises:copying the temporary file from the first folder to the second folder.
- The data updating method of claim 5, wherein the copying the temporary file from the first folder to the second folder comprises:and if the attribute of the first folder is hidden and the attribute of the second folder is displayed, copying the temporary file from the first folder to the second folder.
- The data updating method according to claim 1, wherein before the updating of the data according to the downloaded update file is implemented if the update file is continuously transmitted successfully, the method comprises:comparing the size of the continuously transmitted update file with the standard size of the update file acquired in advance;correspondingly, if the update file is successfully continuously transmitted, the data update is realized according to the downloaded update file, specifically:and if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, updating the data according to the downloaded update file.
- The data updating method of claim 7, wherein if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, the updating of the data according to the downloaded update file is implemented, including:and if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, verifying the update file after continuous transmission, and if the verification is passed, updating the data according to the downloaded update file.
- The data update method of claim 1, after said receiving an active update request, comprising:determining a ratio value according to the ratio of the temporary file and the updated file obtained by executing the automatic updating operation;and displaying the proportional value.
- A data update apparatus, comprising:an active update request receiving unit, configured to verify a temporary file obtained by performing an automatic update operation if an active update request is received while performing the automatic update operation, where all data of the temporary file is partial data of an update file;the address determining unit of the initial data is used for determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file if the verification is passed;the update file continuous transmission unit is used for continuously downloading corresponding data from a source address for storing the update file according to the address of the initial data to be downloaded in the update file so as to realize continuous transmission of the update file;and the data updating unit is used for updating the data according to the downloaded update file if the update file is successfully continuously transmitted.
- A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:if an active updating request is received when automatic updating operation is executed, checking a temporary file obtained by executing the automatic updating operation, wherein all data of the temporary file are partial data of an updated file;if the verification is passed, determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file;according to the address of the initial data to be downloaded in the update file, corresponding data are continuously downloaded from the source address for storing the update file, so that the update file is continuously transmitted;and if the update file is successfully continuously transmitted, updating the data according to the downloaded update file.
- The terminal device according to claim 11, wherein before checking the temporary file obtained by performing the automatic update operation if the active update request is received while performing the automatic update operation, the method further comprises:acquiring a check value for checking the temporary file and a length value of a paragraph obtained by dividing the updated file in advance, wherein the number of the check value is greater than or equal to 2, and the number of the check value is the same as the number of the paragraph divided by the updated file;correspondingly, the verifying the temporary file obtained by executing the automatic update operation specifically includes:segmenting a temporary file obtained by executing automatic updating operation according to the length value;carrying out subsection verification on the temporary file after the subsection according to the verification value;correspondingly, if the verification passes, determining the address of the initial data to be downloaded in the update file according to the data included in the temporary file, specifically including:if all the segment checks pass, determining data to be downloaded in the update file according to the data of the last paragraph included in the temporary file;and if the segment check part passes, determining the data to be downloaded in the update file according to the data of the first failed-check paragraph included in the temporary file.
- The terminal device of claim 12, wherein the obtaining of the check value for checking the temporary file and the length value of the paragraph obtained by dividing the update file in advance specifically includes:if the updated file is detected to exist and the updating mode is automatic updating, automatically acquiring a check value for checking the temporary file and a length value of a paragraph obtained by dividing the updated file in advance;after the automatically obtaining the check value for checking the temporary file and the length value of the paragraph obtained by dividing the updated file in advance, the method includes:and automatically acquiring the temporary file.
- The terminal device of claim 12, wherein the processor, when executing the computer program, further comprises performing the steps of:and if all the segment checks are not passed, deleting the temporary file and re-downloading the updated file.
- The terminal device according to claim 11, wherein if the updated file obtained by performing the automatic update operation is stored in a first folder and the updated file obtained by performing the active update operation is stored in a second folder, after the checking passes, the method further comprises:copying the temporary file from the first folder to the second folder.
- The terminal device of claim 15, wherein said copying the temporary file from the first folder to the second folder comprises:and if the attribute of the first folder is hidden and the attribute of the second folder is displayed, copying the temporary file from the first folder to the second folder.
- The terminal device of claim 11, wherein before the updating the data according to the downloaded update file if the update file is successfully retransmitted, the method further comprises:comparing the size of the continuously transmitted update file with the standard size of the update file acquired in advance;correspondingly, if the update file is successfully continuously transmitted, the data update is realized according to the downloaded update file, specifically:and if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, updating the data according to the downloaded update file.
- The terminal device of claim 17, wherein if the size of the update file after continuous transmission is equal to the standard size of the update file obtained in advance, the updating of the data according to the downloaded update file is implemented, including:and if the size of the update file after continuous transmission is equal to the standard size of the update file acquired in advance, verifying the update file after continuous transmission, and if the verification is passed, updating the data according to the downloaded update file.
- The terminal device of claim 11, after said receiving an unsolicited update request, comprising:determining a ratio value according to the ratio of the temporary file and the updated file obtained by executing the automatic updating operation;and displaying the proportional value.
- A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 9.
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2019/114031 WO2021081758A1 (en) | 2019-10-29 | 2019-10-29 | Data update method, device, terminal apparatus, and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114258525A true CN114258525A (en) | 2022-03-29 |
CN114258525B CN114258525B (en) | 2024-07-26 |
Family
ID=
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101316256A (en) * | 2007-05-28 | 2008-12-03 | 微码(北京)移动技术有限公司 | Data updating method |
WO2009140813A1 (en) * | 2008-05-23 | 2009-11-26 | 中兴通讯股份有限公司 | File downloading method, system and terminal for realizing continuous transmission from the breakpoint |
CN104363271A (en) * | 2014-10-28 | 2015-02-18 | 广东欧珀移动通信有限公司 | File breakpoint resuming method and device |
CN105260202A (en) * | 2015-09-15 | 2016-01-20 | 中国联合网络通信集团有限公司 | Client file updating method and system |
CN105487894A (en) * | 2015-11-27 | 2016-04-13 | 浪潮软件集团有限公司 | Remote updating method of distributed software system |
WO2019201040A1 (en) * | 2018-04-16 | 2019-10-24 | 深圳思为科技有限公司 | File update management method and system and terminal apparatus |
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101316256A (en) * | 2007-05-28 | 2008-12-03 | 微码(北京)移动技术有限公司 | Data updating method |
WO2009140813A1 (en) * | 2008-05-23 | 2009-11-26 | 中兴通讯股份有限公司 | File downloading method, system and terminal for realizing continuous transmission from the breakpoint |
CN104363271A (en) * | 2014-10-28 | 2015-02-18 | 广东欧珀移动通信有限公司 | File breakpoint resuming method and device |
CN105260202A (en) * | 2015-09-15 | 2016-01-20 | 中国联合网络通信集团有限公司 | Client file updating method and system |
CN105487894A (en) * | 2015-11-27 | 2016-04-13 | 浪潮软件集团有限公司 | Remote updating method of distributed software system |
WO2019201040A1 (en) * | 2018-04-16 | 2019-10-24 | 深圳思为科技有限公司 | File update management method and system and terminal apparatus |
Also Published As
Publication number | Publication date |
---|---|
WO2021081758A1 (en) | 2021-05-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109471653B (en) | Application program updating method, electronic device, server and storage medium | |
US10241813B2 (en) | Method and apparatus for patching | |
CN109814524B (en) | Vehicle diagnosis method, device and system | |
CN108874426B (en) | Application program updating method and device and readable storage medium | |
CN110225078B (en) | Application service updating method, system and terminal equipment | |
US20190258534A1 (en) | Message oriented middleware with integrated rules engine | |
US10983718B2 (en) | Method, device and computer program product for data backup | |
CN111176685A (en) | Upgrading method and device | |
CN108920962B (en) | Firmware downloading and signing checking method, firmware publishing method, mobile terminal and server | |
CN109032617B (en) | Control method and control device for automatically deleting installation package | |
CN106569841B (en) | File loading method and device | |
CN107528713B (en) | A kind of upgrade method and device of data transfer SDK | |
CN110795495A (en) | Data processing method and device, electronic equipment and computer readable medium | |
WO2021081758A1 (en) | Data update method, device, terminal apparatus, and computer readable storage medium | |
CN109298956B (en) | File transmission method and device and terminal equipment | |
CN114258525B (en) | Data updating method, device, terminal equipment and computer readable storage medium | |
CN116074308A (en) | Method, system, equipment and readable storage medium for downloading vehicle-end upgrade package | |
CN107368337B (en) | Application downloading method and device and terminal equipment | |
CN112527276B (en) | Data updating method and device in visual programming tool and terminal equipment | |
CN114741686A (en) | Method and device for detecting program white list and related equipment | |
CN114117280A (en) | Page static resource using method and device, terminal equipment and storage medium | |
CN110896391A (en) | Message processing method and device | |
CN114064096A (en) | Application upgrading method and device, terminal and computer readable storage medium | |
CN104751058A (en) | File scan method and electronic equipment | |
CN110825406A (en) | Software upgrading method and related equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |