File transmission method, electronic equipment, computer readable storage medium and product
During the file transfer process, the client shares metadata information with the cloud storage system, reducing the interaction between the server and the client, solving the problems of high working pressure on the server and high metadata management pressure in the existing technology, and achieving efficient and stable file transfer and second-second transmission and breakpoint continuous transmission functions.
Patent Information
- Application Number
- CN202510096175.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-06
AI Technical Summary
In the process of file transfer in the prior art, the server and the client frequently interact, resulting in high working pressure on the server and high pressure on the storage and management of metadata information, affecting the efficiency and stability of file transfer.
By sharing metadata information between the client and the cloud storage system, the client directly interacts with the cloud storage system based on the upload link returned by the server, reducing frequent interaction between the server and the client, and dispersing the working pressure of the server to different clients.
It reduces the working pressure on the server and the storage pressure of metadata information, improves the efficiency and stability of file transfer, and realizes the functions of file transfer in seconds and breakpoint transfer.
Smart Images

Figure CN119946044A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer network technology, and in particular to a file transmission method, electronic device, computer-readable storage medium and product. Background Art
[0002] At present, in the field of file transfer technology, especially for uploading large files, it is mainly implemented through multi-slice uploading. The basic principle is to divide the file into several multi-slice files, generate a specific identifier for each multi-slice file, and transmit them to the cloud storage system in sequence according to the multi-slice order. Only when the previous multi-slice file is transferred, the next multi-slice file will be transferred.
[0003] Breakpoint resume means that if a network failure or unexpected interruption occurs during network transmission, the data before the transmission interruption can be saved and the transmission can be continued from the breakpoint after the network is restored to ensure the integrity and reliability of the data. Summary of the invention
[0004] The embodiments of the present application provide a file transmission method, an electronic device, a computer-readable storage medium, and a computer program product to alleviate or solve one or more technical problems existing in the prior art.
[0005] In a first aspect, an embodiment of the present application provides a file transmission method, which is applied to a client, and includes: sending an upload request for a target file to a server, and obtaining an upload link of the target file returned by the server;
[0006] Accessing the storage system based on the upload link, and obtaining a metadata file associated with the target file from the storage system;
[0007] The upload progress of the target file in the storage system is determined based on the metadata file, and the upload of the target file is completed according to the upload progress control.
[0008] In a second aspect, an embodiment of the present application provides a file transmission method, which is applied to a server, comprising: in response to receiving an upload request for a target file sent by a client, determining the existence of a metadata file associated with the target file in a storage system;
[0009] According to the existence of the metadata file, an upload link for uploading the target file is generated and the upload link is returned to the client.
[0010] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory, and the processor implements any method of the embodiment of the present application when executing the computer program.
[0011] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any one of the embodiments of the present application is implemented.
[0012] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements any method of the embodiments of the present application when executed by a processor.
[0013] Based on the method of the embodiment of the present application, the frequent interactions between the server and the client during the upload process can be reduced and the work pressure of the server can be dispersed to different clients. The client and the cloud storage system jointly maintain the metadata information, breaking through the local device limitations of breakpoint resumption, and solving the work pressure of the server and the storage pressure of the metadata information, thereby ensuring the efficiency and stability of file transmission.
[0014] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0016] Figure 1 is a flowchart of a file transmission method applied to a client according to an embodiment of the present application;
[0017] Figure 2 is a schematic diagram of an algorithm for converting a file identifier into a file storage path according to an embodiment of the present application;
[0018] Figure 3 is a schematic diagram of a storage format of files in a cloud storage system according to an embodiment of the present application;
[0019] Figure 4 A schematic diagram of a process of performing instant transmission and breakpoint-resume transmission by a client according to an embodiment of the present application;
[0020] Figure 5 is a flowchart of a file transmission method applied to a server according to an embodiment of the present application;
[0021] Figure 6 is a timing diagram of file transmission according to an embodiment of the present application;
[0022] Figure 7 is a schematic diagram of a file transmission device applied to a client according to an embodiment of the present application;
[0023] Figure 8 is a schematic diagram of a file transmission device applied to a server according to an embodiment of the present application;
[0024] Fig. 9 It is a block diagram of an electronic device used to implement the embodiment of the present application. DETAILED DESCRIPTION
[0025] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the concept or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary in nature and not restrictive.
[0026] To facilitate understanding of the technical solutions of the embodiments of the present application, the following describes the related technologies of the embodiments of the present application. The following related technologies can be combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application.
[0027] Explanation of terms
[0028] Pre-signed URL: Pre-signed URL is a common mechanism in cloud storage services, which is used to temporarily grant specific users access to storage resources without exposing the actual storage credentials. It is usually used in short-term, restricted access scenarios, such as sharing files, temporarily downloading or uploading data, etc.
[0029] MD5: MD5 (Message Digest Algorithm 5) is a widely used cryptographic hash function that is used to generate a 128-bit (16-byte) hash value for data and is widely used in areas such as data integrity verification and digital signatures.
[0030] File Chunking: File Chunking is a technique that divides a large file into multiple smaller parts (slices or chunks) for transmission and storage. This method is very useful when processing large file uploads and downloads, especially when the network is unstable or the bandwidth is limited. File slicing technology has been widely used in many modern applications and systems, such as cloud storage services, large file transfer tools, and distributed file systems.
[0031] Metadata information: Metadata information when uploading a file includes file name, size, type, hash value, upload completion status, storage location, etc. If it is a large file, it also includes slice details such as slice size, slice hash value, slice upload progress, upload completion status, storage location, etc.
[0032] Instant transfer: Instant file transfer technology is a method to optimize the file upload and download process, aiming to avoid transferring files that already exist on the server, thereby significantly reducing transfer time and bandwidth consumption. Instant file transfer technology usually uses the hash value of the file (such as MD5, SHA-256) to quickly identify and verify the file.
[0033] The core principle of the file transfer technology is: before uploading a file, the client first calculates the hash value of the file. The hash value is a unique identifier of the file content. If the file content is the same, the hash value is also the same. The client sends the calculated hash value to the server, and the server checks whether the hash value already exists. If the server has a file with the same hash value, it means that the server already has the file and does not need to upload it again. A successful response is directly returned; otherwise, the client needs to upload the file.
[0034] In order to achieve breakpoint resume, the client records the amount of data transferred during the transmission process. If a network failure or unexpected interruption occurs during the transmission process, the client will record the current transmission progress, that is, the breakpoint position, and wait for the network to recover before requesting the server to continue to transfer the remaining data. After receiving the client's request, the server will only transfer the remaining data based on the breakpoint information provided by the client, instead of retransmitting the entire file.
[0035] In the above process, the client needs to record the upload location information. If the client is a browser, the recorded information will be lost when the browser is closed, and the breakpoint resume function cannot be realized. In order to solve the loss of recorded information, there are usually two ways. One way is that the client records the information locally, such as the user directory and other locations. This can solve the problem of data loss when the browser is closed, but if the device is changed, the breakpoint resume function will fail. Another way is that the client synchronizes the upload progress to the server, and the server saves the upload progress information. In this way, whether the browser is closed or the device is changed, the breakpoint resume function can be realized.
[0036] The above two existing technical solutions are either subject to the limitations of local devices or require the server to synchronously record the upload progress, resulting in the client needing to frequently interact with the server during the file transfer process and save metadata information of the upload progress, etc., which occupies the server's storage resources and increases the communication pressure on the server.
[0037] Based on this, an embodiment of the present application proposes a file transfer method, which aims to support file transfer in seconds and resume transfer functions, reduce the communication and storage pressure on the server by simplifying the logic and operations of the server, and ensure the efficiency and stability of file transfer.
[0038] Figure 1 1 is a flowchart of a file transmission method according to an embodiment of the present application, the method is applied to a client, and includes:
[0039] Step S110, sending an upload request for the target file to the server, and obtaining an upload link of the target file returned by the server.
[0040] Here, when the target file needs to be uploaded, the client can first calculate the hash value of the file through hash functions such as MD5, SHA-256 and SHA-3, and then use the calculated hash value as the file identifier of the file, and send the upload request carrying the file identifier to the server. The server can calculate the URL address (that is, the storage path) of the target file corresponding to the file identifier in the cloud storage system through the encryption mapping algorithm rules, so that the server can return an upload link pointing to the storage path to the client, so that the server can upload the file to the address pointed to by the upload link.
[0041] Figure 2 FIG. 1 is a schematic diagram of an algorithm for converting a file identifier into a file storage path according to an embodiment of the present application. Taking the file identifier as an MD5 value as an example, Figure 2 The algorithm shown in the figure is the simplest and most intuitive one that converts MD5 value into file storage path. It does not process MD5 value in any way, but simply intercepts it into several segments with fixed length, each segment corresponds to a layer of path. The several layers of path can be concatenated into the storage path of the final file on the file server (i.e., cloud storage system). If interception is performed with a fixed length of 6 bits, we can also take the hash value of the intercepted result and then take the modulus, which can reduce the discreteness of the folder. For example, we take the modulus with a fixed length of 32 bits, so that there are at most 32 folders at each level.
[0042] Step S120: access the storage system based on the upload link, and obtain the metadata file associated with the target file from the storage system.
[0043] Here, the storage system can be a cloud storage system for storing data required by the storage client application, and the server is used to process business logic. In the existing solution, when the client sends a request to the server, the server will interact with the cloud storage system to read or write data, thereby responding to the user's request. In the embodiment of the present application, the server can return an upload link to the client, so that the client can directly interact with the cloud storage system based on the upload link.
[0044] Figure 3 is a schematic diagram of a storage format of files in a cloud storage system according to an embodiment of the present application, such as Figure 3 As shown, the metadata file is the same as the original file based on Figure 2 The file storage path calculated in is stored in the same storage directory. We use the json data format for storage, and the metadata file name is, for example, md5.json.
[0045] Here, the metadata file is a file containing metadata information of the target file, and in this application, it is configured to share the same storage address and the same storage directory as the original file of the target file in the cloud storage system. After receiving the upload request of the target file and calculating the corresponding storage path of the target file in the cloud storage system through the file identifier of the target file, the server will first determine whether the metadata file exists in the file system. If not, a blank metadata file will be created so that the client can write metadata information during the file transfer process.
[0046] Step S130, determining the upload progress of the target file in the storage system based on the metadata file, and completing the upload of the target file according to the upload progress control.
[0047] For example, for large file transfer, before sending an upload request to the server in step S110, the target file needs to be split into multiple fragment files, and the multiple fragment files are numbered according to the fragment sequence so that the fragment files can be uploaded sequentially according to the fragment sequence.
[0048] Here, after the client obtains the metadata file through the upload link returned by the server, it can determine the upload progress of the file according to the metadata information in the metadata file, and determine the upload mode for the target file based on the upload progress.
[0049] Exemplarily, in step S130, the upload progress of the target file in the cloud storage system is determined based on the metadata file, and the upload of the target file is completed according to the upload progress control, including: in response to the metadata file being an empty file, determining that the upload mode of the target file is the first upload, uploading multiple segment files to the storage system in sequence according to the numbers of the multiple segment files, and updating the metadata file in the storage system after each segment file is uploaded to record the upload progress information.
[0050] Here, when the metadata file is an empty file, that is, there is no metadata information, it can be determined that the upload mode of the target file is the first upload. In this case, if the target file is not a large file that needs to be uploaded in pieces, the metadata file in the cloud storage system can be updated directly after the file is uploaded to write the relevant metadata information of the uploaded target file. If the target file is a large file, it can be uploaded in sequence according to the predetermined piece order, and the metadata file in the cloud storage system can be updated after each piece file is uploaded to record the upload progress information.
[0051] Exemplarily, in step S130, determining the upload progress of the target file in the storage system based on the metadata file, and completing the upload of the target file according to the upload progress control includes: in response to the upload progress information recorded in the metadata file, determining that the upload mode of the target file is non-first upload, and determining at least one resumed upload segment file from the multiple segment files according to the upload progress information;
[0052] At least one resumed transfer segment file is uploaded to the cloud storage system in sequence according to the serial number of at least one resumed transfer segment file, and after each resumed transfer segment file is uploaded, the metadata file in the storage system is updated to record the upload progress information.
[0053] Here, when the metadata file records the upload progress information, that is, at least part of the metadata information of the target file is stored in the cloud storage system, it indicates that the upload mode of the target file is not the first upload. If it is judged according to the upload progress information that the target file has not been uploaded completely, it indicates that the target file belongs to the breakpoint resume situation. The upload progress information can be used to determine which segment file the target file was accidentally interrupted when uploading. In this case, the segment file and its subsequent segment files belong to the resumed segment files, so that the upload of the target file can be continued from the interruption position of the segment file.
[0054] In addition, if it is judged based on the upload progress information that the target file has been uploaded, it means that other users have uploaded the same file as the target file before, and the cloud storage system already has the complete target file and its metadata information. In this case, the client can retrieve the file key (that is, the URL address path) from the metadata information and save it, without the need for additional file transfer, and the file can be transferred in seconds. At this time, the client only needs to submit the file information to the server so that the server can save the relationship between the user and the file and enable the user to complete the file cloud synchronization, so that the user can subsequently obtain the target file from the cloud storage system by accessing the server. The cloud storage system saves the physical path and logical file name of the target file, and the server saves the real file name of the target file in the database.
[0055] Exemplarily, when uploading a file, the file transmission method further includes: entering the segmentation information of the target file into a metadata file in the cloud storage system.
[0056] After completing the upload of all shard files in step S130, the file transmission method further includes: in response to detecting that all shard files corresponding to the target file are uploaded to the storage system, sending a file merge request to the server, so that the server controls the storage system to merge the multiple shard files stored according to the shard information in the metadata file.
[0057] Here, after the server completes the merging of the segmented files, it will further update the file upload progress in the metadata file to upload completed, so that when other users upload the same file later, their clients can determine the upload mode according to the upload progress information in the metadata file, and achieve file upload in seconds. At the same time, the server will return a notification of successful upload to the client, so that the client can end the file upload process.
[0058] Figure 4 This is a schematic diagram of the process of performing instant upload and breakpoint resume upload by the client according to an embodiment of the present application. As shown in the figure, after calculating the file identifier of the target file, the client requests an upload link from the server, and obtains the metadata information corresponding to the target file in the cloud storage system through the upload link, and determines whether the target file has been uploaded based on the upload progress information in the metadata information. If the upload progress shows that the upload is complete, it means that the target file has been uploaded by other users before, which means that the file is uploaded in seconds, and the upload process can be ended.
[0059] If the upload progress shows that the upload is not completed, the position of the breakpoint resume can be determined based on the upload progress information, that is, which segment file of the target file needs to be uploaded from which breakpoint, so as to upload the corresponding segment file and subsequent segment files based on the breakpoint position, and notify the server to merge the segment files after the upload is completed, and obtain the metadata information updated by the server after the server merges the segment files, and judge that the upload is complete based on the metadata information, and then end the file upload. For the first upload of the target file, the process is similar to the breakpoint resume, and the breakpoint position can be regarded as the starting position.
[0060] According to the method of this embodiment, the client can use the upload link returned by the server to directly access the cloud storage system to upload files, reducing the frequent interactions between the server and the client during the upload process and distributing the work pressure of the server to different clients, which greatly reduces the work pressure of the server. In addition, the client can synchronize the file metadata information to the cloud storage system in a timely manner during the process of uploading file segments. The metadata information can be jointly maintained by the client and the cloud storage system, breaking through the local device limitations of breakpoint resumption and solving the storage pressure of metadata information on the server, thereby ensuring the efficiency and stability of file transmission.
[0061] Figure 5 1 is a flowchart of a file transmission method according to an embodiment of the present application, the method is applied to a server, and includes:
[0062] Step S510, in response to receiving an upload request for a target file sent by a client, determining the existence of a metadata file associated with the target file in the storage system;
[0063] Step S520: Generate an upload link for uploading the target file according to the existence of the metadata file and return the upload link to the client.
[0064] Here, step S510 is Figure 1 Corresponding to step S110, the upload request for the target file sent by the client carries a file identifier obtained by the client by calculating the file hash value. The server calculates the storage path of the target file corresponding to the file identifier in the cloud storage system through the encryption mapping algorithm rules, so that the upload mode of the target file can be determined according to the existence of the metadata file under the storage path.
[0065] Specifically, in step S520, based on the existence of the metadata file, an upload link for uploading the target file is generated and the upload link is returned to the client, including:
[0066] In response to the absence of a metadata file in the storage system, determining that the upload mode of the target file is the first upload, allocating a storage address for the target file in the storage system and creating a blank metadata file in the storage address, generating an upload link that records the allocated storage address and returning the upload link to the client.
[0067] In response to the metadata file existing in the storage system, determining that the upload mode of the target file is non-first upload, generating an upload link according to the storage address of the metadata file in the storage system, and returning the upload link to the client.
[0068] Here, after receiving the upload request of the target file and calculating the corresponding storage path of the target file in the cloud storage system through the file identifier of the target file, the server will first determine whether the metadata file exists in the file system. If it does not exist, it can be determined that the upload mode of the target file is the first upload. The server will control the cloud storage system to create a blank metadata file so that the client can write metadata information during the file transfer process, and generate an upload link based on the storage address of the blank metadata file and return it to the client.
[0069] If the metadata file already exists in the file system, it can be determined that the upload mode of the target file is not the first upload. At this time, the server only needs to generate an upload link based on the calculated storage address and return it to the client.
[0070] In some embodiments, in order to improve the security of the cloud storage system and strictly control the cloud storage system control authority granted to the client, the upload link returned by the server to the client for the first time may be an access link with read-only authority.
[0071] Figure 6 is a timing diagram of file transmission according to an embodiment of the present application, such as Figure 6 As shown, the client sends a file upload request carrying, for example, an MD5 value to the server, thereby obtaining a URL storage path with read-only permission returned by the server. The client can read the metadata file in the cloud storage system (file server) through the storage path, and determine the subsequent upload mode of the target file according to the upload progress information in the metadata file. If the upload progress information is completed, it indicates that other users have previously uploaded the same file as the target file, and the cloud storage system already has a complete target file and its metadata information. The client only needs to retrieve the storage path of the target file in the cloud storage system from the metadata file and copy it to the local computer, so that the user to which the client belongs can subsequently request the server to download the target file through the address path. In this case, the client notifies the server of the upload completion after copying the storage path, thereby realizing the file transfer function in seconds.
[0072] If the client reads the upload progress information as incomplete, including the case where the upload progress information is not fully completed or does not exist, if the target file is in a breakpoint resume situation, the upload progress information can be used to determine which segment file the target file was accidentally interrupted when uploading, and the segment file and its subsequent segments are resumed segment files, so the target file can be continued from the interrupted position of the segment file. If the target file is being uploaded for the first time, it can be uploaded in sequence according to the predetermined segment order.
[0073] The client can submit file segment information to the server according to the segment files that need to be uploaded later, and obtain the pre-signed URL returned by the server with the timeliness control authority of the cloud storage system. The client can complete the subsequent upload through the pre-signed URL, and update the metadata file in the cloud storage system after each segment file is uploaded to record the upload progress information.
[0074] When the client detects that all the fragment files corresponding to the target file have been uploaded to the cloud storage system, it sends a file merge request to the server. Figure 5 The file transfer method applied to the server also includes: in response to receiving a file merging request sent by the client, controlling the cloud storage system to merge multiple fragment files of the stored target file according to the fragment information in the metadata file.
[0075] After the server completes the merging of the segmented files, it will further update the file upload progress in the metadata file to upload completed, so that when other users upload the same file later, their clients can determine the upload mode based on the upload progress information in the metadata file, and achieve file upload in seconds. At the same time, the server will return a notification of successful upload to the client, so that the client can end the file upload process.
[0076] By adopting the method of this embodiment, by adding an interaction between the server and the client before the formal upload, it is possible to more accurately control the cloud storage system control authority delegated by the server to the client. The server will distribute the task of determining the upload type to different clients, and in the case of instant transmission, the client will only receive an upload link with read-only permission. In the case of breakpoint resumption, the client only has the permission to modify the breakpoint and subsequent segmented files, and will not modify the files that already exist in the cloud storage system. This can reduce the risk of unexpected network attacks on the cloud storage system and ensure the security of the cloud storage system.
[0077] The above describes the specific settings and implementation methods of the embodiments of the present application from different perspectives. Using the method provided in the above embodiments, the frequent interactions between the server and the client during the upload process can be reduced and the work pressure of the server can be dispersed to different clients, which greatly reduces the work pressure of the server. In addition, the client can synchronize the file metadata information to the cloud storage system in a timely manner during the process of uploading the file in segments. The metadata information can be jointly maintained by the client and the cloud storage system, breaking through the limitations of local devices and solving the storage pressure of the metadata information on the server, ensuring the efficiency and stability of file transmission.
[0078] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0079] As the implementation of the above methods, Figure 7 As shown, the embodiment of the present application further provides a file transmission device, which can be applied to a client, and the device may include:
[0080] The request module 710 is used to send an upload request for a target file to the server and obtain an upload link of the target file returned by the server;
[0081] The metadata acquisition module 720 is used to access the storage system based on the upload link and acquire the metadata file associated with the target file from the storage system;
[0082] The upload module 730 is used to determine the upload progress of the target file in the storage system based on the metadata file, and complete the upload of the target file according to the upload progress control.
[0083] Exemplarily, the device further comprises:
[0084] The sharding module is used to split the target file into multiple shard files and number the multiple shard files according to the shard sequence.
[0085] Exemplarily, the upload module 730 is further used for:
[0086] In response to the metadata file being an empty file, determining that the upload mode of the target file is the first upload, uploading multiple segment files to the storage system in sequence according to their numbers, and updating the metadata file in the storage system after each segment file is uploaded to record the upload progress information.
[0087] Exemplarily, the upload module 730 is further used for:
[0088] In response to the upload progress information being recorded in the metadata file, determining that the upload mode of the target file is non-first upload, and determining at least one resumed upload segment file from the plurality of segment files according to the upload progress information;
[0089] At least one resumed transmission segment file is uploaded to the storage system in sequence according to the serial number of at least one resumed transmission segment file, and after each resumed transmission segment file is uploaded, the metadata file in the storage system is updated to record the upload progress information.
[0090] Exemplarily, the device further comprises:
[0091] An information entry module, used to enter the shard information of the target file into a metadata file in the storage system;
[0092] The request module is also used to send a file merge request to the server in response to detecting that all the fragment files corresponding to the target file are uploaded to the storage system, so that the server controls the storage system to merge the multiple fragment files stored according to the fragment information in the metadata file.
[0093] like Figure 8 As shown, the embodiment of the present application also provides a file transmission device, which can be applied to a server, and the device may include:
[0094] The metadata determination module 810 is used to determine the existence of a metadata file associated with the target file in the storage system in response to receiving an upload request for the target file sent by the client;
[0095] The link generation module 820 is used to generate an upload link for uploading the target file according to the existence of the metadata file and return the upload link to the client.
[0096] Exemplarily, the link generation module 820 is further used to:
[0097] In response to the absence of a metadata file in the storage system, determining that the upload mode of the target file is the first upload, allocating a storage address for the target file in the storage system and creating a blank metadata file in the storage address, generating an upload link that records the allocated storage address and returning the upload link to the client.
[0098] Exemplarily, the link generation module 820 is further used to:
[0099] In response to the metadata file existing in the storage system, determining that the upload mode of the target file is non-first upload, generating an upload link according to the storage address of the metadata file in the storage system, and returning the upload link to the client.
[0100] Exemplarily, the file transmission device also includes a file merging module, which is used to control the storage system to merge multiple fragment files of the stored target file according to the fragment information in the metadata file in response to receiving a file merging request sent by the client.
[0101] The functions of each unit, module or sub-module in each device in the embodiments of the present application can refer to the corresponding description in the above method embodiments, and have corresponding beneficial effects, which will not be repeated here.
[0102] According to an embodiment of the present application, the present application also provides an electronic device, a computer-readable storage medium and a computer program product.
[0103] Fig. 9 FIG. 1 is a block diagram of an electronic device used to implement an embodiment of the present application. Fig. 9 As shown, the electronic device includes: a memory 901 and a processor 902. The memory 901 stores a computer program that can be run on the processor 902. When the processor 902 executes the computer program, the method in the above embodiment is implemented. The number of the memory 901 and the processor 902 can be one or more.
[0104] The electronic device also includes:
[0105] The communication interface 903 is used to communicate with external devices and perform data exchange transmission.
[0106] If the memory 901, the processor 902 and the communication interface 903 are implemented independently, the memory 901, the processor 902 and the communication interface 903 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0107] Optionally, in a specific implementation, if the memory 901, the processor 902 and the communication interface 903 are integrated on a chip, the memory 901, the processor 902 and the communication interface 903 can communicate with each other through an internal interface.
[0108] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present application.
[0109] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the present application.
[0110] It should be understood that the processor may be a CPU, or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), FPGAs or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0111] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of exemplary but not limiting description, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
[0112] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0113] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0114] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0115] Any process or method described in the flow chart or otherwise described herein can be understood as a module, fragment or portion of a code representing one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0116] The logic and / or steps described in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or used in combination with these instruction execution systems, devices or apparatuses.
[0117] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0118] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0119] The above is only an exemplary embodiment of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope recorded in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A file transmission method, applied to a client, characterized in that: include: Send an upload request for the target file to the server, and obtain the upload link of the target file returned by the server; Accessing a storage system based on the upload link, and acquiring a metadata file associated with the target file from the storage system; The upload progress of the target file in the storage system is determined based on the metadata file, and the upload of the target file is completed according to the upload progress control.
2. The method according to claim 1, characterized in that The method further comprises: The target file is divided into a plurality of fragment files, and the plurality of fragment files are numbered according to the fragment sequence.
3. The method according to claim 2, characterized in that Determining the upload progress of the target file in the storage system based on the metadata file, and completing the upload of the target file according to the upload progress control, including: In response to the metadata file being an empty file, determining that the upload mode of the target file is the first upload, uploading the multiple segment files to the storage system in sequence according to the numbers of the multiple segment files, and updating the metadata file in the storage system after each segment file is uploaded to record the upload progress information.
4. The method according to claim 2, characterized in that: Determining the upload progress of the target file in the storage system based on the metadata file, and completing the upload of the target file according to the upload progress control, including: In response to the upload progress information being recorded in the metadata file, determining that the upload mode of the target file is non-first upload, and determining at least one resume upload segment file from the multiple segment files according to the upload progress information; Upload the at least one resumed transfer segment file to the storage system in sequence according to the serial number of the at least one resumed transfer segment file, and update the metadata file in the storage system to record the upload progress information after each resumed transfer segment file is uploaded.
5. The method according to claim 3 or 4, characterized in that: The method further comprises: Entering the fragment information of the target file into the metadata file in the storage system; In response to detecting that all the segment files corresponding to the target file are uploaded to the storage system, a file merge request is sent to the server so that the server controls the storage system to merge the multiple segment files stored according to the segment information in the metadata file.
6. A file transmission method, applied to a server, characterized in that: include: In response to receiving an upload request for a target file sent by a client, determining the existence of a metadata file associated with the target file in the storage system; According to the existence of the metadata file, an upload link for uploading the target file is generated and the upload link is returned to the client.
7. The method according to claim 6, characterized in that According to the existence of the metadata file, generating an upload link for uploading the target file and returning the upload link to the client, including: In response to the metadata file not existing in the storage system, determining that the upload mode of the target file is the first upload, allocating a storage address for the target file in the storage system and creating a blank metadata file in the storage address, generating an upload link recording the allocated storage address and returning the upload link to the client.
8. The method according to claim 6, characterized in that According to the existence of the metadata file, generating an upload link for uploading the target file and returning the upload link to the client, including: In response to the metadata file existing in the storage system, determining that the upload mode of the target file is non-first upload, generating an upload link according to the storage address of the metadata file in the storage system, and returning the upload link to the client.
9. The method according to claim 6, characterized in that The method further comprises: In response to receiving the file merge request sent by the client, the storage system is controlled to merge the multiple fragment files of the stored target file according to the fragment information in the metadata file.
10. An electronic device comprising a memory, a processor and a computer program stored in the memory, wherein the processor implements the method according to any one of claims 1 to 9 when executing the computer program.
11. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
12. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.
Citation Information
Cited By
Data transmission method, cloud desktop system, equipment, storage medium and program product
CN121691315A
Data transmission methods, cloud desktop systems, devices, storage media, and application products
CN121691315B