File storage method and device, equipment and medium

By receiving file requests uploaded by the client in the file storage method of the virtual machine image file, determining the existence of object files and data, feedback response information and storing sub-files, the problem of low efficiency of multi-file integration and packaging in the prior art is solved, and efficient file storage and breakpoint retransmission functions are realized.

CN119829216APending Publication Date: 2025-04-15INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202412000371.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The prior art is less efficient when integrating multi-files of virtual machine image files or packaging multi-files on client side into object files, and does not support breakpoint continuous transmission, resulting in wasted bandwidth resources.

Method used

A file storage method is provided. By receiving a file upload request transmitted by the client, it determines whether the server has corresponding object files and object data, and the feedback response information instructs the client to upload a sub-file, and stores it in the object file after receiving the sub-file. This method supports breakpoint continuous transmission, verify data integrity through metadata, and uses a fixed-sized storage space to store subfiles.

Benefits of technology

Improve the efficiency of uploading multiple files to a single object file, avoid local multi-file archive operations, save user time, improve system performance, and support breakpoint continuous transmission, reducing bandwidth resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829216A_ABST
    Figure CN119829216A_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of computers, and discloses a file storage method, apparatus, device and medium, the method comprising: receiving a file upload request corresponding to a target operation transmitted by a client, the file upload request comprising first identification information corresponding to object data to be uploaded, determining whether the object file corresponding to the second identification information exists in the server according to the first identification information and the second identification information corresponding to the object file for storing the object data, and determining whether the object data corresponding to the first identification information exists in the object file when determining that the object file exists, when it is determined that the object data corresponding to the first identification information does not exist in the object file, response information is fed back to the client side, the response information is used for indicating the client side to upload a sub-file corresponding to the object data, and after the sub-file corresponding to the object data uploaded by the client side is received, the sub-file corresponding to the object data is sent to the client side. And storing the sub-file corresponding to the object data into the object file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a file storage method, device, equipment and medium. Background Art

[0002] One of the commonly used technologies for saving virtual machine image files is based on the File Transfer Protocol (FTP). The FTP protocol uploads the virtual machine image file to the remote FTP server through the local FTP client. The disadvantage of the FTP protocol is that it only supports the upload of a single file, while the virtual machine image file generally consists of multiple files, including configuration files and data files. Another technology is basic object storage, which packages the virtual machine image file into an object file and saves the local virtual machine object file in the remote object storage system by calling the remote object storage (Representational State Transfer API, RestAPI for short). The disadvantage of this technology is that the virtual machine image file needs to be packaged into an object file before uploading and saving, which is relatively inefficient. Summary of the invention

[0003] In view of this, the present invention provides a file storage method, apparatus, device and medium to solve the problem of low efficiency in integrating multiple files on a server or packaging multiple files on a client into one object file.

[0004] In a first aspect, the present invention provides a file storage method, the method comprising:

[0005] receiving a file upload request corresponding to a target operation transmitted by a client, wherein the file upload request includes first identification information corresponding to object data to be uploaded and second identification information corresponding to an object file storing the object data, wherein the object data to be uploaded is used to perform the target operation;

[0006] Determine, based on the second identification information, whether there is an object file corresponding to the second identification information in the server;

[0007] When it is determined that the object file exists, determining whether object data corresponding to the first identification information exists in the object file;

[0008] When it is determined that the object data corresponding to the first identification information does not exist in the object file, feedback response information to the client, where the response information is used to instruct the client to upload the sub-file corresponding to the object data;

[0009] After receiving the sub-file corresponding to the object data uploaded by the client, the sub-file corresponding to the object data is stored in the object file, wherein the object file stores all the sub-files corresponding to the target operation.

