CN117499390A - File transmission method and device and computer equipment - Google Patents

File transmission method and device and computer equipment Download PDF

Info

Publication number
CN117499390A
CN117499390A CN202311621816.1A CN202311621816A CN117499390A CN 117499390 A CN117499390 A CN 117499390A CN 202311621816 A CN202311621816 A CN 202311621816A CN 117499390 A CN117499390 A CN 117499390A
Authority
CN
China
Prior art keywords
file
fragmented
server
checksum
unique identifier
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.)
Pending
Application number
CN202311621816.1A
Other languages
Chinese (zh)
Inventor
倪焕山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan United Imaging Healthcare Co Ltd
Original Assignee
Wuhan United Imaging Healthcare Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Wuhan United Imaging Healthcare Co Ltd filed Critical Wuhan United Imaging Healthcare Co Ltd
Priority to CN202311621816.1A priority Critical patent/CN117499390A/en
Publication of CN117499390A publication Critical patent/CN117499390A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application relates to a file transmission method, a file transmission device and computer equipment. The method comprises the following steps: and receiving the data packet of the fragmented file, and determining a second checksum of the fragmented file according to a first signature algorithm under the condition that the first global unique identifier is consistent with the second global unique identifier of the file to be stored, so as to combine the fragmented file with the fragmented file existing in the preset storage space according to the index number, the first checksum and the second checksum. The data packet of the fragmented file comprises the fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm; the fragmented files are obtained by performing fragmentation processing on files to be stored. By adopting the method, the reliability of file transmission can be improved.

Description

