A data transmission method and device, electronic equipment and computer readable medium
By receiving data fragments in the data transmission system, creating a new temporary directory, and performing pre-merging and integrity verification, the security and accuracy issues caused by not verifying merged files are resolved, achieving more efficient data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2026-03-17
AI Technical Summary
In data transmission systems across different business scenarios, merging files without verification results in poor data transmission security and accuracy.
Upon receiving a data transmission request, the system retrieves each data fragment. In response to the completion of the last data fragment upload, a temporary directory is created, and the uploaded data fragments are pre-merged into the temporary directory. The system calculates the first hash value, retrieves the second hash value of the received data fragment for data integrity verification, and in response to successful verification, executes the actual merging process. An automatic deletion time is set for the temporary directory, and the target data is stored in the target directory.
It improves the security and accuracy of data transmission, reduces the space occupied by temporary directories, and reduces the waste of computing resources.
Smart Images

Figure CN119397568B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, and in particular to a data transmission method, apparatus, electronic device, and computer-readable medium. Background Technology
[0002] File merging: In some scenarios, it may be necessary to merge multiple files into a single file. For example, when transferring files from one server to another, the file can be transmitted in fragments and then merged back into a single file at the receiving end. In data transmission systems across different business scenarios, no verification is performed after merging files, resulting in poor data transmission security and accuracy. Summary of the Invention
[0003] In view of this, embodiments of this application provide a data transmission method, apparatus, electronic device, and computer-readable medium, which can solve the problems of poor data transmission security and accuracy in existing data transmission systems in different business scenarios, where data is no longer verified after merging files.
[0004] To achieve the above objectives, according to one aspect of an embodiment of this application, a data transmission method is provided, comprising:
[0005] Receive data transmission requests and obtain the uploaded data fragments;
[0006] In response to the completion of the upload of the last data fragment, a temporary directory is created;
[0007] The saved uploaded data fragments are pre-merged into a temporary directory, and then the first hash value of the pre-merged data fragments is calculated;
[0008] Obtain the second hash value of the original data corresponding to each received data fragment, perform data integrity verification based on the first hash value and the second hash value, and in response to the data integrity verification passing, execute the actual merging process of the received data fragments to obtain the target data;
[0009] Set an automatic deletion time for the temporary directory, store the target data in the target directory, and delete the temporary directory when the automatic deletion time is reached.
[0010] Optionally, before creating the temporary directory, the method also includes:
[0011] Obtain the unique string corresponding to each data shard, generate a new directory based on the unique string, and save the uploaded data shards to the new directory.
[0012] Optionally, the saved uploaded data fragments are pre-merged into a temporary directory, including:
[0013] The saved uploaded data fragments are pre-merged into a temporary directory according to their upload time order.
[0014] Optionally, the second hash value of the original data corresponding to each received data fragment is obtained, including:
[0015] Obtain the hash value carried by the last data fragment as the second hash value of the original data.
[0016] Optionally, before creating the temporary directory, the method also includes:
[0017] In response to obtaining a data fragment carrying a hash value, the data fragment carrying the hash value is identified as the last data fragment.
[0018] Optionally, the method further includes:
[0019] Associate the field attribute data corresponding to each data shard with the target data to obtain the associated data;
[0020] Store the associated data in the target directory.
[0021] In addition, this application also provides a data transmission device, including:
[0022] The receiving unit is configured to receive data transmission requests and obtain the uploaded data fragments.
[0023] The new unit is configured to create a temporary directory in response to the completion of the upload of the last data fragment.
[0024] The pre-merging unit is configured to pre-merge the saved uploaded data fragments into a temporary directory, and then calculate the first hash value of the pre-merged data fragments;
[0025] The verification unit is configured to obtain the second hash value of the original data corresponding to each received data fragment, perform data integrity verification based on the first hash value and the second hash value, and in response to the data integrity verification passing, execute the actual merging process of the received data fragments to obtain the target data.
[0026] The deletion unit is configured as a temporary directory with an automatic deletion time. The target data is stored in the target directory, and the temporary directory is deleted when the automatic deletion time is reached.
[0027] Optionally, the device also includes a new catalog generation unit, configured to:
[0028] Obtain the unique string corresponding to each data shard, generate a new directory based on the unique string, and save the uploaded data shards to the new directory.
[0029] Optionally, the pre-merging unit is further configured to:
[0030] The saved uploaded data fragments are pre-merged into a temporary directory according to their upload time order.
[0031] Optionally, the verification unit is further configured to:
[0032] Obtain the hash value carried by the last data fragment as the second hash value of the original data.
[0033] Optionally, the newly created unit is further configured as follows:
[0034] In response to obtaining a data fragment carrying a hash value, the data fragment carrying the hash value is identified as the last data fragment.
[0035] Optionally, the device further includes an association unit configured to:
[0036] Associate the field attribute data corresponding to each data shard with the target data to obtain the associated data;
[0037] Store the associated data in the target directory.
[0038] In addition, this application also provides a data transmission electronic device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the data transmission method as described above.
[0039] In addition, this application also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the data transmission method described above.
[0040] To achieve the above objectives, according to another aspect of the embodiments of this application, a computer program product is provided.
[0041] A computer program product according to an embodiment of this application includes a computer program that, when executed by a processor, implements the data transmission method provided in an embodiment of this application.
[0042] One embodiment of the above invention has the following advantages or beneficial effects: This application receives a data transmission request and obtains each uploaded data fragment; in response to the completion of the last data fragment upload, a temporary directory is created; the saved uploaded data fragments are pre-merged into the temporary directory, and then the first hash value of the pre-merged data fragments is calculated; the second hash value of the original data corresponding to each received data fragment is obtained; data integrity verification is performed based on the first hash value and the second hash value; in response to the data integrity verification passing, the actual merging process of the received data fragments is executed to obtain the target data; an automatic deletion time is set for the temporary directory, the target data is stored in the target directory, and the temporary directory is deleted when the automatic deletion time is reached. This improves the security and accuracy of data transmission.
[0043] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0044] The accompanying drawings are provided to better understand this application and do not constitute an undue limitation thereof. Wherein:
[0045] Figure 1 This is a schematic diagram illustrating the main flow of a data transmission method according to an embodiment of this application;
[0046] Figure 2 This is a schematic diagram illustrating the main flow of a data transmission method according to an embodiment of this application;
[0047] Figure 3 This is a schematic diagram of the main flow of a data transmission method according to an embodiment of this application;
[0048] Figure 4 This is a schematic diagram of the main units of a data transmission apparatus according to an embodiment of this application;
[0049] Figure 5 This is an exemplary system architecture diagram to which embodiments of this application can be applied;
[0050] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers in the embodiments of this application. Detailed Implementation
[0051] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These embodiments should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solutions of this application comply with relevant national laws and regulations. It should also be noted that certain software, components, models, and other existing industry solutions may be mentioned in the embodiments of this application. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solutions of this application, and do not imply that the applicant has already used or necessarily used such solutions. The collection, analysis, use, transmission, and storage of user personal information involved in the technical solutions of this application all comply with relevant laws and regulations, are used for legal and reasonable purposes, are not shared, disclosed, or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities. Necessary measures should be taken to prevent unauthorized access to user personal information data, ensure that personnel authorized to access such data comply with relevant laws and regulations, and safeguard user personal information security. Once this user personal information data is no longer needed, risks should be minimized by restricting or even prohibiting data collection and / or deleting the data.
[0052] When used, including in certain relevant applications, data is deidentified to protect user privacy, for example by removing specific identifiers, controlling the amount or specificity of stored data, controlling how data is stored, and / or other methods.
[0053] Figure 1 This is a schematic diagram illustrating the main flow of a data transmission method according to an embodiment of this application, as shown below. Figure 1 As shown, the data transmission method mainly includes the following steps S101-S105.
[0054] Step S101: Receive data transmission request and obtain the uploaded data fragments.
[0055] In this embodiment, the execution entity of the data transmission method (e.g., a server) can receive data transmission requests via wired or wireless connections. The data to be transmitted can be, for example, an image. The image is divided into several segments, labeled with segment numbers, and the size range of each segment is fixed to obtain each data segment. The execution entity then obtains the data segments to be uploaded corresponding to the data transmission request.
[0056] Step S102: In response to the completion of the last data fragment upload, a temporary directory is created.
[0057] Specifically, before creating a new temporary directory, the method further includes: in response to obtaining a data fragment carrying a hash value, identifying the data fragment carrying the hash value as the last data fragment.
[0058] When uploading the last data fragment, the hash value of the large file corresponding to the data to be transmitted is uploaded along with it. When the uploaded data fragment is detected to carry a hash value, it is determined that this is the last data fragment being uploaded. When the last data fragment is uploaded, a temporary directory is created for pre-merging of data fragments. By pre-merging data fragments, errors are avoided when officially merging data fragments, ensuring the accuracy of data fragment upload.
[0059] Step S103: The saved uploaded data fragments are pre-merged into a temporary directory, and then the first hash value of the pre-merged data fragments is calculated.
[0060] Specifically, the saved uploaded data fragments are pre-merged into a temporary directory, including: pre-merging the saved uploaded data fragments into a temporary directory in order of upload time.
[0061] Data is fragmented, such as into file fragments, and saved strictly in the order of upload time. After merging, the contents before and after the fragments are verified to ensure the final quality of the data fragment merging and improve the reliability of the data fragment merging.
[0062] Step S104: Obtain the second hash value of the original data corresponding to each received data fragment; perform data integrity verification based on the first hash value and the second hash value; in response to the data integrity verification passing, execute the actual merging process of the received data fragments to obtain the target data.
[0063] The second hash value is the hash value of the large file corresponding to the data to be transmitted.
[0064] Specifically, obtaining the second hash value of the original data corresponding to each received data fragment includes: obtaining the hash value carried by the last data fragment as the second hash value of the original data.
[0065] The second hash value is compared with the first hash value of the pre-merged data fragments. If they match, the data integrity check passes, and the actual merging process of the received data fragments is executed to quickly and accurately obtain the target data. The target data is the data obtained by actually merging all the data fragments. If they do not match, the data fragment upload fails.
[0066] Step S105: Set an automatic deletion time for the temporary directory, store the target data in the target directory, and delete the temporary directory when the automatic deletion time is reached.
[0067] Specifically, the method also includes: associating the field attribute data corresponding to each data shard with the target data to obtain associated data; and storing the associated data in the target directory.
[0068] The field attribute data corresponding to each data shard can include: filename, file type, channel, etc. The field attribute data corresponding to each data shard is associated with the merged target data and stored in the target directory of the database.
[0069] By setting an automatic deletion time for the temporary directory, the number of database calls can be reduced, and data transfer time can be decreased. There is no need to specifically call the database to delete the temporary directory; simply set the automatic deletion time, and the deletion program will be called to delete the temporary directory when the automatic deletion time is reached.
[0070] This embodiment receives data transmission requests and obtains the uploaded data fragments. Upon completion of the last data fragment upload, a temporary directory is created. The saved uploaded data fragments are pre-merged into the temporary directory, and a first hash value is calculated for each pre-merged data fragment. A second hash value is obtained for the original data corresponding to each received data fragment. Data integrity is verified based on the first and second hash values. Upon successful data integrity verification, the actual merging process of the received data fragments is executed to obtain the target data. An automatic deletion time is set for the temporary directory, and the target data is stored in the target directory. The temporary directory is deleted upon reaching the automatic deletion time. This improves the security and accuracy of data transmission.
[0071] Figure 2 This is a schematic diagram of the main flow of a data transmission method according to an embodiment of this application, as shown below. Figure 2 As shown, the data transmission method mainly includes the following steps S201-S206.
[0072] Step S201: Receive data transmission request and obtain the uploaded data fragments.
[0073] The data to be transmitted corresponding to the data transmission request can be text, audio, or video; this application embodiment does not specifically limit the data to be transmitted. After receiving the data transmission request, the executing entity can obtain the various data fragments carried by the request.
[0074] Step S202: Obtain the unique string corresponding to each data shard, generate a new directory based on the unique string, and save the uploaded data shards to the new directory.
[0075] Along with the data shards, a unique string corresponding to each data shard can also be uploaded. This unique string can be an identifier for the large file corresponding to each data shard, used to uniquely identify the large file. The large file size exceeds the typical file size, such as hundreds of megabytes or several gigabytes.
[0076] By generating a new directory based on a unique string to temporarily store the uploaded data fragments, the disorder of uploaded data fragments can be avoided, thus improving the accuracy of data transmission.
[0077] Step S203: In response to the completion of the last data fragment upload, a temporary directory is created.
[0078] If an upload terminator is found in the uploaded data fragment, it is determined that the uploaded data fragment is the last data fragment. The executing entity can then create a temporary directory to store the uploaded data fragment, ensuring the accuracy of data transmission.
[0079] Step S204: The saved uploaded data fragments are pre-merged into a temporary directory, and then the first hash value of the pre-merged data fragments is calculated.
[0080] The uploaded data fragments are pre-merged according to a preset order, and the pre-merged data fragments are saved to a temporary directory. The hash values of the pre-merged data fragments are then calculated to obtain a first hash value. This first hash value is used to verify data integrity and ensure the accuracy of data transmission.
[0081] Step S205: Obtain the second hash value of the original data corresponding to each received data fragment, perform data integrity verification based on the first hash value and the second hash value, and in response to the data integrity verification passing, execute the actual merging process of the received data fragments to obtain the target data.
[0082] When the first hash value is the same as the second hash value, it indicates that the merged data fragments are consistent with the large file corresponding to the data to be transmitted, and no errors have occurred. Therefore, the data integrity check has passed. Only after the data integrity check passes does the actual merging of the received data fragments proceed, resulting in the target data for transmission.
[0083] Step S206: Set an automatic deletion time for the temporary directory, store the target data in the target directory, and delete the temporary directory when the automatic deletion time is reached.
[0084] The executing entity can determine the time interval for automatically deleting the temporary directory based on the scenario corresponding to the data transmission request, and determine the automatic deletion time of the temporary directory based on the current time and this time interval. This ensures that the temporary directory does not occupy excessive space without affecting data transmission, and also avoids frequent database access, thus preventing wasted computing resources. After storing the target data in the target directory, the temporary directory is deleted when the automatic deletion time is reached, freeing up space and ensuring high data transmission performance.
[0085] Figure 3This is a schematic diagram of the main flow of a data transmission method according to an embodiment of this application. In this embodiment, MD5 is a commonly used hash algorithm used to generate unique digest values. When comparing file content, the MD5 algorithm is used to generate digest values for two files, and then the two digest values are compared to see if they are the same. If the content of the two files is exactly the same, then their digest values should also be exactly the same. If the digest values are different, it indicates that the file content is different. The MD5 algorithm is based on the message digest algorithm, which performs a series of calculations and operations on the binary data of the file to finally generate a 128-bit digest value. Since the length of the digest value of the MD5 algorithm is relatively fixed and short, it can be generated and compared quickly. When comparing file content, the MD5 algorithm can be used to generate the digest value of each file first, and then the two digest values can be compared to see if they are the same. If they are the same, it can be confirmed that the file content is the same; if they are different, it can be determined that the file content is different. This comparison is suitable for scenarios where the integrity requirements are not very high. Large files refer to files in a computer system whose file size exceeds a certain threshold. The specific definition of the threshold can be determined according to different environments and application scenarios, and is based on tens of megabytes or hundreds of megabytes. File size exceeds a certain threshold: Large files exceed common file sizes, such as hundreds of megabytes or several gigabytes. Longer read / write times: Due to their large size, reading and writing large files may take a long time. Higher storage requirements: Large files occupy more storage space, thus requiring sufficient disk space for storage. Slower transfer speeds: Due to the large file size, the transfer process requires longer time and greater bandwidth. File fragmented transfer: File fragmentation typically involves fragmentation, transfer, and merging. Here is a brief description of these steps: Fragmentation: First, an appropriate fragment size is selected. Then, a file fragmenter is used to divide the original file into multiple smaller fragments or chunks. Each fragment is assigned a unique identifier, and this identifier, along with the fragment's order and location information, is recorded in a fragment index. Transfer: The fragments are transferred to the destination location. This can be achieved through network transfer or other transfer mechanisms. For large files, fragmented transfer can improve transfer efficiency and support resumeable interruptions, allowing for recovery in case of transmission interruptions. Merging: Once all fragments have been transferred to the destination location, the receiver can merge the fragments using the fragment index. Based on the order and position information recorded in the fragment index, the fragments are reassembled into a complete file in the correct order. The merged file is completely identical to the original file.
[0086] like Figure 3As shown, the user transmits fragmented files (i.e., data fragments) to the front-end and sends the fragment index, fragment count, unique string UUID, and MD5 hash of the large file to the back-end program. The back-end program creates a temporary directory based on the UUID to store the received fragmented files (i.e., data fragments). When the last fragmented file (i.e., data fragment) is uploaded, it checks whether the number of fragments in the temporary directory matches the number of fragmented files (i.e., data fragments) transmitted by the user to the front-end. If not, it retryes the process of transmitting fragmented files from the front-end to the back-end until the number of fragments in the temporary directory matches the number of fragmented files (i.e., data fragments) transmitted by the user to the front-end. Then, it pre-merges the fragmented files (i.e., data fragments) in the temporary directory to the temporary directory to verify file integrity. If the file integrity verification is successful, the temporary directory is deleted, and the fragmented files (i.e., data fragments) are officially merged to the target directory. The front-end inputs filename, type, channel, and other attribute data, which are stored in the database. The front-end displays the filename with the input name and ends the data transmission process. If the file integrity verification fails, the file (i.e., data fragment) upload fails, and the data transmission process ends.
[0087] For example, uploading fragments: The frontend first divides the image into several fragments, labels them with fragment numbers, and fixes the size range of each fragment. Each time a fragment is uploaded, its index, the total number of fragments, and a pre-defined unique string are sent to the backend. When sending the last fragment, the MD5 hash of the large file is also sent to the backend. Saving fragments: The backend generates a new directory based on the unique string and saves the fragment files in that directory. After receiving all fragments, they are pre-merged into a temporary directory. The MD5 hash of the merged file is compared with the MD5 hash of the last file sent by the frontend. If they match, it means all fragments have been received completely, and the upload was successful. At this point, the pre-merged file and the temporary directory are deleted, and the files are actually merged in the unique directory and saved. File attribute assignment: After confirming that everything is correct, the frontend sends client-facing field attributes, such as the actual filename, file type, and file distribution channel. Data fragments are uploaded sequentially and saved sequentially in specific directories. Once the last data fragment is uploaded, a temporary directory is created. The saved data fragments are merged into this temporary directory. The MD5 hash of the merged file in the temporary directory is compared with the MD5 hash of the last uploaded file from the front end. If they match, the file has been completely uploaded. The temporary directory is then deleted, and the actual merging of the files (i.e., the uploaded data fragments) begins in the designated directory. Finally, the front end sends information such as filename, channel, and type, and the file attributes are successfully entered into the database. Attributes such as filenames can be stored in the database or cache initially and then directly assigned to the file after successful fragment upload. Merging reliability: Fragmented files are saved strictly in the upload order, and the content before and after merging is verified to ensure the final quality of the merge. Flexible storage: After verification, the actual filename and other file attributes are retrieved from the front end and stored in the database. This provides flexibility for subsequent operations. After merging, the corresponding field values in the database can be modified based on the front end. This embodiment allows naming based on the final input name from the front end, rather than the file's actual name. It works with the front end to verify file integrity, ensure the final file merge, and successfully upload the file. It ensures that the fragment order is correct and that the reassembled file content remains unchanged.
[0088] Figure 4 This is a schematic diagram of the main units of a data transmission apparatus according to an embodiment of this application. Figure 4 As shown, the data transmission device 400 includes a receiving unit 401, a new unit 402, a pre-merging unit 403, a verification unit 404, and a deletion unit 405.
[0089] The receiving unit 401 is configured to receive data transmission requests and obtain the uploaded data fragments.
[0090] A new unit 402 is created and configured to create a temporary directory in response to the completion of the last data fragment upload.
[0091] The pre-merging unit 403 is configured to pre-merge the saved uploaded data fragments into a temporary directory, and then calculate the first hash value of the pre-merged data fragments.
[0092] The verification unit 404 is configured to obtain the second hash value of the original data corresponding to each received data fragment, perform data integrity verification based on the first hash value and the second hash value, and in response to the data integrity verification passing, execute the actual merging process of the received data fragments to obtain the target data.
[0093] Deletion unit 405 is configured as a temporary directory with an automatic deletion time. It stores the target data in the target directory and deletes the temporary directory when the automatic deletion time is reached.
[0094] In some embodiments, the data transmission device further includes Figure 4 The new directory generation unit (not shown) is configured to: obtain the unique string corresponding to each data shard, generate a new directory based on the unique string, and save the uploaded data shards to the new directory.
[0095] In some embodiments, the pre-merging unit 403 is further configured to pre-merge the saved uploaded data fragments into a temporary directory in order of upload time.
[0096] In some embodiments, the verification unit 404 is further configured to: obtain the hash value carried by the last data fragment as the second hash value of the original data.
[0097] In some embodiments, the newly created unit 402 is further configured to: in response to obtaining a data fragment carrying a hash value, determine the data fragment carrying the hash value as the last data fragment.
[0098] In some embodiments, the data transmission device further includes Figure 4 The associated unit (not shown) is configured to: associate the field attribute data corresponding to each data shard with the target data to obtain associated data; and store the associated data in the target directory.
[0099] It should be noted that the data transmission method and data transmission device in this application are related in specific implementation, so repeated content will not be described again.
[0100] Figure 5 An exemplary system architecture 500 is shown that can be applied to the data transmission method or data transmission apparatus of the embodiments of this application.
[0101] like Figure 5As shown, system architecture 500 may include terminal devices 501, 502, and 503, a network 504, and a server 505. Network 504 serves as the medium for providing communication links between terminal devices 501, 502, and 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0102] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0103] Terminal devices 501, 502, and 503 can be various electronic devices with data transmission processing screens and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0104] Server 505 can be a server providing various services, such as a backend management server supporting data transmission requests submitted by users using terminal devices 501, 502, and 503 (for example only). The backend management server can receive data transmission requests, obtain the uploaded data fragments; in response to the completion of the last data fragment upload, create a new temporary directory; pre-merge the saved uploaded data fragments into the temporary directory, and then calculate the first hash value of the pre-merged data fragments; obtain the second hash value of the original data corresponding to each received data fragment, perform data integrity verification based on the first and second hash values, and in response to the successful data integrity verification, execute the actual merging process of the received data fragments to obtain the target data; set an automatic deletion time for the temporary directory, store the target data in the target directory, and delete the temporary directory when the automatic deletion time is reached. This improves the security and accuracy of data transmission.
[0105] It should be noted that the data transmission method provided in this application embodiment is generally executed by server 505, and correspondingly, the data transmission device is generally set in server 505.
[0106] It should be understood that Figure 5 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0107] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing a terminal device according to the embodiments of this application. Figure 6The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0108] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the computer system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0109] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.
[0110] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this application.
[0111] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. Computer-readable storage media can be, for example, including but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0112] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0113] The units described in the embodiments of this application can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor may be described as including a receiving unit, a creating unit, a pre-merging unit, a verification unit, and a deletion unit. The names of these units do not necessarily limit the specific unit itself.
[0114] In another aspect, this application also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs that, when executed by the device, cause the device to receive a data transmission request, acquire uploaded data fragments; in response to the completion of the last data fragment upload, create a temporary directory; pre-merge the saved uploaded data fragments into the temporary directory, and then calculate a first hash value for the pre-merged data fragments; acquire a second hash value for the original data corresponding to each received data fragment, perform data integrity verification based on the first and second hash values, and in response to the data integrity verification passing, execute the actual merging process of the received data fragments to obtain the target data; set an automatic deletion time for the temporary directory, store the target data in the target directory, and delete the temporary directory when the automatic deletion time is reached.
[0115] The computer program product of this application includes a computer program that, when executed by a processor, implements the data transmission method in the embodiments of this application.
[0116] The technical solutions according to the embodiments of this application can improve the security and accuracy of data transmission.
[0117] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A data transmission method, characterized by, The method comprises: receiving a data transmission request, obtaining uploaded respective data fragments; receiving a transmitted data fragment index, each data fragment being assigned a unique identifier, and recording the identifier together with sequence and position information of the data fragment in the fragment index; in response to completion of uploading of the last data fragment, newly creating a temporary directory; pre-merging saved uploaded data fragments into the temporary directory, and further calculating a first hash value of the pre-merged data fragments; obtaining a second hash value of original data corresponding to the respective data fragments received, performing data integrity verification based on the first hash value and the second hash value, and in response to passing of the data integrity verification, performing a real merging process of the received data fragments to obtain target data; wherein the data fragments are recombined into a complete file in a correct order according to the sequence and position information recorded in the fragment index; setting an automatic deletion time for the temporary directory, and storing the target data to a target directory, and deleting the temporary directory when the automatic deletion time is reached; associating field attribute data corresponding to the respective data fragments with the target data to obtain associated data, and storing the associated data to the target directory.
2. The method of claim 1, wherein, Before the newly creating of the temporary directory, the method further comprises: obtaining a unique string corresponding to the respective data fragments, generating a new directory according to the unique string, and saving the uploaded respective data fragments to the new directory.
3. The method of claim 1, wherein, The pre-merging of the saved uploaded data fragments into the temporary directory comprises: pre-merging the saved uploaded data fragments into the temporary directory according to an uploading time sequence.
4. The method of claim 1, wherein, The obtaining of the second hash value of original data corresponding to the respective data fragments received comprises: obtaining a hash value carried by the last data fragment as the second hash value of the original data.
5. The method of claim 1, wherein, Before the newly creating of the temporary directory, the method further comprises: in response to obtaining a data fragment carrying a hash value, determining the data fragment carrying the hash value as the last data fragment.
6. A data transmission apparatus characterized by comprising: The method comprises: a receiving unit configured to receive a data transmission request, and obtain uploaded respective data fragments; a receiving unit configured to receive a transmitted data fragment index, each data fragment being assigned a unique identifier, and recording the identifier together with sequence and position information of the data fragment in the fragment index; a newly creating unit configured to newly create a temporary directory in response to completion of uploading of the last data fragment; a pre-merging unit configured to pre-merge saved uploaded data fragments into the temporary directory, and further calculate a first hash value of the pre-merged data fragments; a verifying unit configured to obtain a second hash value of original data corresponding to the respective data fragments received, perform data integrity verification based on the first hash value and the second hash value, and in response to passing of the data integrity verification, perform a real merging process of the received data fragments to obtain target data; wherein the data fragments are recombined into a complete file in a correct order according to the sequence and position information recorded in the fragment index; and a setting unit configured to set an automatic deletion time for the temporary directory, and store the target data to a target directory, and delete the temporary directory when the automatic deletion time is reached. The deleting unit is configured to set an automatic deleting time for the temporary directory, store the target data into a target directory, and delete the temporary directory when the automatic deleting time is reached. The device further comprises an associating unit configured to associate the field attribute data corresponding to each data fragment with the target data to obtain associated data, and store the associated data into a target directory.
7. The apparatus of claim 6, wherein, The device further comprises a new directory generating unit configured to: obtain a unique string corresponding to each data fragment, generate a new directory according to the unique string, and save each uploaded data fragment into the new directory.
8. The apparatus of claim 6, wherein, The pre-merging unit is further configured to: pre-merge the saved uploaded data fragments into the temporary directory according to the uploading time sequence.
9. The apparatus of claim 6, wherein, The verifying unit is further configured to: obtain the hash value carried by the last data fragment as a second hash value of the original data.
10. The apparatus of claim 6, wherein, The new building unit is further configured to: determine the data fragment carrying the hash value as the last data fragment in response to obtaining the data fragment carrying the hash value.
11. A data transmission electronic device, characterized by comprise: one or more processors; a memory device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-5.
12. A computer readable medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the method of any one of claims 1-5.
13. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1-5.
Citation Information
Patent Citations
File fragment uploading method and device based on cloud technology, equipment and storage medium
CN111414334A