[0010] A file storage method provided by the present invention has the following advantages: based on the file upload request corresponding to the target operation transmitted by the client, the server of the method confirms whether there is an object file storing multiple sub-files corresponding to the identification information in the request and whether there is a sub-file corresponding to the identification information in the object file, and feeds back a response message to the client, and the client determines the file to be uploaded according to the response information. By customizing the transmission protocol and transmission method, multiple files can be uploaded to a single object file for storage. The same client can specify multiple files to upload at the same time, and the server receives the files corresponding to the target operation transmitted by the client respectively, avoiding local multiple file archiving operations, facilitating user operations, saving user time, and improving efficiency. In addition, after receiving the sub-file corresponding to the object data uploaded by the client, the sub-file corresponding to the object data is stored in the object file, and all sub-files corresponding to the target operation are stored in the object file. The storage service end adopts a single object file storage to improve system performance.

[0011] This method is based on file-based uploading and receiving, and is applicable to file uploading scenarios in various environments.

[0012] In an optional implementation, the file upload request also includes metadata corresponding to the object data. When it is determined that the object file contains object data corresponding to the first identification information, the method further includes:

[0013] Verifying, based on the metadata, whether the object data corresponding to the first identification information is complete;

[0014] When it is determined that the object data is complete, abnormal warning information is sent to the client, and the abnormal warning information is used to indicate that the server has stored the object data corresponding to the first identification information.

[0015] Specifically, based on the metadata, it verifies whether the object data corresponding to the first identification information is complete, ensuring that no data loss or damage occurs during data transmission, thereby improving the reliability of data transmission. When the server determines that the object data is complete, it sends an abnormal alarm message to the client, so that the client can promptly learn that the server has stored the object data corresponding to the first identification information, which can reduce unnecessary repeated data uploads and save bandwidth and storage resources. Based on the abnormal alarm message, the client can provide users with more intuitive feedback, such as prompting users that the file already exists and does not need to be uploaded repeatedly, thereby improving the user experience.

[0016] In an optional implementation, when it is determined that the object data is incomplete, the method further includes:

[0017] Determine the file offset position corresponding to the part of the object data that has not been uploaded based on the metadata;

[0018] The file offset position is added to the response information to feed back the response information to the client, and the client re-uploads the first identification information and part of the data according to the file offset position.

[0019] Specifically, when it is determined that the object data is incomplete, it indicates that the object data was interrupted during the upload process. Based on the above situation, the method proposes a breakpoint resume method, which determines the file offset position corresponding to the part of the object data that has not been uploaded according to the metadata, adds the file offset position to the response information, and the client re-uploads the first identification information and the part of the data after the file offset position according to the file offset position. The breakpoint resume function only transmits the part of the data that has not been received, instead of re-uploading the object data of the entire sub-file, which reduces the amount of data transmission caused by network failures, improves network bandwidth utilization, and improves transmission efficiency.

[0020] In an optional implementation, after receiving the sub-file corresponding to the object data uploaded by the client, storing the sub-file corresponding to the object data in the object file includes:

[0021] The sub-files are stored in a fixed-size storage space.

[0022] Specifically, storing each sub-file in a fixed-size storage space makes data management simpler and more consistent. The object file can pre-allocate fixed-size data blocks, and directly extract the corresponding object data according to the fixed-size data blocks based on the first identification information, thereby omitting the time for addressing the starting and ending positions of each object data, simplifying the data indexing and retrieval process, and improving the efficiency of data processing.

[0023] In an optional implementation, when the number of bytes corresponding to the storage space occupied by the subfile is smaller than the number of bytes corresponding to the storage space of a fixed size, the storage locations in the storage space other than the storage locations occupied by the subfile are filled with preset characters.

[0024] Specifically, when the number of bytes corresponding to the storage space occupied by the sub-file is less than the number of bytes occupied by the fixed-size data block, the number of bytes occupied by the sub-file is padded with a preset character. The padding operation ensures that each sub-file meets the fixed-size data block requirements, which helps maintain data integrity. In addition, fixed-size data blocks can improve the performance of the operating system in performing various operations. For example, in I / O operations, the operating system and hardware read fixed-size blocks, which reduces the overhead of I / O operation addressing and improves data reading and writing speed.

[0025] In an optional implementation, the storage space occupied by the metadata is the same as the storage space occupied by the sub-file.