File transmission method and device and computer equipment
Technical Field
The present invention relates to the field of transmission technologies, and in particular, to a file transmission method, apparatus, and computer device.
Background
File transmission is a common function in internet development, wherein large file transmission is a situation commonly encountered in file transmission, and the problems of terminal blocking, memory overflow, transmission failure and the like are easily caused in direct transmission of large files, so that the large files are generally subjected to slicing processing at present, and the slices obtained after the slicing processing are transmitted.
However, the transmission of fragments is also prone to the problem of poor reliability in the file transmission and merging process, resulting in the unavailability of the finally received file. Therefore, how to improve the reliability of file transfer is an important study of those skilled in the art.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a file transfer method, apparatus, and computer device that can improve reliability.
In a first aspect, the present application provides a file transmission method, applied to a server side, including:
receiving a fragmented file data packet; the fragmented file data packet comprises a fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm; the fragmented files are obtained by performing fragmentation processing on files to be stored;
under the condition that the first global unique identifier is consistent with the second global unique identifier of the file to be stored, determining a second checksum of the fragmented file according to a first signature algorithm;
and merging the fragmented files with the existing fragmented files in the preset storage space according to the index number, the first checksum and the second checksum.
In a second aspect, the present application further provides a file transmission method, applied to a terminal side, including:
And sending a fragmented file data packet comprising the fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm to a server, so that the server determines a second checksum of the fragmented file according to the first signature algorithm under the condition that the first global unique identifier is consistent with a second global unique identifier of the file to be stored, and merges the fragmented file with the fragmented file existing in a preset storage space according to the index number, the first checksum and the second checksum.
In a third aspect, the present application further provides a file transmission device, including:
the first receiving module is used for receiving the fragmented file data packet; the fragmented file data packet comprises a fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm; the fragmented files are obtained by performing fragmentation processing on files to be stored;
the first determining module is used for determining a second checksum of the fragmented file according to a first signature algorithm under the condition that the first global unique identifier is consistent with a second global unique identifier of the file to be stored;
and the merging module is used for merging the fragmented files with the existing fragmented files in the preset storage space according to the index number, the first checksum and the second checksum.
In a fourth aspect, the present application further provides a file transmission device, including:
the first sending module is used for sending the fragmented file data packet comprising the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm to the server, so that the server determines the second checksum of the fragmented file according to the first signature algorithm under the condition that the first global unique identifier is consistent with the second global unique identifier of the file to be stored, and merges the fragmented file with the fragmented file existing in the preset storage space according to the index number, the first checksum and the second checksum.
In a fifth aspect, the present application also provides a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the methods described above when the processor executes the computer program.
In a sixth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of any of the methods described above.
In a seventh aspect, the present application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of any of the methods described above.
According to the file transmission method, the device and the computer equipment, the fragmented file is obtained by performing fragmentation processing on the file to be stored, and the fragmented file data packet comprises the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm, so that after the fragmented file data packet is received, the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm can be determined. Further, the method can combine the fragmented files with the existing fragmented files in the preset storage space by comparing the first global unique identifier with the second global unique identifier and combining the index number, the first checksum and the information between the second checksum under the condition that the first global unique identifier and the second global unique identifier are consistent, so that the reliability of the fragmented files is verified before the fragmented files are combined, the combined fragmented files in the storage space are available, and the accuracy and the reliability of the combination are improved, so that the reliability of file transmission is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for a person having ordinary skill in the art.
FIG. 1 is an application environment diagram of a file transfer method according to an embodiment of the present application;
FIG. 2 is a flow chart of a file transfer method according to an embodiment of the present application;
FIG. 3 is a schematic flow chart of merging according to an embodiment of the present application;
fig. 4 is a schematic flow chart of a transmission process in the embodiment of the present application;
fig. 5 is a schematic flow chart of another transmission procedure in the embodiment of the present application;
fig. 6 is a schematic flow chart of another transmission procedure in the embodiment of the present application;
fig. 7 is a schematic flow chart of another transmission procedure in the embodiment of the present application;
fig. 8 is a flow chart of another transmission procedure in the embodiment of the application;
fig. 9 is a schematic flow chart of another transmission procedure in the embodiment of the application;
fig. 10 is a schematic flow chart of another transmission procedure in the embodiment of the present application;
FIG. 11 is a schematic flow chart of a slicing process in an embodiment of the present application;
FIG. 12 is a schematic diagram of a grading process according to an embodiment of the present application;
fig. 13 is a schematic flow chart of another transmission procedure in the embodiment of the present application;
FIG. 14 is a schematic process diagram of a file transfer method according to an embodiment of the present application;
FIG. 15 is an interaction diagram of a file transfer method according to an embodiment of the present application;
FIG. 16 is a schematic diagram illustrating a file transfer system according to an embodiment of the present disclosure;
FIG. 17 is a block diagram illustrating a file transfer adjustment apparatus according to an embodiment of the present disclosure;
FIG. 18 is a block diagram illustrating a file transfer adjustment apparatus according to an embodiment of the present disclosure;
fig. 19 is an internal structural diagram of the computer device in the embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
With technological progress and continuous enrichment of business scenes, large file transmission is a situation commonly encountered in file transmission. Meanwhile, because the Internet environment is complex, the network environments in different places have larger differences, and the network in the same place is good and bad in different time periods. The user transmits the large file to the server through the browser, and the large file transmission mainly has the following problems:
first, too large a file may cause the browser to crash. Second, too large files can cause memory overflow of the server, and the server may be down in severe cases, so that serious safety accidents occur. Thirdly, the network environment is possibly good and bad, accidents are easy to occur in the file transmission process, file transmission is failed, and a large amount of time, network traffic and other resources are wasted when retransmission is performed again. Fourth, too large a file is detrimental to the reliability of the detected file. Fifth, the file may have data lost or tampered with during transmission, resulting in the file being unusable.
Based on this, it is necessary to provide a file transfer method for the technical problems described above, which will be described below.
Fig. 1 is an application environment diagram of a file transfer method in an embodiment of the present application, in which a terminal 101 communicates with a server 102 through a network. The data storage system may store data that the server 102 needs to process. The data storage system may be integrated on the server 102 or may be located on a cloud or other network server.
The terminal 101 may be a client of a C/S (client/Server) architecture or a Browser of a B/S (Browser/Server) architecture.
The terminal 101 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, and the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart car devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 102 may be implemented as a stand-alone server or as a server cluster of multiple servers.
Fig. 2 is a schematic flow chart of a file transmission method according to an embodiment of the present application, and in an exemplary embodiment, as shown in fig. 2, a file transmission method is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following S201 to S203.
S201, receiving a fragment file data packet; the fragmented file data packet comprises a fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm; the fragmented files are obtained by performing fragmentation processing on files to be stored.
In this embodiment, the server is capable of receiving the fragmented file packets. The server can receive the fragment file data packet sent by the terminal. In some application scenarios, the middleware may also receive the fragmented file packet sent by the terminal, and forward the fragmented file packet to the server.
The data package of the fragmented file comprises the fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm. The fragmented file packets may be in compressed packets, text format, binary format, etc., and the embodiment is not limited.
The fragmented files are obtained by performing fragmentation processing on files to be stored. The file to be stored refers to a file desired to be transmitted to the server, and may be a file stored in the terminal, a file input into the terminal by a user, or the like, and the size and format of the file to be stored are not limited in this embodiment. Further, the terminal or the intermediate device may perform a slicing process on the file to be stored to obtain at least one slicing file of the file to be stored, and obtain each slicing file data packet corresponding to each slicing file.
The index number of the fragmented file is used to identify each fragmented file, which may be at least one of a number, letter, symbol. The index number of the fragmented file may be determined by the process of performing the fragmentation process on the file to be stored.
In some embodiments, the values between index numbers of adjacent shard files differ by a fixed amount, such as by 1. For example, assuming that 5 fragmented files are obtained sequentially after the to-be-stored file a is fragmented, the index numbers of the 5 fragmented files may be block0, block1, … …, block4, and so on.
The first signature Algorithm can identify at least one signature Algorithm for the server to verify the fragmented file, which can be at least one of Message-Digest Algorithm (MD 5), secure hash Algorithm 1 (Secure Hash Algorithm, sha-1), secure hash Algorithm 256 (Secure Hash Algorithm 256, sha 256), secure hash Algorithm 512 (Secure Hash Algorithm, sha 512). The first signature algorithm may be a fixed algorithm, or may be an algorithm determined by the terminal according to the type of the fragmented file, which is not limited in this embodiment.
The first checksum is also used for checking the fragmented file by the server, and the first checksum may be a checksum obtained by checking the fragmented file according to a first signature algorithm when the fragmented file is obtained by performing the fragmentation processing on the file to be stored. That is, the first checksum in the fragmented file packet is obtained by the first signature algorithm in the fragmented file packet.
The first globally unique identification can uniquely identify a transmission task of the file to be stored, which can be at least one of a number, letter, symbol. It will be appreciated that at the same time, multiple different files to be stored may need to be transferred to the server, and there may be instances where the same time is transferred to the server for the same file to be stored. Thus, in order to distinguish between different transmission tasks, it is necessary to distinguish by the first globally unique identification.
The first globally unique identification may be an identification created by the terminal at the time of creating the transmission task. For example, when the user a needs to transmit the file a to be stored to the server at time 1, the terminal may generate the first globally unique identifier a at time 1 by using a preset rule, so as to add the first globally unique identifier a to the corresponding fragmented file packet. The user B also needs to transmit the same file a to be stored to the server at the same time 1, and the terminal may also generate the first global unique identifier B at the time 1 by using a preset rule, so as to add the first global unique identifier B to the corresponding fragmented file data packet. The foregoing merely illustrates one way to determine the first globally unique identifier, and the present embodiment is not limited thereto.
S202, determining a second checksum of the fragmented file according to a first signature algorithm under the condition that the first globally unique identifier is consistent with a second globally unique identifier of the file to be stored.
Further, after the server receives the fragmented file data packet, the first globally unique identifier, the index number, the first checksum and the second checksum in the fragmented file data packet may be determined. In some embodiments, after receiving the fragmented file packet, the server parses the fragmented file packet to obtain a first globally unique identifier, an index number, a first checksum, and a second checksum in the fragmented file packet.
And, the server can determine a second globally unique identification of the file to be stored. The second globally unique identifier is also used for distinguishing a transmission task or a transmission process of the file to be stored. The second globally unique identifier of the file to be stored may be an identifier generated by the server using a preset rule when receiving a file upload request sent by the terminal.
For example, when the user a needs to transmit the file a to be stored to the server at time 1, the terminal may send a file upload request a to the server, and then the server determines, according to the file upload request a, a second global unique identifier a of the file a to be stored by using a preset rule, where the second global unique identifier a is the same as the first global unique identifier a. Under the condition that a user B also needs to transmit a file A to be stored to a server at a moment 1, the terminal can send a file uploading request B to the server, and then the server determines a second global unique identifier B of the file A to be stored according to the file uploading request B by utilizing a preset rule, wherein the second global unique identifier B is identical to the first global unique identifier B.
Thus, the server compares the first globally unique identifier with the second globally unique identifier of the file to be stored. And comparing the first global unique identifier with the second global unique identifier, namely, the server matches the identifier which is the same as the first global unique identifier in the data packet of the fragmented file from the stored second global unique identifier.
And then, the server continues to determine the second checksum of the fragmented file according to the first signature algorithm under the condition that the first global unique identifier is consistent with the second global unique identifier. In other words, after the server obtains the fragmented file in the fragmented file data packet, the second checksum is obtained by performing one-time calculation on the fragmented file by using the first signature algorithm specified in the fragmented file data packet.
Further optionally, if the server determines that the first global unique identifier is inconsistent with the second global unique identifier, the server may discard the received fragmented file packet, or the server returns a failure prompt to the terminal or the intermediate device.
And S203, merging the fragmented files with the existing fragmented files in the preset storage space according to the index number, the first checksum and the second checksum.
The preset storage space is used for storing the fragmented files, and the fragmented files can be a designated storage area or files designated in the storage area. Optionally, the server may generate a storage space corresponding to the second globally unique identifier when receiving the file upload request. In an exemplary embodiment, when the server receives the file upload request, a temporary file uploadId is created in a storage device corresponding to the server according to the second global unique identifier, where uploadId is the second global unique identifier.
Furthermore, the server may combine the fragmented file with the existing fragmented file in the preset storage space according to the index number, the first checksum and the second checksum.
Optionally, the server determines whether the fragmented file is correct according to the first checksum and the second checksum, and then determines whether the uploading sequence of the fragmented file is correct according to the index number under the condition that the fragmented file is correct; the server can also determine whether the uploading sequence of the fragmented files is correct according to the index numbers, and then determine whether the fragmented files are correct according to the first checksum and the second checksum under the condition that the uploading sequence is correct. And then, the server can combine the fragmented files with the existing fragmented files in the preset storage space under the condition that the uploading sequence of the fragmented files is correct and the fragmented files are correct.
Further optionally, the server merges the fragmented file with the fragmented file in the storage space corresponding to the second global unique identifier according to the index number, the first checksum and the second checksum. It will be appreciated that if the server receives the first shard file packet, the shard file in the storage space may be empty.
For example, assuming that the to-be-stored file a is fragmented to obtain a fragmented file a to a fragmented file E, after receiving a fragmented file packet a corresponding to the fragmented file a, the server merges the fragmented file a into the uploadid.
And then, the server receives a fragment file data packet B corresponding to the fragment file B, and continuously merges the fragment file B into an uploadId.part file according to the index number, the first checksum and the second checksum corresponding to the fragment file data packet B, wherein the uploadId.part file is the merging result of the fragment file A and the fragment file B.
Thus, the intermediate process is not repeated. Finally, after receiving the fragment file data packet E corresponding to the fragment file E, the server continues to merge the fragment file E into the uploadid.part file according to the index number, the first checksum and the second checksum corresponding to the fragment file data packet E, where in this case, the uploadid.part file is the merging result of the fragment files a to E. The fragment files A to E and the merging result are equivalent to the files to be stored.
In the file transmission method, the fragmented file is obtained by performing fragmentation processing on the file to be stored, and the fragmented file data packet comprises the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm, so that after the fragmented file data packet is received, the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm can be determined. Further, the method can combine the fragmented files with the existing fragmented files in the preset storage space by comparing the first global unique identifier with the second global unique identifier and combining the index number, the first checksum and the information between the second checksum under the condition that the first global unique identifier and the second global unique identifier are consistent, so that the reliability of the fragmented files is verified before the fragmented files are combined, the combined fragmented files in the storage space are available, and the accuracy and the reliability of the combination are improved, so that the reliability of file transmission is improved.
Fig. 3 is a schematic flow chart of merging according to an embodiment of the present application, and in an exemplary embodiment, as shown in fig. 3, S203 includes S301 to S302.
S301, determining whether the uploading sequence of the fragmented files is correct according to the index numbers.
In this embodiment, the server will first determine whether the uploading sequence of the fragmented files in the fragmented file data packet is correct according to the index number in the fragmented file data packet.
Optionally, the server may determine an index number of the next fragmented file according to the index number of the fragmented file that has been merged in the storage space, and determine whether the index number in the received data packet of the fragmented file is the index number of the next fragmented file, and if the index number in the received data packet of the fragmented file is the same as the index number of the next fragmented file, determine that the uploading sequence of the fragmented file is correct.
Otherwise, if the index number in the received data packet of the fragmented file is different from the index number of the next fragmented file, determining that the uploading sequence of the fragmented file is wrong. Further optionally, if the uploading order of the fragmented files is correct, the server may return a failure prompt to indicate that the uploading order of the fragmented files in the fragmented file data packet is wrong.
S302, merging the fragmented file with the existing fragmented file in the storage space when the uploading sequence of the fragmented file is correct and the first checksum is consistent with the second checksum.
In this embodiment, if the uploading order of the fragmented files is correct, the server will continue to merge the fragmented files with the fragmented files existing in the preset storage space according to the first checksum and the second checksum. For example, assuming that the server receives the fragmented file packet a, if the uploading order of the fragmented file is correct, the server will continue to compare the first checksum in the fragmented file packet a with the second checksum calculated for the fragmented file a according to the first signature algorithm in the fragmented file packet a. If the first checksum is consistent with the second checksum, the fact that the segmented file A is not tampered is indicated, and the server continues to merge the segmented file A with the segmented files existing in the storage space.
In the above embodiment, whether the uploading sequence of the fragmented file is correct is determined according to the index number, and then, if the uploading sequence of the fragmented file is correct and the first checksum is consistent with the second checksum, the fragmented file is combined with the fragmented file existing in the preset storage space according to the first checksum and the second checksum, so that the reliability of the combining process is improved by using the first checksum and the second checksum, and the reliability of file transmission is improved.
In an exemplary embodiment, optionally, S302 described above may be implemented as follows:
and merging the fragmented file with the existing fragmented file in the storage space under the condition that the first checksum is consistent with the second checksum.
In an exemplary embodiment, optionally, S301 described above may be implemented as follows:
determining whether the uploading sequence corresponding to the fragmented file is correct or not according to the index number of the existing fragmented file and the index number of the fragmented file in the target database; the global unique identifier of the existing sharded file in the target database is a second global unique identifier.
In this embodiment, the server may access a target database, where index numbers of all the current received shard files and corresponding first globally unique identifiers may be stored. Alternatively, the server may create the target database after receiving the file upload request sent by the terminal. Further, after merging the fragmented file in the fragmented file data packet with the existing fragmented file in the storage space, the server may record the index number and the first global unique identifier in the fragmented file data packet in the target database.
It will be appreciated that for the transfer task of the same file to be stored, the second globally unique identifier is equal to the first globally unique identifier, that is, the globally unique identifier of the existing sharded file in the target database is equal to the second globally unique identifier. Therefore, the server can determine whether the uploading sequence corresponding to the fragmented files is correct according to the index number of the existing fragmented files and the index number of the fragmented files in the target database.
Optionally, the server may traverse the index number of the existing fragmented file in the target database, and determine whether the index number in the fragmented file packet is equal to the index number next to the largest index number in the index number of the existing fragmented file, if the index number in the fragmented file packet is equal to the index number next to the largest index number in the index number of the existing fragmented file, the uploading order is correct, otherwise, the uploading order is incorrect.
For example, for a file a to be stored, if the server receives a first fragmented file packet a and merges the fragmented file a with an existing fragmented file in the storage space, the server records a first global unique identifier a corresponding to the fragmented file packet a and an index number of the fragmented file a in the target database. Then, if the server receives the second fragmented file data packet B, when determining the uploading sequence, the server determines that, among the index numbers of the fragmented files corresponding to the first global unique identifier a in the target database, the largest index number is the index number of the fragmented file a, and the index number next to the index number of the fragmented file a is the index number of the index number B. If the index number in the data packet B of the fragmented file is the index number of the index number B, the uploading sequence of the fragmented file is correct.
In the above embodiment, since the global unique identifier of the existing fragmented file in the target database is the second global unique identifier, it can be determined whether the uploading sequence corresponding to the fragmented file is correct according to the index number of the existing fragmented file in the target database and the index number of the fragmented file, so as to implement the process of judging the uploading sequence of the fragmented file by using the index number.
Fig. 4 is a schematic flow chart of a transmission process in the embodiment of the present application, and in an exemplary embodiment, as shown in fig. 4, the above transmission method further includes S401 to S404.
S401, receiving a file uploading request of a file to be stored, which is sent by a terminal; the file upload request includes a file name and a file size of the file to be stored.
In this embodiment, the terminal may send a file upload request to the server in the case where it wants to transmit a file to be stored to the server. And then, the server receives a file uploading request of the file to be stored, which is sent by the terminal.
The file uploading request comprises a file name and a file size of a file to be stored. The file name may be an actual name of the file to be stored, or an index for indexing the actual name of the file to be stored, which is not limited in this embodiment.
S402, determining whether a file to be stored exists in the server or not based on the file name.
Further, the server determines whether the file to be stored exists in the server according to the file name in the file uploading request. Alternatively, the server may search the target database for a file name to determine whether to store the file to be stored.
S403, determining the second global unique identifier and the storage space under the condition that no file to be stored exists in the server and the free storage space exists in the server based on the file size.
Further, if the file to be stored exists in the server, the server may return a prompt message to the terminal for prompting that the file to be stored already exists in the server.
If the file to be stored does not exist in the server, the server determines that the free storage space exists in the server according to the size of the file. Alternatively, the server may determine that there is free storage space in the server if the current available storage space is greater than or equal to the file size, and otherwise, the server determines that there is no free storage space.
Then, in the case that there is no file to be stored and there is free storage space in the server, the server determines the second globally unique identifier and the storage space again, so as to facilitate subsequent file transfer.
Illustratively, in the case where there is no file to be stored and there is free storage space in the server, the server creates a second globally unique identifier uploadId of the file to be stored and creates an uploadId.
S404, the second globally unique identifier is sent to the terminal.
After the server determines the second globally unique identifier, the server sends the second globally unique identifier to the terminal. In this way, when the terminal subsequently uploads the corresponding file to be stored, the second global unique identifier is added to the data packet of the fragmented file as the first global unique identifier, so as to ensure that the first global unique identifier is consistent with the second global unique identifier of the file to be stored.
In the above embodiment, after receiving the file upload request of the file to be stored sent by the terminal, since the file upload request includes the file name and the file size of the file to be stored, it can be determined whether the file to be stored exists in the server based on the file name, and if the file to be stored does not exist in the server, and if it is determined that the free storage space exists in the server based on the file size, the second global unique identifier and the storage space are determined. Further, the second global unique identifier is sent to the terminal, so that the terminal can generate the fragmented file data packet according to the second global unique identifier, and the server can conveniently compare the first global unique identifier and the second global unique identifier in the fragmented file data packet, and the reliability of file transmission is improved.
FIG. 5 is a flow chart illustrating a further transmission process according to an embodiment of the present application, in an exemplary embodiment, as shown in FIG. 5, the file upload request includes a third checksum of the file to be stored; the above transmission method further includes S501 to S503.
S501, receiving first indication information sent by a terminal; the first indication information comprises a second signature algorithm; the first indication information is sent by the terminal when uploading all the fragmented files of the file to be stored is completed.
In this embodiment, uploading all the fragmented files of the file to be stored is completed, that is, the fragmented file data packets of all the fragmented files are sent to the server. Optionally, the terminal may determine that uploading all the fragmented files of the file to be stored is completed when the terminal successfully sends the fragmented file data packet corresponding to the last index number to the server according to the index number of each fragmented file.
Further, the terminal sends the first indication information to the server under the condition that uploading of all the fragmented files of the file to be stored is completed. The first indication information is used for prompting the server terminal to finish uploading all the fragmented files of the file to be stored.
The first indication information includes a second signature algorithm, and the second signature algorithm is used for verifying the merging result of all the fragmented files by the server, and may also be at least one algorithm of MD5, SHA-1, SHA256 and SHA 512. Likewise, the second signature algorithm may be a fixed algorithm, or may be an algorithm determined by the terminal according to the type of the file to be stored, which is not limited in this embodiment.
S502, determining a fourth checksum of the target file according to a second signature algorithm; the target file is obtained by combining all the fragmented files in the storage space.
Further, the server can combine all the fragmented files in the storage space to obtain the target file under the condition that the server receives the first prompt message. Optionally, the server may perform merging processing on all the fragmented files with the same second globally unique identifier in the storage space to obtain the target file. Further, the server determines a fourth checksum of the target file according to the second signature algorithm.
Taking the to-be-stored file including the fragmented files a to E as an example, the server indicates that the server has sequentially merged the fragmented files a to E into the uploadid/part file under the condition that the server receives the first indication information, and then the server calculates a fourth checksum of the entire uploadid/part file according to the second signature algorithm.
And S503, determining the global unique identifier corresponding to the target file as a second global unique identifier and modifying the name of the target file as the name of the file to be stored under the condition that the fourth checksum is consistent with the third checksum.
In this embodiment, the file upload request includes a third checksum of the file to be stored. The third checksum may be calculated by the terminal according to the second signature algorithm. Therefore, the server can judge whether the target file is the file to be stored which is finally transmitted according to the fourth checksum and the third checksum.
If the fourth checksum is consistent with the third checksum, the target file obtained after merging all the fragmented files is identical to the file to be stored, and no tampering occurs in the transmission process. Therefore, if the fourth checksum is consistent with the third checksum, the server determines that the globally unique identifier corresponding to the target file is the second globally unique identifier, and modifies the name of the target file to the name of the file to be stored. Continuing with the example above, the computer device may modify the name of the uploadid.part file to the name of file a to be stored.
In some embodiments, after modifying the name of the target file to the name of the file to be stored, the server stores the target file in the target database. Further alternatively, the server may update the file status of the target file in the target database, for example, to modify the status of the target file in the target database to have completed transmission.
In the above embodiment, since the first indication information is sent when the terminal finishes uploading all the fragmented files of the file to be stored, and the first indication information includes the second signature algorithm, after receiving the first indication information sent by the terminal, the fourth checksum of the target file may be determined according to the second signature algorithm. Because the target file is obtained by combining all the fragmented files in the storage space, the global unique identifier corresponding to the target file can be determined to be the second global unique identifier under the condition that the fourth checksum is consistent with the third checksum, and the name of the target file is modified to be the name of the file to be stored, so that the reliability of the received file to be stored is improved.
In an exemplary embodiment, optionally, the above "determining the second globally unique identifier" may be implemented as follows:
And determining a second global unique identifier according to a preset identifier generation rule.
In this embodiment, the identifier generation rule is used to generate a second globally unique identifier of the file to be stored. The identifier generation rule may be a rule that other devices send to the server, or may be a rule that the server determines in response to input information of the user. The server may then determine a second globally unique identifier based on the identifier generation rule. It will be appreciated that the second globally unique identification and the first globally unique identification should be unique.
In the above embodiment, since the second globally unique identifier can be determined according to the preset identifier generation rule, the determination efficiency of the second globally unique identifier is improved.
In an exemplary embodiment, optionally, the above transmission method further includes the following steps:
sending second indication information to the terminal so as to obtain a fragment file data packet corresponding to the next fragment file through the second indication information; the second indication information comprises an index number of the next fragment file.
In this embodiment, the second indication information includes an index number of the next fragment file. The next fragmented file refers to the next fragmented file of the fragmented files in the data packet of the fragmented file received by the server at the current time. Optionally, the server may increment the index number of the current received fragmented file in the fragmented file packet by one to determine the index number of the next fragmented file.
Further optionally, the server may send the second indication information to the terminal after determining that the fragmented file of the current file data packet is combined with an existing fragmented file in the preset storage space. Therefore, the terminal can continuously send the data packet of the next fragmented file to the server according to the second indication information, and the server can finally obtain all the fragmented files of the file to be stored in a reciprocating manner.
Continuing with the above example, after the server receives the fragmented file packet a and merges the fragmented file a in the fragmented file packet a with an existing fragmented file in the storage space, the server returns an index number of the fragmented file B to the terminal, so that the terminal sends the fragmented file packet B including the fragmented file B to the server. Further, after the server obtains the sliced file data packet B, the sliced file B in the sliced file data packet B is combined with the existing sliced file in the storage space, that is, the combination of the sliced file a and the sliced file B is realized. And so on, and will not be described in detail herein. In this way, in the process of uploading the data packets of the fragmented files in a single-thread sequence, the error rate, the merging difficulty and the implementation complexity of merging the fragmented files can be reduced.
In the above embodiment, since the second instruction information includes the index number of the next fragmented file, after the second instruction information is sent to the terminal, the fragmented file packet corresponding to the next fragmented file can be obtained through the second instruction information. Therefore, the fragmented file data packet can be acquired based on single threads, the complexity of file transmission is reduced, and the reliability of file transmission is improved.
Fig. 6 is a schematic flow chart of another transmission procedure in the embodiment of the present application, and in an exemplary embodiment, as shown in fig. 6, the above-mentioned transmission method further includes S601 to S602.
S601, creating a target database in the case that no file to be stored exists in the server and free storage space exists in the server.
In this embodiment, the server may determine, when receiving a file upload request sent by the terminal, whether a file to be stored exists and whether there is a free storage space according to a file name and a file size in the file upload request. The server may also determine whether a file to be stored exists and whether there is free storage space in response to a user's operation.
Further, in the case where there is no file to be stored in the server and there is free storage space in the server, the server creates a target database. It should be noted that the target database may include a database created by a server, and may also include a data record table in the database.
S602, storing file information of the fragmented file into a target database under the condition that the fragmented file is received; the file information includes at least any one of a first globally unique identification, an index number, a file size, a reception time, and an upload number of the fragmented file.
Further, if the server successfully receives the fragmented file data packet, it indicates that the server receives the fragmented file in the fragmented file data packet. Further, when the fragmented file is received, the server stores file information of the fragmented file in the target database.
The file information comprises at least any one of a first global unique identification, an index number, a file size, a receiving time and uploading times of the fragmented file. The receiving time is used to indicate the time when the server receives the fragmented file, which may be the point in time when the server successfully merges the fragmented file. The number of uploading is used to represent the number of times the server receives the fragmented file data packet. Optionally, the server increases the uploading frequency of the corresponding segmented file by 1 in the target database every time it receives a segmented file packet.
In the above embodiment, since the target database can be created in the case where there is no file to be stored in the server and there is a free storage space in the server, and in the case where the fragmented file is received, file information of the fragmented file is stored in the target database, where the file information includes at least any one of a first globally unique identifier, an index number, a file size, a reception time, and an upload number of times of the fragmented file. Therefore, whether the uploading order is correct or not can be efficiently and accurately determined based on the target database.
Fig. 7 is a schematic flow chart of another transmission process in the embodiment of the present application, and in an exemplary embodiment, as shown in fig. 7, the above transmission method further includes S701 to S703.
S701, receiving a retransmission request sent by a terminal; the retransmission request is sent under the condition of communication fault recovery between the terminal and the server; the retransmission request includes the second globally unique identification.
In this embodiment, the communication between the server and the terminal may malfunction due to factors such as network delay, network interruption, and the like. The communication condition between the terminal and the server can be determined through the heartbeat packet. For example, the terminal may determine that the two parties are in communication failure if the heartbeat packet sent by the server is not received within the first preset time period. If the terminal receives the heartbeat packet sent by the server within the second preset time after the communication fault is determined, the terminal determines that the communication fault with the server is recovered.
Further, in the case of communication failure recovery between the terminal and the server, the terminal may transmit a retransmission request to the server to receive the retransmission request by the server. Wherein the retransmission request comprises a second globally unique identification of the file to be stored.
S702, determining the index number of the target fragment file with the same global unique identifier as the second global unique identifier from the target database based on the retransmission request.
In this embodiment, there may be multiple files corresponding to the globally unique identifier in the target database. Therefore, after receiving the retransmission request, the server determines, from the target database, the index number of the target shard file with the global unique identifier identical to the second global unique identifier according to the second global unique identifier in the retransmission request.
For example, assuming that the target database includes a shard file a, a shard file B, and a shard file C corresponding to the global unique identifier a, and a shard file M and a shard file N corresponding to the global unique identifier B, the second global unique identifier is the same as the global unique identifier a, the target shard file includes a shard file a, a shard file B, and a shard file C. Further, the server can determine the index numbers corresponding to the fragmented file a, the fragmented file B, and the fragmented file C.
S703, sending third indication information to the terminal; the third indication information includes an index number of a next fragmented file of the target fragmented file.
Still further, the server may determine an index number of a next shard file of the target shard file. Alternatively, the computer device may use the next index number of the largest index number among the index numbers of the target fragmented file as the index number of the next fragmented file. Further, the server may transmit third indication information including an index number of a next fragmented file of the target fragmented file to the terminal.
For example, assuming that index numbers of the slice file a, the slice file B, and the slice file C are block0, block1, and block2 in order, an index number of a next slice file of the target slice file is block3, where block3 is also an index number of the slice file D. Further, the server sends third indication information including "block3" to the terminal, so as to instruct the terminal to continuously upload the fragmented file data packet corresponding to the fragmented file D.
In some embodiments, after the server sends the third indication information, the server may increase the number of uploads of the next fragmented file in the target database by 1 according to the index number of the next fragmented file in the third indication information.
In the above embodiment, since the retransmission request is sent in the case of recovering from a communication failure between the terminal and the server and the retransmission request includes the second global unique identifier, the index number of the target fragmented file with the global unique identifier identical to the second global unique identifier is determined from the target database based on the retransmission request, and the third instruction information is sent to the terminal. Further, because the third indication information includes the index number of the next fragment file of the target fragment file, in the process of needing retransmission, the server can timely return the index number of the fragment file needing retransmission to the terminal, thereby improving the reliability of retransmission.
Fig. 8 is a schematic flow chart of another transmission procedure in the embodiment of the present application, and in an exemplary embodiment, as shown in fig. 8, the above transmission method further includes S801 to S802.
S801, a test request sent by a terminal is received.
In this embodiment, the server is capable of receiving a test request sent by the terminal. The test request is used for measuring network environment information between the server and the terminal. The terminal may send a test request to the server if the file to be stored needs to be uploaded to the server, or the terminal may periodically send a test request to the server. Illustratively, the test request may include a ping (internet packet explorer, packet Internet Groper) command.
S802, fourth indication information is sent to the terminal based on the test request; the fourth indication information comprises network environment information between the server and the terminal; and the fourth indication information is used for indicating the terminal to determine the slicing strategy of the file to be stored based on the network environment information.
In this embodiment, after the server receives the test request, the network environment information between the server and the terminal may be determined based on the test request. The network environment information may include, but is not limited to, at least one of network status level, network speed, latency, and the like, for describing network conditions between the server and the terminal.
The test request may be, for example, a time when the portable terminal sends the test request, and the server determines network environment information between the server and the terminal according to the time when the test request is received and the time when the terminal sends the test request. Further, the server transmits fourth instruction information including the network environment information to the terminal so that the terminal knows the network condition between the both sides.
Further, the terminal can determine a fragmentation policy of the file to be stored based on the network environment information. Optionally, the terminal may store preset correspondence between different network environment information and different fragmentation policies, and determine the fragmentation policy of the file to be stored according to the received network environment information and the preset correspondence. And then, the terminal can carry out the slicing processing on the files to be stored according to the slicing strategy and send the data packets of the slicing files to the server.
In the above embodiment, the test request sent by the terminal is received, and the fourth indication information is sent to the terminal based on the test request. The fourth indication information comprises the network environment information between the server and the terminal, and the fourth indication information is used for indicating the terminal to determine the slicing strategy of the file to be stored based on the network environment information, so that the slicing strategy which is accurate and suitable for the network condition between the current server and the terminal can be determined, and the file transmission efficiency is improved.
In an exemplary embodiment, optionally, the file transmission method further includes the following steps:
if the uploading sequence is incorrect or the first checksum is inconsistent with the second checksum, fifth indication information is sent to the terminal; and the fifth indication information is used for indicating the terminal to retransmit the fragment file data packet.
In this embodiment, after receiving the data packet of the fragmented file, the server may determine whether the uploading sequence of the fragmented file is correct according to the index number, the first checksum and the second checksum, and compare the first checksum and the second checksum. If the uploading sequence is incorrect, or the first checksum and the second checksum are inconsistent, the received fragmented file data packet is indicated to be wrong, so that the server does not perform subsequent merging, but returns fifth indicating information to the terminal to indicate the terminal to retransmit the fragmented file data packet.
Optionally, the fifth indication information may include an index number of the fragmented file that needs to be retransmitted. That is, the fifth indication information includes an index number of the fragmented file that the server needs to retransmit by the terminal.
Further optionally, if the uploading order is correct, the computer device may use the index number in the data packet of the fragmented file as the index number of the fragmented file that needs to be retransmitted. That is, in this case, the server returns the index number in the fragmented file packet to the terminal.
If the uploading sequence is wrong, the computer equipment can determine the index number of the fragmented file needing to be retransmitted according to the target database. Optionally, the computer device determines from the target database an index number of a next shard file that first globally uniquely identifies the same target shard file. For example, assuming that the first global unique identifier in the received fragmented file data packet a is the global unique identifier a, and that the uploading sequence is wrong according to the index number in the fragmented file data packet a, the computer device determines that the target fragmented file corresponding to the global unique identifier a in the target database is the fragmented file a, the fragmented file B and the fragmented file C, and determines that the index number of the next fragmented file of the target fragmented file is block3. That is, in this case, the server returns the index number of the next fragmented file of the target fragmented file to the terminal.
In the above embodiment, the fifth indication information is sent to the terminal when the uploading order is incorrect or the first checksum and the second checksum are inconsistent, and the fifth indication information is used to instruct the terminal to retransmit the fragmented file data packet, so that the reliability of file transmission is improved.
The above is exemplified as the file transfer method applied to the server side, and a procedure of applying the file transfer method to the terminal side will be described below. In an exemplary embodiment, a file transmission method is provided, and the method is applied to the terminal in fig. 1 for illustration, and includes the following steps:
and sending a fragmented file data packet comprising the fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm to a server, so that the server determines a second checksum of the fragmented file according to the first signature algorithm under the condition that the first global unique identifier is consistent with a second global unique identifier of the file to be stored, and merges the fragmented file with the fragmented file existing in a preset storage space according to the index number, the first checksum and the second checksum.
In this embodiment, the terminal may send a fragment file packet to the server. The fragmented file data packet comprises a fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm. The description of the fragmented file packet may refer to S201, and will not be described herein.
The terminal can send the data packets of the fragmented files to the server according to the sequence of the index numbers of the fragmented files. For example, the terminal first sends a slice file packet corresponding to block0 to the server.
In one embodiment, the terminal packages the fragmented file, the index number of the fragmented file, the first checksum, the first globally unique identifier and the first signature algorithm to obtain a fragmented file data packet, and sends the fragmented file data packet to the server.
In one embodiment, the terminal may determine the first signature algorithm based on at least one of a type, a size, and network environment information between the terminal and the server of the file to be stored.
Further, after receiving the data packet of the fragmented file, the server may determine, according to the first signature algorithm, a second checksum of the fragmented file when the first global unique identifier is consistent with the second global unique identifier of the file to be stored, and combine the fragmented file with the existing fragmented file in the preset storage space according to the index number, the first checksum and the second checksum, which will not be described herein.
In the file transmission method, the fragmented file data packet comprising the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm is sent to the server, so that the server determines the second checksum of the fragmented file according to the first signature algorithm under the condition that the first global unique identifier is consistent with the second global unique identifier of the file to be stored, and merges the fragmented file with the existing fragmented file in the preset storage space according to the index number, the first checksum and the second checksum.
Fig. 9 is a schematic flow chart of still another transmission procedure in the embodiment of the present application, and in an exemplary embodiment, as shown in fig. 9, the above transmission method further includes S901 to S902.
S901, sending a file uploading request of a file to be stored to a server; the file upload request includes a file name and a file size of the file to be stored.
S902, receiving a second global unique identifier sent by a server; wherein the second globally unique identifier is determined by the server if it is determined that there is no file to be stored in the server based on the file name and if it is determined that there is free storage space in the server based on the file size.
The above process may refer to S401 to S404, and will not be described here again.
In the above embodiment, since the file upload request includes the file name and the file size of the file to be stored, after the file upload request of the file to be stored is sent to the server, the server may determine that the file to be stored does not exist in the server based on the file name, and determine the second global unique identifier if the free storage space exists in the server based on the file size, so that the second global unique identifier sent by the server may be received, which is favorable for generating the packet of the split file according to the second global unique identifier.
In an exemplary embodiment, optionally, the file upload request further includes a third checksum of the file to be stored; the file transmission method further comprises the following steps:
under the condition that uploading of all fragmented files of the file to be stored is completed, first indication information is sent to a server; the first indication information comprises a second signature algorithm; the first indication information is used for indicating the server to determine a fourth checksum of the target file according to the second signature algorithm, and determining that the global unique identifier corresponding to the target file is a second global unique identifier and modifying the name of the target file to be the name of the file to be stored under the condition that the fourth checksum is consistent with the third checksum; the target file is obtained by combining all the fragmented files in the storage space.
In this embodiment, the terminal may determine whether the uploading is completed according to the index number of the next fragment file returned by the server. For example, if the index number of the next fragment file returned by the server is greater than the maximum index number, the terminal confirms that all fragment files of the file to be stored are uploaded.
In some embodiments, the terminal may determine that uploading all the fragmented files of the file to be stored is completed when the data packet of the fragmented file corresponding to the last index number is successfully sent to the server according to the index number of each fragmented file.
Further, the terminal sends first indication information to the server under the condition that uploading of all the fragmented files of the file to be stored is completed. Wherein the first indication information comprises a second signature algorithm.
In one embodiment, the terminal may still determine the second signature algorithm based on at least one of the type, size, and network environment information between the terminal and the server of the file to be stored.
The above-mentioned process may refer to the above-mentioned S501 to S503, and will not be described here again.
Fig. 10 is a schematic flow chart of still another transmission procedure in the embodiment of the present application, and in an exemplary embodiment, as shown in fig. 10, the above transmission method further includes S1001 to S1002.
S1001, when communication failure with the server is recovered, a retransmission request is sent to the server; the retransmission request includes a second globally unique identification; the retransmission request is used for instructing the server to determine the index number of the target fragment file with the same global unique identifier as the second global unique identifier from the target database.
S1002, receiving third indication information sent by a server; the third indication information includes an index number of a next fragmented file of the target fragmented file.
The above process may refer to S701 to S703, and will not be described here again.
Fig. 11 is a schematic flow chart of a slicing process in the embodiment of the present application, and in an exemplary embodiment, as shown in fig. 11, the above-mentioned transmission method further includes S1101 to S1104.
S1101, a test request is sent to the server.
In this embodiment, please refer to S801 to S802 described above, the terminal may send a test request to the server if the file to be stored needs to be uploaded to the server, or the terminal may periodically send the test request to the server. Illustratively, the test request includes a PING command.
S1102, receiving fourth indication information sent by the server based on the test request; the fourth indication information includes network environment information between the server and the terminal.
Further, after receiving the test request, the server may determine network environment information between the server and the terminal based on the test request, and send fourth indication information including the network environment information to the terminal. Thus, the terminal can receive the fourth indication information sent by the server based on the test request.
S1103, determining a slicing strategy of the file to be stored based on the network environment information.
The terminal can then determine a fragmentation policy for the file to be stored based on the network environment information. Optionally, the terminal may store preset correspondence between different network environment information and different fragmentation policies, and determine the fragmentation policy of the file to be stored according to the received network environment information and the preset correspondence.
Table 1 shows an illustration of a preset correspondence. Illustratively, the terminal may determine a level of network condition between the terminal and the server according to the network environment information, and the level of network condition may include four levels of good, general, poor, and bad.
Fig. 12 is a schematic diagram of a grading process in an embodiment of the present application, where, as shown in fig. 12, the network environment information may include information about network time consumption or information for calculating network time consumption.
Further, the terminal may determine that the network between it and the server is time consuming. If the network time consumption is less than or equal to the first preset time consumption, the terminal determines that the grade of the network condition is good; if the network time consumption is greater than the first preset time consumption and less than or equal to the second preset time consumption, the terminal determines that the grade of the network condition is general; if the network time consumption is greater than the second preset time consumption and less than or equal to the third preset time consumption, the terminal determines that the grade of the network condition is poor; if the network time consumption is still greater than the third preset time consumption, the terminal determines that the grade of the network condition is poor.
The first preset time consumption, the second preset time consumption and the third preset time consumption are set according to requirements, and the first preset time consumption is less than the second preset time consumption and less than the third preset time consumption. Illustratively, the first preset time period is equal to 10ms (milliseconds), the second preset time period is equal to 50ms, and the third preset time period is equal to 100ms.
Further, the terminal can determine different slicing strategies according to different levels. The fragmentation policy may include a fragmentation size, among other things. Continuing to take table 1 as an example, when the network environment information is of a good level, the terminal fragments the file to be stored according to a fragment size of every 10M (mega). That is, the size of the fragmented file may be 10M or less. Other classes are the same and are not described in detail herein.
Table 1 preset correspondence
S1104, carrying out slicing processing on the files to be stored according to the slicing strategy to obtain at least one sliced file.
Thus, the terminal can perform the slicing processing on the file to be stored according to the slicing strategy to obtain at least one sliced file. It can be understood that the terminal can also determine and give the index number, the size and other file information of each fragmented file in the process of carrying out the fragmentation processing on the files to be stored according to the fragmentation strategy.
For example, when the network environment level is good, after the terminal performs the slicing processing on the file to be stored of 43M, the slicing files a, B, C, D and E of 10M, 10M and 3M are obtained, where the index numbers of the slicing files a to E are sequentially block0, block1, block2, block3 and block4.
In one embodiment, the terminal may create a temporary directory temp, and perform a slicing process on the file to be stored in the temporary directory temp, so as to obtain a plurality of sliced files.
Further optionally, the terminal may delete each fragmented file from the temporary directory temp after the uploading of the fragmented file is successful, so as to avoid file deposition and release disk space.
In the above embodiment, the test request is sent to the server, and the fourth indication information sent by the server based on the test request is received. Because the fourth indication information comprises the network environment information between the server and the terminal, the slicing strategy of the file to be stored is determined based on the network environment information, and further, at least one slicing file can be obtained by slicing the file to be stored according to the slicing strategy. Therefore, the method can determine the slicing strategy which is accurate and suitable for the network condition between the current server and the terminal, so that the file transmission efficiency is improved.
Fig. 13 is a schematic flow chart of still another transmission procedure in the embodiment of the present application, and in an exemplary embodiment, as shown in fig. 13, the above transmission method further includes S1301 to S1304.
S1301, determining the transmission progress according to the number of the uploaded fragmented files corresponding to the files to be stored, the size of the uploaded fragmented files and the size of the files to be stored.
In this embodiment, the uploaded fragmented file may be determined according to the fragmented file packet that has been sent by the terminal. Optionally, the terminal may use the number of sent fragmented file data packets as the number of uploaded fragmented files, or may subtract 1 from the number of sent fragmented file data packets to be used as the number of uploaded fragmented files, and the terminal may determine the number of uploaded fragmented files according to the total number of fragmented files after the fragmentation processing is performed on the files to be stored and the number of the current non-uploaded fragmented files.
The size of the uploaded fragmented file may be determined based on the size of the fragmented file in the uploaded fragmented file packet. For example, the terminal may use the sum of the sizes of the respective fragmented files in the already transmitted fragmented file packets as the size of the uploaded fragmented file.
Further, the terminal can determine the transmission progress according to the number of the uploaded fragmented files corresponding to the files to be stored, the size of the uploaded fragmented files and the size of the files to be stored. Optionally, the computer device determines a quotient between the number of uploaded fragmented files and the size of the uploaded fragmented files, and determines the transmission progress according to a ratio between the quotient and the size of the files to be stored.
For example, the terminal may determine the transmission progress according to the transmission progress= (number of uploaded fragmented files-size of uploaded fragmented files)/size of the file to be stored.
S1302, determining the transmission rate according to the number of the uploaded fragmented files, the size of the uploaded fragmented files, the current time and the uploading starting time.
In this embodiment, the terminal may take the time of sending the first fragmented file packet as the start uploading time, or may take the time of sending the file uploading request to the server as the start uploading time, which is not limited to this embodiment.
Further alternatively, the computer device may determine a first product between the number of uploaded fragmented files and the size of the uploaded fragmented files, determine a difference between the current time and the time to start uploading, and further determine the transmission rate according to a ratio of the first product to the difference.
For example, the terminal may determine the transmission progress according to the transmission rate= (number of uploaded fragmented files x size of uploaded fragmented files)/(current time-start uploading time).
S1303, determining estimated remaining time according to the number of the non-uploaded segmented files corresponding to the files to be stored, the size of the non-uploaded segmented files and the transmission rate.
The number of the non-uploaded segmented files corresponding to the files to be stored is equal to the difference value between the total number of the segmented files and the number of the uploaded segmented files. Further, the size of the non-uploaded fragmented file is equal to the difference between the size of the file to be stored and the size of the uploaded fragmented file.
The computer device may determine a second product of the number of non-uploaded fragmented files and a size of the non-uploaded fragmented files and determine the estimated remaining time based on a ratio between the second product and the transmission rate.
For example, the terminal may determine the estimated remaining time according to the estimated remaining time= (number of non-uploaded fragmented files×size of non-uploaded fragmented files)/transmission rate.
S1304, showing the transmission progress, the transmission rate and the estimated remaining time.
Further, after determining the transmission progress, the transmission rate and the estimated remaining time, the terminal may display the transmission progress, the transmission rate and the estimated remaining time, so that the user may learn about the file transmission in time. The display mode of the terminal may be text display, chart display, progress bar display, and the like, which is not limited in this embodiment.
In the above embodiment, the transmission progress is determined according to the number of uploaded fragmented files corresponding to the files to be stored, the size of the uploaded fragmented files, and the size of the files to be stored, and the transmission rate is determined according to the number of uploaded fragmented files, the size of the uploaded fragmented files, the current time and the time to start uploading, and the estimated remaining time is determined according to the number of non-uploaded fragmented files corresponding to the files to be stored, the size of the non-uploaded fragmented files and the transmission rate, so that the user can timely learn the progress of file transmission.
In order to more clearly receive the file transfer method in the present application, description is made herein with reference to fig. 14 and 15. Fig. 14 is a process schematic diagram of a file transfer method in the embodiment of the present application, and fig. 14 schematically illustrates a file transfer process.
As shown in fig. 14, the terminal determines a fragmentation policy according to the network environment information, and then the terminal initiates a file upload request to the server. And the server judges whether the file to be stored exists or not according to the file uploading request. If the server already has the file to be stored, ending the file transmission; if the server does not have the file to be stored, the server continuously judges whether the free storage space exists or not, and if the server does not have the free storage space, the file transmission is ended; if the server has free memory, the server generates a second globally unique identifier uploadId and a memory uploadId.
Further, the terminal performs slicing processing on the file to be stored so as to send a sliced file data packet to the server. After receiving the data packet of the fragmented file, the server performs subsequent checking, merging, recording and other works. And under the condition that the terminal finishes uploading all the fragmented files of the file to be stored, the terminal sends first indication information to the server so that the server finishes the subsequent verification, updating the target file and other works to finish the file transmission.
Fig. 15 is an interaction schematic diagram of a file transmission method in the embodiment of the present application, and as shown in fig. 15, a terminal and a server may execute the file transmission method according to the following flow.
S1501, the terminal sends a test request to the server.
S1502, the server sends fourth indication information to the terminal based on the test request. The fourth indication information comprises network environment information between the server and the terminal.
S1503, the terminal determines the slicing strategy of the file to be stored.
S1504, the terminal sends a file uploading request of the file to be stored to the server. The file uploading request comprises a file name and a file size of a file to be stored.
S1505, the server determines whether there is a file to be stored in the server and whether there is free storage space. If there is no file to be stored and there is free storage space, S1506 is executed. If there is a file to be stored, or if there is no free storage space, the server may send first failure information to the terminal.
S1506, the server determines the second globally unique identification and the storage space.
S1507, the server creates a target database.
S1508, the server sends the second globally unique identifier to the terminal.
S1509, the terminal performs slicing processing on the file to be stored according to the slicing strategy to obtain at least one slicing file.
S1510, the terminal sends the fragment file data packet to the server. The data package of the fragmented file comprises the fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm. The terminal may send the fragmented file packet of the first fragmented file to the server according to the index number of the fragmented file. Optionally, the terminal may send a fragmented file packet with the minimum index number to the server according to the index number of the fragmented file.
S1511, the server determines whether the first globally unique identifier is consistent with the second globally unique identifier of the file to be stored. If the first global unique identifier is consistent with the second global unique identifier, then S1512 is executed; if the first global unique identifier is inconsistent with the second global unique identifier, the server can send second failure information to the terminal.
S1512, the server determines whether the uploading sequence is correct according to the index number of the existing fragmented file in the target database and the index number of the fragmented file in the fragmented file data packet. If the uploading order is correct, executing S1513; if the upload order is wrong, S1514 is executed.
S1513, the server determines whether the first checksum and the second checksum are identical. If the first checksum and the second checksum are identical, S1515 is executed, and if the first checksum and the second checksum are not identical, S1514 is executed.
S1514, the server transmits fifth instruction information to the terminal. After that, the terminal returns to perform S1510 according to the fifth indication information.
S1515, the server merges the fragmented files in the fragmented file data package with the existing fragmented files in the storage space.
S1516, the server stores the file information of the fragmented file in the target database.
S1517, the server sends the second instruction information to the terminal. After that, the terminal executes S1521. The second indication information comprises an index number of the next fragment file.
In the case where the communication between the terminal and the server fails and the communication failure is recovered, S1518 is executed, and the terminal transmits a retransmission request to the server.
S1519, the server determines the index number of the target fragment file with the same global unique identifier as the second global unique identifier from the target database.
S1520, the server transmits third instruction information to the terminal. The third indication information comprises an index number of a next fragment file of the target fragment file.
S1521, the terminal determines whether uploading all the fragmented files of the file to be stored is completed. If the uploading is completed, then enter S1522; if the uploading is not completed, the process returns to S1510 according to the third indication information. Optionally, if the index number of the next file in the third indication information is greater than the maximum index number, the terminal determines that uploading of all files to be stored is completed.
S1522, the terminal sends first indication information to the server. Wherein the first indication information comprises a second signature algorithm.
S1523, the server determines a fourth checksum of the target file according to the second signature algorithm. The target file is obtained by combining all the fragment files in the storage space by the server.
S1524, determining whether the fourth checksum is identical to the third checksum. If the fourth checksum is consistent with the third checksum, then S1525 is performed; if the fourth checksum is inconsistent with the third checksum, the server may return third failure information to the terminal.
S1525, modifying the name of the target file to be the name of the file to be stored.
Optionally, the terminal may further display a transmission progress, a transmission rate, and an estimated remaining time in the file transmission process.
Optionally, file transfer is performed between the terminal and the server based on hypertext transfer protocol (Hypertext Transfer Protocol, HTTP).
S1501 to S1525 may refer to the above embodiments, and are not described herein.
As can be seen, the file transfer party of the present implementation: firstly, the slicing strategy can be determined according to the network environment information, the first signature algorithm and the second signature algorithm can be flexibly selected, and the file uploading requirements under various security scenes can be met. Secondly, the single thread sequence is used for uploading the data packets of the fragmented files, so that the error rate of merging the fragmented files is reduced, and the file merging difficulty and the implementation complexity are reduced. Third, supporting breakpoint uploading, reducing transmission failure caused by network abnormality, and reducing uploading time. Fourth, the terminal can intuitively display the transmission progress, pre-estimate the remaining time and the uploading progress, and is convenient for the user to track. Fifth, the reliability of file transmission is improved because of comparison and verification in the file transmission process.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Fig. 16 is a schematic diagram of an architecture of a file transfer system according to an embodiment of the present application, as shown in fig. 16, where the file transfer system includes a shard policy making unit 1601, a file shard processing unit 1602, a shard file uploading unit 1603, a shard file data processing unit 1604, and a shard file information processing unit 1605.
The slicing policy formulation unit 1601 may be located at a terminal, and is configured to determine a slicing policy, a first signature algorithm, and a second signature algorithm according to network environment information between the terminal and a server.
The file slicing processing unit 1602 may be located at a terminal, and is configured to perform slicing processing on a file to be stored to obtain index numbers of each sliced file, where the index numbers are named, for example, with block+sequence numbers, so as to ensure a sending sequence of subsequent sliced files. Optionally, the file slicing processing unit 1602 automatically deletes the sliced file after the sliced file is uploaded successfully, so as to avoid file deposition and release the disk space of the terminal.
The fragmented file upload unit 1603 may be located at a terminal, and is configured to send a file upload request and a fragmented file packet. The fragmented file upload unit 1603 is further configured to calculate a first checksum of the fragmented file before sending the fragmented file packet.
The fragmented file uploading unit 1603 is further configured to send a first indication message after uploading all fragmented files of the file to be stored is completed, so as to end file transmission.
The slice file uploading unit 1603 is further configured to determine and display a transmission progress, a transmission rate, and an estimated remaining time.
The sliced file data processing unit 1604 may be located in a server, and is configured to receive a sliced file data packet, determine, according to a first signature algorithm, a second checksum of a sliced file when the first global unique identifier is consistent with a second global unique identifier of a file to be stored, and then combine the sliced file with an existing sliced file in a preset storage space according to an index number, the first checksum, and the second checksum.
The slice file data processing unit 1604 is further configured to send the second indication information.
The sliced file data processing unit 1604 is further configured to send the fifth indication information if the uploading order is incorrect or the first checksum is inconsistent with the second checksum.
The fragmented file data processing unit 1604 is further configured to receive the first indication information sent by the terminal, and determine a fourth checksum of the target file according to the second signature algorithm, so that, when the fourth checksum is consistent with the third checksum, it is determined that the global unique identifier corresponding to the target file is the second global unique identifier, and the name of the target file is modified to be the name of the file to be stored.
The fragmented file information processing unit 1605 may be at a server for recording file information of the fragmented file.
The file transfer system may refer to the above embodiments, and will not be described herein.
Based on the same inventive concept, the embodiment of the application also provides a file transmission device for realizing the above related file transmission method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more embodiments of the file transmission device provided below may refer to the limitation of the file transmission method hereinabove, and will not be repeated herein.
Fig. 17 is a block diagram of a file transmission adjustment apparatus according to an embodiment of the present application, in an exemplary embodiment, as shown in fig. 17, there is provided a file transmission apparatus 1700, including: a first receiving module 1701, a first determining module 1702 and a combining module 1703, wherein:
a first receiving module 1701, configured to receive a fragmented file packet; the fragmented file data packet comprises a fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm; the fragmented files are obtained by performing fragmentation processing on files to be stored.
The first determining module 1702 is configured to determine, according to a first signature algorithm, a second checksum of the fragmented file if the first globally unique identifier is consistent with a second globally unique identifier of the file to be stored.
And the merging module 1703 is configured to merge the fragmented file with an existing fragmented file in a preset storage space according to the index number, the first checksum and the second checksum.
In the file transmission device, the fragmented file is obtained by performing fragmentation processing on the file to be stored, and the fragmented file data packet comprises the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm, so that after the fragmented file data packet is received, the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm can be determined. Further, the method can combine the fragmented files with the existing fragmented files in the preset storage space by comparing the first global unique identifier with the second global unique identifier and combining the index number, the first checksum and the information between the second checksum under the condition that the first global unique identifier and the second global unique identifier are consistent, so that the reliability of the fragmented files is verified before the fragmented files are combined, the combined fragmented files in the storage space are available, and the accuracy and the reliability of the combination are improved, so that the reliability of file transmission is improved.
Optionally, the merging module 1703 includes:
and the first determining unit is used for determining whether the uploading sequence of the fragmented files is correct according to the index numbers.
And the merging unit is used for merging the fragmented files with the existing fragmented files in the storage space under the condition that the uploading sequence of the fragmented files is correct and the first checksum is consistent with the second checksum.
Optionally, the first determining unit is further configured to determine whether an uploading sequence corresponding to the fragmented file is correct according to an index number of the existing fragmented file in the target database and an index number of the fragmented file; the global unique identifier of the existing sharded file in the target database is a second global unique identifier.
Optionally, the file transfer device 1700 further includes:
the second receiving module is used for receiving a file uploading request of a file to be stored, which is sent by the terminal; the file upload request includes a file name and a file size of the file to be stored.
And the second determining module is used for determining whether the file to be stored exists in the server or not based on the file name.
And the third determining module is used for determining the second global unique identifier and the storage space when the file to be stored does not exist in the server and the free storage space exists in the server based on the file size.
And the first sending module is used for sending the second global unique identifier to the terminal.
Optionally, the file upload request includes a third checksum of the file to be stored, and the file transmission apparatus 1700 further includes:
the third receiving module is used for receiving the first indication information sent by the terminal; the first indication information comprises a second signature algorithm; the first indication information is sent by the terminal when uploading all the fragmented files of the file to be stored is completed.
The fourth determining module is used for determining a fourth checksum of the target file according to the second signature algorithm; the target file is obtained by combining all the fragmented files in the storage space.
And the fifth determining module is used for determining the global unique identifier corresponding to the target file as the second global unique identifier and modifying the name of the target file into the name of the file to be stored under the condition that the fourth checksum is consistent with the third checksum.
Optionally, the fifth determining module is further configured to determine the second global unique identifier according to a preset identifier generating rule.
Optionally, the file transfer device 1700 further includes:
the second sending module is used for sending second indication information to the terminal so as to obtain a segmented file data packet corresponding to the next segmented file through the second indication information; the second indication information comprises an index number of the next fragment file.
Optionally, the file transfer device 1700 further includes:
the creating module is used for creating a target database under the condition that no file to be stored exists in the server and free storage space exists in the server.
The storage module is used for storing file information of the fragmented file into the target database under the condition that the fragmented file is received; the file information includes at least any one of a first globally unique identification, an index number, a file size, a reception time, and an upload number of the fragmented file.
Optionally, the file transfer device 1700 further includes:
a fourth receiving module, configured to receive a retransmission request sent by a terminal; the retransmission request is sent under the condition of communication fault recovery between the terminal and the server; the retransmission request includes the second globally unique identification.
And a sixth determining module, configured to determine, based on the retransmission request, an index number of the target shard file having the same global unique identifier as the second global unique identifier from the target database.
The third sending module is used for sending third indication information to the terminal; the third indication information includes an index number of a next fragmented file of the target fragmented file.
Optionally, the file transfer device 1700 further includes:
The fifth receiving module is used for receiving a test request sent by the terminal;
the fourth sending module is used for sending fourth indication information to the terminal based on the test request; the fourth indication information comprises network environment information between the server and the terminal; and the fourth indication information is used for indicating the terminal to determine the slicing strategy of the file to be stored based on the network environment information.
Optionally, the file transfer device 1700 further includes:
a fifth sending module, configured to send fifth indication information to the terminal if the first checksum is inconsistent with the second checksum; the fifth indication information comprises an index number of the fragmented file; and the fifth indication information is used for indicating the terminal to retransmit the fragmented file based on the index number.
Fig. 18 is a block diagram illustrating a structure of a file transmission adjustment apparatus according to another embodiment of the present application, and in an exemplary embodiment, as shown in fig. 18, there is provided a file transmission apparatus 1800, including: a transmit module 1801, wherein:
the first sending module 1801 is configured to send a fragmented file packet including a fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier, and a first signature algorithm to a server, so that the server determines, according to the first signature algorithm, a second checksum of the fragmented file when the first global unique identifier is consistent with a second global unique identifier of the file to be stored, and merges the fragmented file with an existing fragmented file in a preset storage space according to the index number, the first checksum, and the second checksum.
In the file transmission device, the server sends the fragmented file data packet including the fragmented file, the index number of the fragmented file, the first checksum, the first global unique identifier and the first signature algorithm to determine the second checksum of the fragmented file according to the first signature algorithm under the condition that the first global unique identifier is consistent with the second global unique identifier of the file to be stored, and merges the fragmented file with the existing fragmented file in the preset storage space according to the index number, the first checksum and the second checksum, so that the reliability of the fragmented file is verified before merging the fragmented file, the usability of each fragmented file merged in the storage space is improved, and the merging accuracy and reliability are further improved, so that the reliability of file transmission is improved.
The respective modules in the above-described file transfer device may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
Fig. 19 is an internal structural diagram of a computer device in an embodiment of the present application, and in an exemplary embodiment, a computer device is provided, which may be a server, and the internal structural diagram may be as shown in fig. 19. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing relevant data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a file transfer method.
It will be appreciated by those skilled in the art that the structure shown in fig. 19 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an exemplary embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor performing the steps of the method embodiments described above when the computer program is executed.
In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the method embodiments described above.
In an exemplary embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A file transfer method, applied to a server side, the method comprising:
receiving a fragmented file data packet; the fragmented file data packet comprises a fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm; the fragmented files are obtained by performing fragmentation processing on files to be stored;
Determining a second checksum of the fragmented file according to the first signature algorithm under the condition that the first global unique identifier is consistent with the second global unique identifier of the file to be stored;
and merging the fragmented files with the existing fragmented files in the preset storage space according to the index number, the first checksum and the second checksum.
2. The method of claim 1, wherein the merging the fragmented file with the fragmented file existing in the preset storage space according to the index number, the first checksum, and the second checksum comprises:
determining whether the uploading sequence of the fragmented files is correct according to the index number;
and merging the fragmented file with the existing fragmented file in the storage space under the condition that the uploading sequence of the fragmented file is correct and the first checksum is consistent with the second checksum.
3. The method according to claim 2, wherein determining whether the uploading order of the fragmented files is correct according to the index number comprises:
determining whether the uploading sequence corresponding to the fragmented file is correct or not according to the index number of the existing fragmented file in the target database and the index number of the fragmented file; the global unique identifier of the existing fragmented file in the target database is the second global unique identifier.
4. The method according to claim 1, wherein the method further comprises:
receiving a file uploading request of the file to be stored, which is sent by a terminal; the file uploading request comprises the file name and the file size of the file to be stored;
determining whether the file to be stored exists in the server or not based on the file name;
determining the second global unique identifier and the storage space when the file to be stored does not exist in the server and the free storage space exists in the server based on the file size;
and sending the second globally unique identifier to the terminal.
5. The method of claim 4, wherein the file upload request includes a third checksum of the file to be stored; the method further comprises the steps of:
receiving first indication information sent by the terminal; the first indication information comprises a second signature algorithm; the first indication information is sent by the terminal when uploading all the fragmented files of the file to be stored is completed;
determining a fourth checksum of the target file according to the second signature algorithm; the target file is obtained by combining all the fragment files in the storage space;
And under the condition that the fourth checksum is consistent with the third checksum, determining the global unique identifier corresponding to the target file as the second global unique identifier, and modifying the name of the target file into the name of the file to be stored.
6. The method according to any one of claims 1-5, further comprising:
sending second indication information to the terminal so as to obtain a segmented file data packet corresponding to the next segmented file through the second indication information; and the second indication information comprises an index number of the next fragment file.
7. A method according to claim 3, characterized in that the method further comprises:
receiving a retransmission request sent by a terminal; the retransmission request is sent under the condition that communication faults between the terminal and the server are recovered; the retransmission request includes the second globally unique identification;
determining the index number of the target fragment file with the same global unique identifier as the second global unique identifier from the target database based on the retransmission request;
sending third indication information to the terminal; the third indication information comprises an index number of a next fragment file of the target fragment file.
8. The method according to any one of claims 1-5, further comprising:
receiving a test request sent by the terminal;
based on the test request, fourth indication information is sent to the terminal; the fourth indication information comprises network environment information between the server and the terminal; and the fourth indication information is used for indicating the terminal to determine the slicing strategy of the file to be stored based on the network environment information.
9. A document transfer apparatus, the apparatus comprising:
the first receiving module is used for receiving the fragmented file data packet; the fragmented file data packet comprises a fragmented file, an index number of the fragmented file, a first checksum, a first global unique identifier and a first signature algorithm; the fragmented files are obtained by performing fragmentation processing on files to be stored;
the first determining module is used for determining a second checksum of the fragmented file according to the first signature algorithm under the condition that the first global unique identifier is consistent with the second global unique identifier of the file to be stored;
and the merging module is used for merging the fragmented files with the existing fragmented files in the preset storage space according to the index number, the first checksum and the second checksum.
10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 8 when the computer program is executed.
CN202311621816.1A 2023-11-28 2023-11-28 File transmission method and device and computer equipment Pending CN117499390A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311621816.1A CN117499390A (en) 2023-11-28 2023-11-28 File transmission method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311621816.1A CN117499390A (en) 2023-11-28 2023-11-28 File transmission method and device and computer equipment