[0026] Specifically, fixed-size data blocks are used to store sub-files and their corresponding metadata, which simplifies the indexing algorithm of the file system. Indexing is performed directly based on fixed-size data blocks, avoiding indexing based on object data content, making it easier to determine the storage location of sub-files. Fixed-size data blocks also allow the server to process multiple files in parallel, and each file can be processed independently of other files, improving the server's parallel processing capabilities.

[0027] In an optional implementation, after receiving the first identification information and the partial data re-uploaded by the client according to the file offset position, the method further includes:

[0028] Determine, according to the first identification information and the file offset position, a storage position of a subfile of the object data corresponding to the first identification information in the object file;

[0029] Stores partial data to a storage location.

[0030] Specifically, according to the first identification information, a fixed-size data block of the subfile of the object data corresponding to the first identification information is determined in the object file, and according to the file offset position, the storage position of the subfile in the data block is determined. Extra steps in the data transmission process, such as searching and locating the storage position, can be reduced, thereby improving the overall data transmission efficiency.

[0031] In a second aspect, the present invention provides a file storage device, the device comprising:

[0032] a receiving module, receiving a file upload request corresponding to a target operation transmitted by a client, wherein the file upload request includes first identification information corresponding to object data to be uploaded and second identification information corresponding to an object file storing the object data, and the object data to be uploaded is used to perform the target operation;

[0033] A determination module, used to determine whether there is an object file corresponding to the second identification information in the server according to the second identification information;

[0034] A processing module, configured to determine whether object data corresponding to the first identification information exists in the object file when it is determined that the object file exists;

[0035] A sending module, configured to feed back response information to the client when it is determined that the object data corresponding to the first identification information does not exist in the object file, wherein the response information is used to instruct the client to upload a sub-file corresponding to the object data;

[0036] The receiving module is also used to receive the sub-file corresponding to the object data uploaded by the client;

[0037] The processing module is further used to store the sub-files corresponding to the object data into the object file, wherein the object file stores all the sub-files corresponding to the target operation.

[0038] A file storage device provided by the present invention has the following advantages: multiple files can be uploaded to a single object file for storage. The same client can specify multiple files to upload at the same time, and the server receives the files corresponding to the target operation transmitted by the client respectively, avoiding local multiple file archiving operations, facilitating user operations, saving user time, and improving efficiency. In addition, after receiving the sub-file corresponding to the object data uploaded by the client, the sub-file corresponding to the object data is stored in the object file, and all sub-files corresponding to the target operation are stored in the object file. The storage service end adopts a single object file for storage, thereby improving system performance.

[0039] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the file storage method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0040] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the file storage method of the first aspect or any corresponding embodiment thereof.

[0041] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the file storage method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 It is a flowchart of a file storage method provided by an embodiment of the present invention;

[0044] Figure 2 is a flowchart of another file storage method provided by an embodiment of the present invention;

[0045] Figure 3 is a flowchart of another file storage method provided by an embodiment of the present invention;

[0046] Figure 4 It is a structural schematic diagram of a file storage method provided by an embodiment of the present invention;

[0047] Figure 5 It is a flowchart of another file storage method provided by an embodiment of the present invention;

[0048] Figure 6 is a structural block diagram of a file storage device provided by an embodiment of the present invention;

[0049] Figure 7 It is a schematic diagram of the hardware structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0051] With the rapid development of virtualization technology, more and more customers choose to deploy their services on the cloud. As a common virtualization technology, virtual machines generally rely on file storage or block storage as the underlying storage technology, that is, files or block devices are virtualized as physical disks of virtual machines to provide storage services for virtual machines. In cloud computing scenarios, it is often necessary to back up or save virtual machine data, such as saving virtual machine images in remote storage systems. Customers can obtain virtual machine images from remote storage systems and quickly deploy virtual machines or restore data locally.

[0052] One of the commonly used technologies for saving virtual machine image files is to upload the virtual machine image files to the remote FTP server through the local FTP client based on the FTP protocol. The disadvantage of the FTP protocol is that it only supports the upload of a single file, while virtual machine image files generally consist of multiple files, including configuration files and data files. Another technology is basic object storage, which packages the virtual machine image files into an object file and saves the local virtual machine object files in the remote object storage system by calling the RestAPI of the remote object storage. The disadvantage of this technology is that the virtual machine image files need to be packaged into object files before uploading and saving, which is relatively inefficient. The above two solutions also have a disadvantage: they do not support breakpoint resumption: that is, when the connection between the client and the server fails, the upload of files or objects will be interrupted due to the failure, and they need to be uploaded again later, which will greatly waste precious bandwidth resources.

[0053] To solve the above problems, an embodiment of the present invention provides a file storage embodiment. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system (computer device) including a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0054] In this embodiment, a file storage method is provided, which can be used in the above-mentioned terminal devices, such as mobile phones, tablet computers, etc. Figure 1 is a flowchart of a file storage method provided by an embodiment of the present invention, such as Figure 1 As shown, the process includes the following steps:

[0055] Step S101: receiving a file upload request corresponding to a target operation transmitted by a client.

[0056] Specifically, the target operation can be an operation that requires the cooperation of multiple files to be implemented, such as generating a virtual machine image, or it can be an operation that can be implemented by a single file. The files required to implement the target operation can be uploaded by one client or uploaded by multiple clients separately. Before receiving the file corresponding to the target operation transmitted by the client, it is necessary to first receive the file upload request corresponding to the target operation transmitted by the client. This is used to subsequently determine whether the object file and object data exist.

[0057] The file upload request includes first identification information corresponding to the object data to be uploaded and second identification information corresponding to the object file storing the object data, and the object data to be uploaded is used to perform the target operation.

[0058] Step S102: Determine whether there is an object file corresponding to the second identification information in the server according to the second identification information.

[0059] Specifically, according to the second identification information corresponding to the object file storing the object data in the file upload request, it is determined whether the server has an object file corresponding to the second identification information. When it is determined that the object file does not exist, the object file is created, and the object file is used to store all sub-files corresponding to the target operation, so that multiple files can be uploaded to a single object file for storage, and the client's multi-file archiving operation and the server's file addressing operation are omitted.

[0060] Step S103: When it is determined that the object file exists, determine whether there is object data corresponding to the first identification information in the object file.

[0061] Specifically, when it is determined that the object file exists, it is determined whether corresponding object data exists in the object file according to the first identification information in the file upload request.

[0062] Step S104: when it is determined that the object file does not contain the object data corresponding to the first identification information, feedback response information to the client.

[0063] The response information is used to instruct the client to upload the sub-file corresponding to the object data.

[0064] Specifically, when it is determined that the object file does not contain the object data corresponding to the first identification information, response information is fed back to the client, wherein the response information may include the first identification information.

[0065] Step S105: After receiving the sub-file corresponding to the object data uploaded by the client, the sub-file corresponding to the object data is stored in the object file.

[0066] The object file stores all sub-files corresponding to the target operation.

[0067] Specifically, the client uploads a sub-file corresponding to the first identification information in the response information, and after receiving the sub-file corresponding to the object data uploaded by the client, the server stores the sub-file corresponding to the object data in the object file.

[0068] This embodiment proposes a server-side file storage method, which realizes uploading multiple files to a single object file for storage based on a customized transmission protocol and transmission method. The same client can specify multiple files to upload at the same time, and the server receives the files corresponding to the target operation transmitted by the client respectively, avoiding local multi-file archiving operations, facilitating user operations, saving user time, and improving efficiency. In addition, after receiving the sub-file corresponding to the object data uploaded by the client, the sub-file corresponding to the object data is stored in the object file, and all sub-files corresponding to the target operation are stored in the object file. The storage service end uses a single object file for storage, which improves system performance.

[0069] On the basis of the above-mentioned embodiment, in an optional embodiment, the embodiment of the present invention further provides another file storage method, which can be used in the above-mentioned mobile terminal, such as a mobile phone, a tablet computer, etc. Figure 2 shown.

[0070] Specifically, the file upload request also includes metadata corresponding to the object data. When it is determined that the object file contains object data corresponding to the first identification information, the process may further include the following method steps:

[0071] Step S201: Verify, based on metadata, whether the object data corresponding to the first identification information is complete.

[0072] Specifically, the file upload request also includes metadata corresponding to the object data, and the metadata information includes the total bytes occupied by the object data corresponding to the first identification information. The total number of bytes in the metadata information is compared with the number of bytes of the object data received by the server to verify whether the object data received by the server is complete.

[0073] Step S202: When it is determined that the object data is complete, an abnormality warning message is sent to the client.

[0074] Specifically, the abnormal alarm information is used to indicate that the server has stored the object data corresponding to the first identification information. That is, when the total number of bytes in the metadata information is consistent with the number of bytes of the object data received by the server, the object data is determined to be complete, indicating that the server has stored the object data corresponding to the first identification information and cannot be uploaded repeatedly.

[0075] In the above method, by comparing the number of bytes of the received first file object data and the total number of bytes of the first file object data recorded in the metadata, it is possible to verify whether the uploaded data is complete. This ensures that no data is lost or damaged during data transmission, thereby improving the reliability of data transmission. When the server determines that the object data is complete, it sends an abnormal alarm message to the client, so that the client can promptly learn that the server has stored the object data corresponding to the first identification information, which can reduce unnecessary repeated data uploads and save bandwidth and storage resources. The client can provide users with more intuitive feedback based on the abnormal alarm message, such as prompting users that the file already exists and does not need to be uploaded repeatedly, thereby improving the user experience.

[0076] Based on the above-mentioned embodiment, the embodiment of the present invention further provides another file storage method, which can be used in the above-mentioned mobile terminal, such as a mobile phone, a tablet computer, etc. Figure 3 shown.

[0077] Verify, based on the metadata, whether the object data corresponding to the first identification information is complete. In an optional embodiment, when it is determined that the object data is incomplete, the process includes the following steps:

[0078] Step S301: determining the file offset position corresponding to the portion of object data that has not been uploaded according to the metadata.

[0079] Specifically, based on the metadata, verify whether the object data corresponding to the first identification information is complete. When it is determined that the object data is incomplete, determine the number of bytes of the object data received by the server, and then determine the partial data of the object data corresponding to the first identification information that has not been uploaded. The number of bytes of the object data received by the server is the file offset position corresponding to the partial data of the object data that has not been uploaded.

[0080] Step S302: Add the file offset position to the response information.

[0081] Specifically, the response information may include not only the first identification information but also the file offset position. After receiving the response information, the client re-uploads the first identification information and the part of the object data that has not been uploaded according to the file offset position.

[0082] Specifically, when it is determined that the object data is incomplete, it indicates that the object data was interrupted during the upload process. Based on the above situation, the method proposes a breakpoint resume method, which determines the file offset position corresponding to the part of the object data that has not been uploaded according to the metadata, adds the file offset position to the response information, and the client re-uploads the first identification information and the part of the data after the file offset position according to the file offset position. The breakpoint resume function only transmits the part of the data that has not been received, instead of re-uploading the object data of the entire sub-file, which reduces the amount of data transmission caused by network failures, improves network bandwidth utilization, and improves transmission efficiency.

[0083] Based on any of the foregoing embodiments, in an optional embodiment, after receiving a sub-file corresponding to the object data uploaded by the client, storing the sub-file corresponding to the object data in the object file includes:

[0084] The sub-files are stored in a fixed-size storage space.

[0085] In a specific example, sub-files are stored according to the storage space occupied by data blocks of a fixed size, that is, storage space for each sub-file is reserved. This approach may have the following advantages:

[0086] On the one hand, even if the upload of the object data corresponding to file 1 is interrupted, it will not affect the upload of the object data corresponding to file 2. Figure 3 When re-uploading the partial data after the file offset position of the object data corresponding to file 1, the upload can be continued from the interrupted position to ensure the integrity of the data. In addition, the object data is stored in a fixed-size data block, which can omit the trouble of addressing and determining the file position.

[0087] In an optional embodiment, when the number of bytes corresponding to the storage space occupied by the subfile is smaller than the number of bytes corresponding to the storage space of a fixed size, the storage locations in the storage space other than the storage locations occupied by the subfile are filled with preset characters.