Publications (1)

Publication Number Publication Date
CN117499390A true CN117499390A (en) 2024-02-02

Family

ID=89682915

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311621816.1A Pending CN117499390A (en) 2023-11-28 2023-11-28 File transmission method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN117499390A (en)

Similar Documents

Publication Publication Date Title
US11928029B2 (en) Backup of partitioned database tables
US11036591B2 (en) Restoring partitioned database tables from backup
US11327949B2 (en) Verification of database table partitions during backup
US10895996B2 (en) Data synchronization method, system, and apparatus using a work log for synchronizing data greater than a threshold value
US9043573B2 (en) System and method for determining a level of success of operations on an abstraction of multiple logical data storage containers
US9019123B2 (en) Health check services for web-based collaboration environments
US9213607B2 (en) Systems, methods, and media for synthesizing views of file system backups
US9104717B2 (en) Distributed storage object delete
KR101107564B1 (en) Method of managing data storage service based on analysis of log and computer-readable medium having thereon program performing function embodying the same
WO2021226905A1 (en) Data storage method and system, and storage medium
US11409711B2 (en) Barriers for dependent operations among sharded data stores
CN110633168A (en) Data backup method and system for distributed storage system
CN106899654A (en) A kind of sequence value generation method, apparatus and system
CN112948340A (en) Data synchronization method and device, electronic equipment and readable storage medium
CN110633046A (en) Storage method and device of distributed system, storage equipment and storage medium
WO2018157605A1 (en) Message transmission method and device in cluster file system
CN109299116B (en) Data synchronization method, device, equipment and readable storage medium
WO2017005116A1 (en) Intermediate file processing method, clients, servers and system
CN112035062B (en) Migration method of local storage of cloud computing, computer equipment and storage medium
CN110324384B (en) Data pushing method and device
EP3349416B1 (en) Relationship chain processing method and system, and storage medium
CN117499390A (en) File transmission method and device and computer equipment
CN111147226A (en) Data storage method, device and storage medium
WO2017101016A1 (en) Method and apparatus for synchronizing service request of storage node
CN111431951B (en) Data processing method, node equipment, system and storage medium

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