[0088] The preset character may be any recognizable character, for example, may be the character 0.

[0089] Specifically, the padding operation ensures that each sub-file meets the fixed-size data block requirements, which helps maintain data integrity. In addition, fixed-size data blocks can improve the performance of the operating system in performing various operations. For example, in I / O operations, the operating system and hardware system read fixed-size blocks, which reduces the addressing overhead of I / O operations and improves data reading and writing speeds.

[0090] In an optional embodiment, the storage space occupied by the metadata is the same as the storage space occupied by the sub-file.

[0091] Specifically, fixed-size data blocks are used to store sub-files and their corresponding metadata, simplifying the index structure of the file system. Indexing is performed directly based on fixed-size data blocks, avoiding indexing based on file content, and facilitating the determination of sub-file storage locations. Fixed-size data blocks also allow the server to process multiple files in parallel, and each file can be processed independently of other files, improving the server's parallel processing capabilities.

[0092] Based on any of the foregoing embodiments, in an optional embodiment, after receiving the first identification information and partial data re-uploaded by the client according to the file offset position, the method may further include the following steps:

[0093] Step a1, determining the storage position of the subfile of the object data corresponding to the first identification information in the object file according to the first identification information and the file offset position;

[0094] Specifically, after receiving the first identification information and partial data after the file offset position fed back by the client, it is necessary to first determine the fixed-size data block of the corresponding sub-file in the object file based on the first identification information, and then determine the storage location of the partial data in the fixed-size data block based on the file offset position.

[0095] Step a2, storing part of the data in a storage location.

[0096] Specifically, according to the first identification information, a fixed-size data block of the subfile of the object data corresponding to the first identification information is determined in the object file, and according to the file offset position, the storage position of the subfile in the data block is determined. Extra steps in the data transmission process, such as searching and locating the storage position, can be reduced, thereby improving the overall data transmission efficiency.

[0097] In an optional embodiment, when the network condition is poor, file uploading requires a lot of time and resources. Therefore, a data receiving time threshold may be preset, specifically including:

[0098] Step b1, determining the maximum allowed time for receiving object data transmission according to a preset data receiving time threshold.

[0099] Step b2: When the time for receiving the object data transmission reaches the maximum allowed time, interrupting the reception of the object data.

[0100] Step b3, verifying whether the object data is complete according to the metadata;

[0101] Step b4: When the object data is not received completely, a response message is returned.

[0102] The response information includes the first identification information and the received file offset position.

[0103] In an optional embodiment, based on the above embodiment, it can be known that the system needs to verify whether the object data corresponding to the first identification information is complete based on the metadata to determine the content of the feedback response information. The client determines to perform the next step based on the response information. Once the metadata is wrong, it may also have a certain impact on the data. Therefore, it is also necessary to ensure the integrity and accuracy of the metadata. Specifically, the way to ensure the integrity and accuracy of the metadata can be seen in the following method steps:

[0104] Step c1, based on the pre-configured metadata generation template, determining whether the filled data meets the requirements of the pre-configured metadata generation template.

[0105] Specifically, the metadata verification function can be used to ensure that all required fields have been filled in and the data type is correct. For metadata that does not meet the requirements, metadata anomalies can be determined.

[0106] Step c2: when it is determined that the metadata is abnormal, response information is fed back to the client.

[0107] The response information includes the first identification information, and the client re-uploads the corresponding metadata file according to the response information.

[0108] The following will use a virtual machine image file as an example to illustrate the overall operation process of the above method. The structural diagram of the method is as follows: Figure 4 As shown:

[0109] The server needs to obtain the virtual machine image and virtual machine data from the client for rapid deployment and data recovery of the virtual machine. The implementation of this operation assumes that N sub-files are required, and the sub-files are stored in multiple clients. At this time, the server receives at least one sub-file sent by at least one client. Assuming that the identification information of each sub-file is file 1, file 2...file N, the sub-files and the metadata of each file are stored in an object file on the server. Before receiving the sub-file uploaded by the client, an object file is created first, and the metadata of the object file is stored in the object file as a fixed-size data block.

[0110] The specific processing flow of each file is as follows Figure 5 As shown, taking file 1 as an example, after receiving the upload request of file 1, the server should first determine whether the object file storing the file exists. If the object file does not exist, create the object file. If the object file exists, determine whether the object data of file 1 to be uploaded exists. If the object data of file 1 does not exist, feedback response information to the client to instruct the client to upload file 1.

[0111] When the object data of file 1 exists, verify whether the object data of file 1 is complete based on the metadata of the file. The specific verification method is as follows: Figure 2 As shown, I will not go into details here. When the object data of file 1 is complete, an abnormal alarm message that the file already exists is sent to the client. When the object data of file 1 is incomplete, it indicates that the transmission of file 1 is interrupted, and the file offset position is determined according to the method described in the previous article. After obtaining the file offset position, the file offset position is added to the response information. The client selects the file or part of the file data to be uploaded based on the response information. After receiving the metadata of file 1 and the object data of file 1, the server stores them in fixed-size data blocks to simplify the indexing algorithm of the file system.

[0112] The specific implementation process of this embodiment has been described in detail in the previous text, so it will not be repeated here.

[0113] In this embodiment, a file storage device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0114] This embodiment provides a file storage device, such as Figure 6 As shown, it includes: a receiving module 601, a determining module 602, a processing module 603, and a sending module 604.

[0115] The receiving module 601 receives a file upload request corresponding to a target operation transmitted by a client, wherein the file upload request includes first identification information corresponding to object data to be uploaded and second identification information corresponding to an object file storing the object data, and the object data to be uploaded is used to perform the target operation;

[0116] A determination module 602 is used to determine whether there is an object file corresponding to the second identification information in the server according to the second identification information;

[0117] Processing module 603, for determining whether there is object data corresponding to the first identification information in the object file when it is determined that the object file exists;

[0118] A sending module 604 is used to feed back response information to the client when it is determined that the object data corresponding to the first identification information does not exist in the object file, where the response information is used to instruct the client to upload a sub-file corresponding to the object data;

[0119] The receiving module 601 is further used to receive a sub-file corresponding to the object data uploaded by the client;

[0120] The processing module 603 is further configured to store the sub-files corresponding to the object data into the object file, wherein the object file stores all the sub-files corresponding to the target operation.

[0121] In an optional embodiment, the sending module 604 is specifically configured to verify whether the object data corresponding to the first identification information is complete according to the metadata;

[0122] When it is determined that the object data is complete, abnormal warning information is sent to the client, and the abnormal warning information is used to indicate that the server has stored the object data corresponding to the first identification information.

[0123] In an optional embodiment, the sending module 604 is further used to determine the file offset position corresponding to the part of the object data that has not been uploaded according to the metadata;

[0124] The file offset position is added to the response information to feed back the response information to the client, and the client re-uploads the first identification information and part of the data according to the file offset position.

[0125] In an optional embodiment, the processing module 603 is further configured to store the sub-file corresponding to the object data into the object file after receiving the sub-file corresponding to the object data uploaded by the client, and store the sub-file in a fixed-size storage space.

[0126] In an optional embodiment, the processing module 603 is specifically configured to fill the storage locations in the storage space except the storage locations occupied by the subfile with preset characters when the number of bytes corresponding to the storage space occupied by the subfile is less than the number of bytes corresponding to the fixed-size storage space.

[0127] In an optional embodiment, the storage space occupied by the metadata is the same as the storage space occupied by the sub-file.

[0128] In an optional embodiment, the processing module 603 is further used to determine the storage position of the subfile of the object data corresponding to the first identification information in the object file according to the first identification information and the file offset position;

[0129] Stores partial data to a storage location.

[0130] The file storage device in this embodiment is presented in the form of a functional module, where the module refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0131] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0132] A file storage device provided by an embodiment of the present invention realizes uploading multiple files to a single object file for storage by implementing the file storage method. The same client can specify multiple files to upload at the same time, and the server receives the files corresponding to the target operation transmitted by the client respectively, avoiding local multiple file archiving operations, facilitating user operations, saving user time, and improving efficiency. In addition, after receiving the sub-file corresponding to the object data uploaded by the client, the sub-file corresponding to the object data is stored in the object file, and all sub-files corresponding to the target operation are stored in the object file. The storage service end adopts a single object file storage to improve system performance.

[0133] An embodiment of the present invention further provides a computer device, Figure 7 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 7 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 10 is taken as an example.

[0134] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include an integrated circuit. The integrated circuit may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0135] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0136] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0137] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0138] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0139] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0140] The embodiment of the present invention also provides a computer-readable storage medium. The method provided in the above embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or is implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0141] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0142] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A file storage method, characterized in that: The method is executed by the server and includes: receiving a file upload request corresponding to a target operation transmitted by a client, wherein the file upload request includes first identification information corresponding to object data to be uploaded and second identification information corresponding to an object file storing the object data, wherein the object data to be uploaded is used to perform the target operation; Determining, according to the second identification information, whether the object file corresponding to the second identification information exists in the server; When it is determined that the object file exists, determining whether the object data corresponding to the first identification information exists in the object file; When it is determined that the object data corresponding to the first identification information does not exist in the object file, feeding back response information to the client, where the response information is used to instruct the client to upload the sub-file corresponding to the object data; After receiving the sub-file corresponding to the object data uploaded by the client, the sub-file corresponding to the object data is stored in the object file, wherein the object file stores all the sub-files corresponding to the target operation.

2. The method according to claim 1, characterized in that The file upload request also includes metadata corresponding to the object data. When it is determined that the object data corresponding to the first identification information exists in the object file, the method further includes: Verifying, based on the metadata, whether the object data corresponding to the first identification information is complete; When it is determined that the object data is complete, abnormal warning information is sent to the client, where the abnormal warning information is used to indicate that the server has stored the object data corresponding to the first identification information.

3. The method according to claim 2, characterized in that When it is determined that the object data is incomplete, the method further includes: Determine, according to the metadata, a file offset position corresponding to the portion of the object data that has not been uploaded; The file offset position is added to the response information to feed back the response information to the client, and then the client re-uploads the first identification information and the partial data according to the file offset position.

4. The method according to claim 2 or 3, characterized in that: After receiving the sub-file corresponding to the object data uploaded by the client, storing the sub-file corresponding to the object data in the object file includes: The sub-files are stored in a fixed-size storage space.

5. The method according to claim 4, characterized in that When the number of bytes corresponding to the storage space occupied by the subfile is smaller than the number of bytes corresponding to the storage space of the fixed size, the storage positions in the storage space other than the storage positions occupied by the subfile are filled with preset characters.

6. The method according to claim 4, characterized in that The storage space occupied by the metadata is the same as the storage space occupied by the sub-file.

7. The method according to claim 3, characterized in that After receiving the first identification information and the partial data re-uploaded by the client according to the file offset position, the method further includes: Determine, according to the first identification information and the file offset position, a storage position of the subfile of the object data corresponding to the first identification information in the object file; The portion of data is stored in the storage location.

8. A file storage device, characterized in that: The device comprises: a receiving module, receiving a file upload request corresponding to a target operation transmitted by a client, wherein the file upload request includes first identification information corresponding to object data to be uploaded and second identification information corresponding to an object file storing the object data, and the object data to be uploaded is used to perform the target operation; a determination module, configured to determine, based on the second identification information, whether the object file corresponding to the second identification information exists in the server; A processing module, configured to determine whether the object data corresponding to the first identification information exists in the object file when it is determined that the object file exists; a sending module, configured to feed back response information to the client when it is determined that the object data corresponding to the first identification information does not exist in the object file, wherein the response information is used to instruct the client to upload a sub-file corresponding to the object data; The receiving module is further used to receive a sub-file corresponding to the object data uploaded by the client; The processing module is further configured to store the sub-file corresponding to the object data into the object file, wherein the object file stores all the sub-files corresponding to the target operation.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the file storage method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the file storage method according to any one of claims 1 to 7.