File transmission method, electronic device, and storage medium

By using the index and data file operation interface of the virtual access file system, and integrating or splitting files according to their size, the problems of low write efficiency and disk fragmentation in the one-way import system are solved, and high-performance file transfer is achieved.

CN115617746BActive Publication Date: 2025-11-07南京中孚信息技术有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211294645.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-21
Publication Date
2025-11-07
Estimated Expiration
2042-10-21

AI Technical Summary

Technical Problem

Existing operating system file storage methods suffer from problems such as low write efficiency, high disk fragmentation, and significant storage performance bottlenecks in one-way import systems, failing to meet high-performance transmission requirements.

Method used

A virtual access file system is adopted. The file to be written and its parameters are received through the write file interface. The index file operation interface and the data file operation interface are called to integrate or split the file according to the file size, optimize the file storage location information, and improve the writing efficiency.

Benefits of technology

It improves file writing efficiency, reduces disk fragmentation, and meets the high-performance transmission requirements of one-way import systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115617746B_ABST
    Figure CN115617746B_ABST
Patent Text Reader

Abstract

The application provides a file transmission method, an electronic device and a storage medium, and relates to the technical field of intranet security protection. According to the write parameters of a to-be-written file, an index file operation interface is called to determine whether an index file of the to-be-written file exists, if yes, according to the operation state of the to-be-written file in the index file and the write parameters of the to-be-written file, it is determined whether the index file of the to-be-written file is updated, when the to-be-written file is a large file or a small file, the index file operation interface is called according to the total size of the to-be-written file to update the storage location information in the index file where the to-be-written file is located, the updated index file records the real storage location information of the to-be-written file, and the real storage location information of the to-be-written file has the characteristics of high utilization of the disk space occupied by different data files, the write efficiency of the to-be-written file is improved, and the high-performance transmission requirement of the one-way import system is met.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intranet security protection, in particular to a file transmission method, an electronic device and a storage medium. BACKGROUND

[0002] In the process of cross-network transmission, in order to ensure the security of data transmission, the intranet system will input the data from the extranet into the intranet system through a one-way import system. The one-way import system refers to a system that realizes safe and efficient one-way data transmission by using physical one-way transmission, full-text audit, format check, virus detection, keyword black and white list filtering, suffix filtering and other technologies, which is mainly applied to various industries with high security requirements. Generally, due to the particularity of the one-way import system to meet the security requirements, the one-way import system itself can only be single machine storage and cannot be placed on other servers for distributed storage, resulting in that some mainstream distributed storage cannot play its advantages on the one-way import system.

[0003] At present, in order to meet the security requirements, the one-way import system must drop the transmitted files into the disk for a series of file checks (such as virus detection, keyword scanning, content check, etc.), therefore, the current one-way import system still generally adopts the file storage mode of the general operating system to facilitate various file check operations.

[0004] However, due to the problems of the operating system such as low efficiency of writing small files, a large number of disk fragments, outstanding storage performance bottleneck and the like, the use of the existing operating system file storage mode cannot meet the requirement of high-performance transmission of the one-way import system. SUMMARY

[0005] The present application aims at the deficiencies in the prior art, and provides a file transmission method, an electronic device and a storage medium, so as to solve the problem that the use of the existing operating system file storage mode cannot meet the requirement of high-performance transmission of the one-way import system.

[0006] To achieve the above-mentioned purpose, the technical solutions adopted by the embodiments of the present application are as follows:

[0007] In a first aspect, the embodiments of the present application provide a file transmission method applied to a virtual access file system, wherein the virtual access file system at least includes a write file interface, an index file operation interface and a data file operation interface.

[0008] The method comprises:

[0009] receiving, by the write file interface, a to-be-written file and write parameters of the to-be-written file from an external system, wherein the write parameters at least include a file handle, a total file size, and a write file data length, and the file handle includes a file identifier of the to-be-written file;

[0010] determining, according to the write parameters, the index file operation interface to determine an index file corresponding to the to-be-written file;

[0011] updating, according to an operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, the index file operation interface to update the index file, and calling the data file operation interface to write the to-be-written file into a data file corresponding to the index file.

[0012] Optionally, the updating, according to the operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, the index file operation interface to update the index file comprises:

[0013] determining, according to the total file size and a preset first file length, whether to perform integration processing on the to-be-written file;

[0014] if yes, performing integration processing on the to-be-written file, determining a data file corresponding to the to-be-written file and storage location information according to an integration result after the integration processing, and calling the index file operation interface to update, into the index file, an identifier of the data file corresponding to the to-be-written file and the storage location information.

[0015] Optionally, the calling the data file operation interface to write the to-be-written file into the data file corresponding to the index file comprises:

[0016] transmitting, into the data file operation interface, the identifier of the data file corresponding to the to-be-written file and the storage location information, so as to write, by the data file operation interface, the to-be-written file into a position indicated by the storage location information in the data file corresponding to the to-be-written file.

[0017] Optionally, the updating, according to the operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, the index file operation interface to update the index file comprises:

[0018] comparing the total file size with a preset second file length to determine whether to perform segmentation processing on the to-be-written file;

[0019] If yes, the to-be-written file is segmented to obtain a plurality of sub-files, data files corresponding to the sub-files and storage location information in the data files are determined, and the index file operation interface is called to update the identification of the data files corresponding to the sub-files and the storage location information in the data files to the index file.

[0020] Optionally, the calling of the data file operation interface to write the to-be-written file into the data file corresponding to the index file comprises:

[0021] Optionally, the calling of the data file operation interface to write the to-be-written file into the data file corresponding to the index file comprises:

[0022] Optionally, the calling of the data file operation interface to write the to-be-written file into the data file corresponding to the index file comprises:

[0023] Optionally, the calling of the index file operation interface to update the index file according to the operation state of the to-be-written file recorded in the index file and the write parameter of the to-be-written file comprises:

[0024] Optionally, the calling of the index file operation interface to update the index file according to the operation state of the to-be-written file recorded in the index file and the write parameter of the to-be-written file comprises:

[0025] Optionally, the virtual access file system further comprises an open file interface.

[0026] Before the receiving of the to-be-written file and the write parameter of the to-be-written file by the write file interface, the virtual access file system further comprises:

[0027] The file identification of the to-be-opened file is received by the open file interface.

[0028] The index file operation interface is called to query whether the to-be-written file exists an index file.

[0029] If yes, the operation state of the to-be-written file in the index file is modified to open, and the file handle of the to-be-written file is returned to the external system through the open file interface.

[0030] Optionally, the virtual access file system further comprises a read file interface;

[0031] The method further comprises:

[0032] receiving, by the read file interface, a file handle of a to-be-read file transmitted by an external system and a receiving buffer;

[0033] calling the index file operation interface to query whether the to-be-read file has an index file;

[0034] if yes, reading, from the index file, identification and storage location information of a data file corresponding to the to-be-read file;

[0035] transmitting the identification and the storage location information of the data file corresponding to the to-be-read file into the data file operation interface, so as to read the to-be-read file from a corresponding storage location in the data file corresponding to the to-be-read file by the data file operation interface and cache the to-be-read file to the receiving buffer.

[0036] In a second aspect, the embodiments of the present application further provide a file transmission device applied to a virtual access file system, wherein the virtual access file system at least comprises a write file interface, an index file operation interface and a data file operation interface;

[0037] The device comprises:

[0038] a receiving module configured to receive, by the write file interface, a to-be-written file transmitted by an external system and write parameters of the to-be-written file, wherein the write parameters at least comprise a file handle, a total file size and a write file data length, and the file handle comprises identification of the to-be-written file;

[0039] a determining module configured to determine, according to the write parameters, an index file corresponding to the to-be-written file by calling the index file operation interface;

[0040] an updating module configured to update, according to an operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, the index file by calling the index file operation interface;

[0041] a writing module configured to write, by calling the data file operation interface, the to-be-written file into a data file corresponding to the index file.

[0042] Optionally, the updating module is further configured to:

[0043] determine, according to the total file size and a preset first file length, whether to perform integration processing on the to-be-written file;

[0044] If yes, the to-be-written file is subjected to integration processing, the data file corresponding to the to-be-written file and the storage location information are determined according to the integration result after the integration processing, and the index file operation interface is called to update the identification of the data file corresponding to the to-be-written file and the storage location information into the index file.

[0045] Optionally, the writing module is further configured to:

[0046] transmit the identification of the data file corresponding to the to-be-written file and the storage location information into the data file operation interface, so as to write the to-be-written file into the position indicated by the storage location information in the data file corresponding to the to-be-written file through the data file operation interface.

[0047] Optionally, the updating module is further configured to:

[0048] compare the total size of the file with the preset second file length, and determine whether the to-be-written file is subjected to segmentation processing;

[0049] If yes, the to-be-written file is subjected to segmentation processing to obtain a plurality of subfiles, the data file corresponding to each of the subfiles and the storage location information in the data file are determined, and the index file operation interface is called to update the identification of the data file corresponding to each of the subfiles and the storage location information in the data file into the index file.

[0050] Optionally, the writing module is further configured to:

[0051] read the identification of each data file and the storage location information from the index file in sequence;

[0052] transmit the identification of the data file corresponding to each of the subfiles and the storage location information into the data file operation interface according to the correspondence between each of the subfiles and each data file, so as to write each of the subfiles into the position indicated by the storage location information in the data file corresponding to each of the subfiles through the data file operation interface.

[0053] Optionally, the updating module is further configured to:

[0054] If it is determined that the to-be-written file is not subjected to integration processing or segmentation processing according to the preset first file length and the preset second file length, the identification of the data file corresponding to the to-be-written file and the storage location information are read from the index file, the target storage location information is determined according to the writing parameter of the to-be-written file, and the index file operation interface is called to update the target storage location information into the index file.

[0055] Optionally, the virtual file access system further comprises an open file interface.

[0056] The receiving module is further configured to receive, through the open file interface, a file identifier of a file to be opened transmitted by the external system.

[0057] The apparatus further comprises:

[0058] The querying module is configured to query, by calling the index file operation interface, whether the file to be written exists an index file.

[0059] The modifying module is configured to, if yes, modify an operation state of the file to be written in the index file to open, and return a file handle of the file to be written to the external system through the open file interface.

[0060] Optionally, the virtual file access system further comprises a read file interface.

[0061] The receiving module is further configured to receive, through the read file interface, a file handle of a file to be read transmitted by the external system and a receiving buffer.

[0062] The querying module is further configured to query, by calling the index file operation interface, whether the file to be read exists an index file.

[0063] The apparatus further comprises:

[0064] The reading module is configured to, if yes, read, from the index file, an identifier and storage location information of a data file corresponding to the file to be read, and transmit the identifier and storage location information of the data file corresponding to the file to be read to the data file operation interface, so as to read the file to be read from a corresponding storage location in the data file corresponding to the file to be read through the data file operation interface.

[0065] The caching module is configured to cache the file to be read to the receiving buffer.

[0066] In a third aspect, an electronic device is provided, and the electronic device comprises a processor, a storage medium and a bus. The storage medium stores machine readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium through the bus. The processor executes the machine readable instructions to perform the steps of the method provided in the first aspect.

[0067] In a fourth aspect, a computer readable storage medium is provided. The storage medium stores a computer program. When the computer program is run by a processor, the steps of the method provided in the first aspect are performed.

[0068] The present application has the following beneficial effects:

[0069] The embodiment of the present application provides a file transmission method, an electronic device and a storage medium, the method is applied to a virtual access file system, the virtual access file system runs in a one-way import system, and whether an index file corresponding to a to-be-written file exists is determined by calling an index file operation interface according to write parameters of the to-be-written file through a write file interface provided by the virtual access file system, when the index file of the to-be-written file exists, whether the index file of the to-be-written file needs to be updated is determined according to an operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, when the to-be-written file is a large file or a small file, storage position information in the index file where the to-be-written file is located is updated by calling the index file operation interface according to a total file size of the to-be-written file, so that the updated index file records real storage position information of the to-be-written file, and the real storage position information of the to-be-written file has a high utilization rate feature for disk space occupied by different data files, and then when the data file operation interface is called to write the to-be-written file into a data file corresponding to the index file, the write efficiency of the to-be-written file can be improved, and then the requirement of high-performance transmission of the one-way import system is met. BRIEF DESCRIPTION OF DRAWINGS

[0070] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0071] Figure 1 The framework of the virtual access file system provided by the embodiment of the present application Figure 1

[0072] Figure 2 The flowchart of the file transmission method provided by the embodiment of the present application

[0073] Figure 3 The flowchart of another file transmission method provided by the embodiment of the present application

[0074] Figure 4 The flowchart of another file transmission method provided by the embodiment of the present application

[0075] Figure 5 The flowchart of another file transmission method provided by the embodiment of the present application

[0076] Figure 6 The framework of the virtual access file system provided by the embodiment of the present application​Figure 2 ;

[0077] Figure 7 a flowchart of another file transmission method provided by an embodiment of the present application;

[0078] Figure 8 a flowchart of another file transmission method provided by an embodiment of the present application;

[0079] Figure 9 a flowchart of another file transmission method provided by an embodiment of the present application;

[0080] Figure 10 a flowchart of another file transmission method provided by an embodiment of the present application;

[0081] Figure 11 a structural diagram of a file transmission device provided by an embodiment of the present application;

[0082] Figure 12 a structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0083] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of description and illustration, and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn according to the actual proportions. The flowcharts show the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowcharts can not be implemented in sequence, and the steps without logical context relationship can be reversed in sequence or implemented simultaneously. In addition, one or more other operations can be added to the flowcharts or removed from the flowcharts by those skilled in the art under the guidance of the content of the present application.

[0084] In addition, the described embodiments are only some of the embodiments of the present application, not all the embodiments. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0085] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0086] First, before providing a detailed explanation of the technical solution provided in this application, a brief description of the framework structure of the virtual access file system involved in this application will be given.

[0087] Figure 1 A schematic diagram of the framework structure of a virtual access file system provided in this application; such as Figure 1 As shown, this virtual access file system provides multiple file transfer interfaces to external systems, such as write file interfaces, index file operation interfaces, and data file operation interfaces. External systems refer to external network systems or internal network systems that can call the external interfaces provided by the virtual access file system.

[0088] In this embodiment, the write file interface provides an external interface for writing files to external systems. It receives write parameters for the files to be written from the external interface, passes these parameters to the write file processing, and then calls the index file based on the file name and total file size. The interface writes to the index file, and the data file interface is then called to write the files to be written to the data file within the index file containing the files to be written. Furthermore, the write file processing merges small files and writes them to disk, or splits large files and writes them to disk, recording these changes in the index file.

[0089] The index file operation interface is a set of encapsulated interfaces for operating index files. It provides interfaces for writing, reading, and deleting files. The operation types include at least writing to the index file, modifying the index file, deleting a specific entry in the index file, and querying entries in the index file based on different columns.

[0090] The data file operation interface is a set of encapsulated interfaces for manipulating data files, providing a common interface for file writing, file reading, and file deletion. Operation types include at least: sequential writing of file data, sequential reading of file data, deleting file data, writing file data based on a specified offset, and reading file data based on a specified offset.

[0091] In addition, index files are used to record metadata of stored files. There are two types of index files: Type I index files record information including at least the first-level index number, availability status, operation status, file name, and total file size; Type II index files record information including at least the first-level index number, second-level index number, data file name, data start offset, data length, and data end offset.

[0092] A data file is a file used to actually store file data. This data file may store multiple files or just a fragment of a file, depending on the total size of the stored files. For small files, multiple small files need to be appended sequentially, while for large files, the large file needs to be split into multiple data files of fixed size.

[0093] The distinction between small and large files is based on the size of the data file. Files smaller than the data file size are called small files, and files larger than the data file size are called large files.

[0094] Understandable. Figure 1 The structure shown is for illustrative purposes only; the virtual access file system may also include more advanced features. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.

[0095] The following will explain the implementation principle and corresponding beneficial effects of the file transfer method provided in this application through several specific embodiments.

[0096] Figure 2 This is a flowchart illustrating a file transfer method provided in an embodiment of this application; optionally, the execution entity of this method may be the one shown. Figure 1 The virtual access file system includes at least the following: a write file interface, an index file operation interface, and a data file operation interface.

[0097] It should be understood that in other embodiments, the order of some steps in the file transfer method can be interchanged according to actual needs, or some steps can be omitted or deleted. For example... Figure 1 As shown, the method includes:

[0098] S201. Receive the file to be written and the writing parameters of the file to be written from the external system through the file writing interface.

[0099] The write parameters include at least: file handle, total file size, and length of data to be written. The file handle includes the file identifier of the file to be written, which can be the file name of the file to be written. The file handle is used to uniquely identify the file, and the corresponding file can be opened based on the file handle.

[0100] For example, the write parameters of the file A to be written include: file handle, total file size of 500K, write file data length of L1, and the file handle includes the file identifier of the file A to be written as A.

[0101] In the embodiment, when the external network system needs to write the to-be-written file A into the internal network system, the external network system needs to first receive the to-be-written file A and the write parameter of the to-be-written file through the write file interface provided by the virtual access file system running on the one-way import system, wherein the to-be-written file A refers to the file data of the to-be-written file A.

[0102] S202, calling the index file operation interface to determine the index file corresponding to the to-be-written file according to the write parameter.

[0103] It should be understood that before the to-be-written file A is written, the index file of the to-be-written file A needs to be established first, wherein the index file records the available state, the operation state, the file name, the total size, the data file name, the data start offset, the data length, the data end offset and other information of the to-be-written file A. The available state, the operation state and the storage location information of the to-be-written file A can be queried according to the index file in which the to-be-written file A is located.

[0104] In the embodiment, for example, after the write file interface receives the to-be-written file A and the write parameter of the to-be-written file from the external system, the index file operation interface can be called according to the file name in the write parameter of the to-be-written file A to query whether the to-be-written file A has a corresponding index file; if yes, the query is successful, and the write operation of the to-be-written file A is continued; if not, the query fails, that is, the to-be-written to-be-written file A does not exist, and the to-be-written file A fails to be written.

[0105] S203, calling the index file operation interface to update the index file according to the operation state of the to-be-written file recorded in the index file and the write parameter of the to-be-written file, and calling the data file operation interface to write the to-be-written file into the data file corresponding to the index file.

[0106] The operation state of the to-be-written file can include: opening, closing.

[0107] It should be noted that before the to-be-written file is written, the to-be-written file needs to be opened first to set the operation state of the to-be-written file to opening, and prepare for writing.

[0108] In the embodiment, the index file operation interface needs to be called first to update the index file according to the operation state of the to-be-written file recorded in the index file and the write parameter of the to-be-written file.

[0109] For example, the identification of the data file to be written into the index file where file A is located is No. 1 data file, that is, file A to be written can be written into No. 1 data file. If the total size of file A to be written is large, file A to be written cannot be written into No. 1 data file at one time. According to the write parameters of file A to be written, it can be determined whether file A to be written needs to be segmented to write different parts of file A to be written into multiple data files, such as writing the first part of file A to be written into No. 1 data file and the second part into No. 2 data file. The write pressure of large files can be reduced, and multiple data concurrent writing can be supported to improve the write efficiency of file A to be written and meet the requirement of high-performance transmission of the one-way import system.

[0110] For example, if the total size of file B to be written is small, file B to be written cannot fill the disk space occupied by No. 3 data file when file B to be written is written into No. 3 data file. According to the write parameters of file B to be written, it can be determined whether file B to be written needs to be merged to write file A to be written into other data files that are not full, such as merging file B to be written and file C to be written and writing them into No. 3 data file. The write rate of small files is improved, which is close to the write efficiency of large files, to meet the requirement of high-performance transmission of the one-way import system, and to avoid a large number of disk fragments caused by directly writing small files into the hard disk, thereby reducing the overall performance of the disk.

[0111] Therefore, according to the write parameters of the file to be written, the index file operation interface can be called to update the data file name, data start offset, data length, data end offset and other information in the index file where the file to be written is located. The updated index file records the real storage location information of the file to be written, and the real storage location information of the file to be written has the characteristics of high utilization of the disk space occupied by different data files. In this way, when the data file operation interface is called to write the file to be written into the data file corresponding to the index file, the write efficiency of the file to be written can be improved, thereby meeting the requirement of high-performance transmission of the one-way import system.

[0112] In summary, the embodiment of the present application provides a file transmission method, which is applied to a virtual access file system running in a one-way import system. According to write parameters of a to-be-written file, an index file operation interface is called to determine whether an index file corresponding to the to-be-written file exists through a write file interface provided by the virtual access file system. When the index file of the to-be-written file exists, whether the index file of the to-be-written file needs to be updated is determined according to an operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file. When the to-be-written file is a large file or a small file, storage location information in the index file of the to-be-written file is updated according to a total file size of the to-be-written file, so that the updated index file records real storage location information of the to-be-written file, and the real storage location information of the to-be-written file has a high utilization rate of disk space occupied by different data files. Therefore, when the data file operation interface is called to write the to-be-written file into a data file corresponding to the index file, the write efficiency of the to-be-written file can be improved, thereby meeting the requirement of high-performance transmission of the one-way import system.

[0113] The first case is a write operation on a to-be-written small file that needs to be merged.

[0114] The following embodiment will be specifically explained to illustrate how the index file operation interface is called to update the index file according to the operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file in step S203.

[0115] Optionally, referring to Figure 3 The step S203 includes the following steps.

[0116] S301, determining whether to perform integration processing on the to-be-written file according to the total file size and a preset first file length.

[0117] For example, the preset first file length is 1000K, and the total file size of the to-be-written file B can be compared with the preset first file length to determine whether the to-be-written file B needs to be integrated.

[0118] In this embodiment, for example, it is assumed that the total file size of the to-be-written file B is 500K. After the total file size of the to-be-written file B is compared with the preset first file length, if it is found that the total file size of the to-be-written file B is less than the preset first file length, the to-be-written file B needs to be integrated, that is, the plurality of small files are stored in a merged manner to improve the write disk rate of the to-be-written file.

[0119] In another implementable manner, if it is found that the total file size of the file to be written into file B is greater than the preset first file length, it is further needed to determine whether the total file size of the file to be written into file B is greater than the preset second file length, to determine whether the file to be written into file B needs to be processed by splitting, which will be specifically explained in subsequent embodiments and thus will not be described in detail here.

[0120] S302, if yes, performing integration processing on the file to be written into, determining the data file corresponding to the file to be written into and the storage location information according to the integration result after the integration processing, and calling an index file operation interface to update the identification of the data file corresponding to the file to be written into and the storage location information into the index file.

[0121] Exemplarily, the storage location information of the file to be written into file B is the data start offset, data length, data end offset and the like of the file to be written into file B in the No. 2 data file, that is, the writing area of the file to be written into file B can be quickly located from the data file according to the storage location information of the file to be written into file B.

[0122] On the basis of the above embodiments, if the file to be written into file B needs to be processed by integration, it is further needed to continue to find out which small files similar to the file to be written into file B need to be written into the disk, if the file to be written into file B and the file to be written into file C are both small files to be written into the disk, the file to be written into file B and the file to be written into file C can be stored by merging. For example, before updating the index file in which the file to be written into file B is located and the index file in which the file to be written into file C is located, the data file in the index file in which the file to be written into file B is located is the No. 2 data file and the storage location information is P1-P2, the data file in the index file in which the file to be written into file C is located is the No. 3 data file and the storage location information is P4-P5, and the disk area occupied by the No. 3 data file is in an unfilled state. When the file to be written into file B and the file to be written into file C are stored by merging, the file to be written into file B can be stored into the No. 3 data file, that is, the data file corresponding to the file to be written into file B can be determined as the No. 3 data file and the storage location information can be determined as P6-P7, at this time, the identification of the data file corresponding to the file to be written into file B and the storage location information can be updated into the index file in which the file to be written into file B is located by calling the index file operation interface, so that the file to be written into file B can be stored according to the identification of the data file and the storage location information in the updated index file.

[0123] Optionally, the step S203 of calling the data file operation interface to write the file to be written into into the data file corresponding to the index file comprises:

[0124] The identifier and storage location information of the data file corresponding to the to-be-written file are transmitted to the data file operation interface, so that the to-be-written file is written into the position indicated by the storage location information in the data file corresponding to the to-be-written file through the data file operation interface.

[0125] In this embodiment, for example, the identifier of the data file corresponding to the to-be-written file B is the No. 3 data file, and the storage location information is P6-P7. That is, the identifier and storage location information of the data file corresponding to the to-be-written file are transmitted to the data file operation interface, and the to-be-written file B is written into the position indicated by the storage location information in the data file corresponding to the to-be-written file through the data file operation interface, that is, the to-be-written file B is written into the disk area indicated by the storage location information P6-P7 in the No. 3 data file. Thus, the small files are stored in a combined manner, the writing speed of the small files to the disk is improved, and the writing efficiency of the to-be-written file is improved, thereby meeting the requirement of high-performance transmission of the one-way import system. At the same time, the small files are directly written to the hard disk, and a large number of disk fragments are generated, thereby reducing the overall performance of the disk.

[0126] The second case is the writing operation of the to-be-written large file that needs to be split.

[0127] The following embodiment will be used to specifically explain how to update the index file according to the operation state of the to-be-written file recorded in the index file and the writing parameter of the to-be-written file in step S203.

[0128] Optionally, as shown in Figure 4 The step S203 includes the following steps.

[0129] S401, compare the total file size with the preset second file length to determine whether to perform splitting processing on the to-be-written file.

[0130] For example, the preset second file length is 1G, and the total file size of the to-be-written file A can be compared with the preset second file length to determine whether the to-be-written file A needs to be split.

[0131] In this embodiment, for example, it is assumed that the total file size of the to-be-written file A is 2G. After comparing the total file size of the to-be-written file A with the preset second file length, if it is found that the total file size of the to-be-written file A is greater than the preset second file length, the to-be-written file A needs to be split to split the large file into a plurality of subfiles with a fixed size, that is, the large file is split and written to the disk to decompose the large file writing pressure, support concurrent writing of multiple data blocks, improve the writing efficiency of the to-be-written file A, and meet the requirement of high-performance transmission of the one-way import system.

[0132] In another implementable manner, if it is found that the total size of the file D to be written is between the preset first file length and the preset second file length, the file D to be written does not need to be subjected to the splitting processing or the merging processing, and a direct writing operation can be performed. Details will be explained in subsequent embodiments, and thus no more description is made herein.

[0133] S402, if yes, the file to be written is subjected to the splitting processing to obtain a plurality of sub-files, the data files corresponding to the sub-files and the storage location information in the data files are determined, and the identification of the data files corresponding to the sub-files and the storage location information in the data files are updated into the index file by calling the index file operation interface.

[0134] On the basis of the above embodiments, if it is needed to perform segmentation processing on the to-be-written file A, the total size of the to-be-written file A and the preset segmentation size can be used to determine how many sub-files the to-be-written file A needs to be segmented into. If the preset segmentation size is 500K, the to-be-written file A can be segmented into four sub-files, i.e., sub-file A1, sub-file A2, sub-file A3 and sub-file A4, and the four segmented sub-files are written to the disk concurrently. For example, before the index file where the to-be-written file A is located is updated, the data file in the index file where the to-be-written file A is located is data file 1, and the storage location information is P1-P8. When the four sub-files segmented from the to-be-written file A are needed to be stored in different data files, the current data files whose occupied disk regions are in an underwritten state can be found first. If data file 4, data file 5 and data file 6 are found to be in an underwritten state, sub-file A2, sub-file A3 and sub-file A4 can be stored in the three data files respectively, and sub-file A1 is still stored in data file 1. That is, the data file corresponding to each of the four sub-files and the storage location information in the data file can be determined. Specifically, the data file corresponding to sub-file A1 is data file 1, and the storage location information in data file 1 is P1-P2; the data file corresponding to sub-file A2 is data file 4, and the storage location information in data file 4 is P3-P4; the data file corresponding to sub-file A3 is data file 5, and the storage location information in data file 5 is P3-P4; and the data file corresponding to sub-file A4 is data file 6, and the storage location information in data file 6 is P2-P4. Then, the identification of the data file corresponding to the four sub-files and the storage location information in the data file can be updated to the index file where the to-be-written file A is located by calling the index file operation interface. That is, the identification of the data file in the updated index file where the to-be-written file A is located is data file 1, data file 4, data file 5 and data file 6, and the corresponding storage location information in the data file is P1-P2 in data file 1, P3-P4 in data file 4, P3-P4 in data file 5 and P2-P4 in data file 6.

[0135] Optionally, referring to FIG. 2, Figure 5 The step S203 of writing the to-be-written file into the data file corresponding to the index file by calling the data file operation interface includes the following steps.

[0136] S501, read the identification and storage location information of each data file from the index file in sequence.

[0137] S502, according to the correspondence between each sub-file and each data file, the identification and storage location information of the data file corresponding to each sub-file are transmitted to the data file operation interface, so that each sub-file is written into the position indicated by the storage location information in the data file corresponding to each sub-file through the data file operation interface.

[0138] On the basis of the above embodiment, the identification and storage location information of each data file can be read from the index file in which the to-be-written file A is located in turn, and according to the correspondence between each sub-file and each data file, such as the correspondence between the sub-file A1 and the No. 1 data file, the identification of the data file corresponding to the sub-file A1 is the No. 1 data file, and the storage location information is the P1-P2 parameter information, which are transmitted to the data file operation interface together, and the sub-file A1 is written into the position indicated by the storage location information in the data file corresponding to the sub-file A1 through the data file operation interface, so as to realize the disk writing operation of the sub-file A1; similarly, according to the same writing process, the disk writing of each sub-file is performed, which will not be described one by one here.

[0139] In this embodiment, concurrent disk writing of multiple sub-files is supported, so that the writing efficiency of large files can be improved to meet the requirement of high-performance transmission of the one-way import system.

[0140] The third case is the writing of the to-be-written file which does not need to be split or combined.

[0141] Optionally, in the step S203, the index file operation interface is called to update the index file according to the operation state of the to-be-written file recorded in the index file and the writing parameter of the to-be-written file, including:

[0142] If it is determined that the to-be-written file does not need to be integrated or segmented according to the preset first file length and the preset second file length, the identification and storage location information of the data file corresponding to the to-be-written file are read from the index file, the target storage location information is determined according to the writing parameter of the to-be-written file, and the index file operation interface is called to update the target storage location information to the index file.

[0143] In this embodiment, for example, if the total size of the file D to be written is 5000K, and after comparing the total size of the file D to be written with both a preset first file length and a preset second file length, it is found that the total size of the file D to be written is between the preset first file length and the preset second file length, then there is no need to perform segmentation or merging processing on the file D to be written, and the writing operation can be performed directly. Specifically, for example, if the identifier of the data file corresponding to the file D to be written is data file number 7 and the storage location information is P1-P3, then the target storage location information of the file D to be written in data file number 7 can be determined according to the write file data length in the write parameters of the file D to be written. For example, if the disk area corresponding to the storage location information P1-P3 in data file 7, which cannot be fully occupied by the file D, is determined based on the write file data length in the write parameters of the file D, then the target storage location information P1-P2 of the file D in data file 7 can be obtained based on the write file data length in the write parameters of the file D and the starting storage location of the file D in data file 7. Then, by calling the index file operation interface, the target storage location information of the file D in data file 7 is updated to the index file, and the identifier of the data file corresponding to the file D is set to data file 7, and the storage location information P1-P2 is passed to the data file operation interface. The file D is then written to the location indicated by the storage location information P1-P2 in data file 7 through the data file operation interface, thus realizing the disk write operation of the file D.

[0144] The following examples will explain in detail how to open a file before performing a write operation.

[0145] refer to Figure 6 The diagram shown illustrates the framework of the virtual access file system provided in this application embodiment. Figure 2 ;like Figure 6 As shown, the virtual access file system also includes: open file interface, read file interface, close file interface, and delete file interface.

[0146] The open / close file interface provides an external interface for opening or closing files to external systems. It receives preparatory operations for file write and read operations from external systems and returns a file handle, or an end operation after a file write or read operation.

[0147] The file read interface provides an external interface for reading files to external systems. Based on the open file handle and file name passed by the external system, it is passed to the file read processing, which then returns the file content data obtained by the file read processing to the external system.

[0148] The deleting file interface provides an external interface for deleting files for an external system, transmits the file name to the deleting file processing according to the file name transmitted by the external system, deletes the specified file according to the file name, and returns the result information, wherein the result information includes whether the deletion is successful or not.

[0149] The following embodiment will be used to specifically explain how to perform the opening operation on the to-be-opened file.

[0150] Optionally, as shown in Figure 7 Before the step S201 of receiving the to-be-written file and the writing parameter of the to-be-written file transmitted by the external system through the writing file interface, the method further includes:

[0151] S701, receiving the file identifier of the to-be-opened file transmitted by the external system through the opening file interface.

[0152] The file identifier of the to-be-opened file can be the file name of the to-be-opened file.

[0153] S702, calling the index file operation interface to query whether the to-be-written file exists the index file.

[0154] S703, if yes, modifying the operation state of the to-be-written file in the index file as opened, and returning the file handle of the to-be-written file to the external system through the opening file interface.

[0155] In the embodiment, when the opening operation needs to be performed on the to-be-opened file E, the file name of the to-be-opened file E transmitted by the external system can be received through the opening file interface, and the index file operation interface is called to query whether the index file of the to-be-opened file E exists, if yes, the operation state of the to-be-opened file E in the index file is modified as opened, and the file handle of the to-be-opened file E is returned to the external system through the opening file interface; if not, the to-be-opened file E fails to be opened, which results in that the to-be-opened file E cannot be written or read.

[0156] The following embodiment will be used to specifically explain how to perform the reading operation on the to-be-read file.

[0157] Optionally, as shown in Figure 8 The method further includes:

[0158] S801, receiving the file handle of the to-be-read file and the receiving buffer transmitted by the external system through the reading file interface.

[0159] The file handle includes the file name of the to-be-read file.

[0160] S802, calling the index file operation interface to query whether the to-be-read file exists an index file.

[0161] S803, if yes, reading the identifier and storage location information of the data file corresponding to the to-be-read file from the index file.

[0162] S804, transmitting the identifier and storage location information of the data file corresponding to the to-be-read file into the data file operation interface, so as to read the to-be-read file from the corresponding storage location in the data file corresponding to the to-be-read file through the data file operation interface, and cache the to-be-read file to the receiving buffer.

[0163] In the embodiment, when the read operation needs to be performed on the to-be-read file E, the open operation needs to be performed on the to-be-read file E first, and the file handle of the to-be-read file E and the receiving buffer transmitted by the external system are received through the read file interface. Then, whether the index file of the to-be-read file E exists is queried through the index file operation interface. If the index file exists, the identifier and storage location information of the data file in the index file where the to-be-read file E is located are read, and the identifier and storage location information of the data file in the index file where the to-be-read file E is located are transmitted into the data file operation interface. The to-be-read file is read from the corresponding storage location in the data file corresponding to the to-be-read file E through the data file operation interface, and the to-be-read file is cached to the receiving buffer. If the index file of the to-be-read file E does not exist, the read operation of the to-be-read file E fails, and the error that the to-be-read file E does not exist is returned.

[0164] In addition, if the operation state of the index file where the to-be-read file E is located is not opened, the read operation of the to-be-read file E fails, and the error that the to-be-read file E is not opened is returned.

[0165] The following embodiment will be specifically explained.

[0166] Optionally, as shown in Figure 9 the method further includes:

[0167] S901, receiving the file identifier of the to-be-deleted file transmitted by the external system through the delete file interface.

[0168] The file identifier of the to-be-deleted file can be the file name of the to-be-deleted file.

[0169] S902, calling the index file operation interface to query whether the to-be-deleted file exists an index file.

[0170] In another implementable manner, if the index file of the to-be-deleted file is not queried, that is, the index file of the to-be-deleted file does not exist, the deletion of the to-be-deleted file fails, and the error that the to-be-deleted file does not exist is returned.

[0171] S903, if yes, reading, from the index file, whether the operation state corresponding to the file to be read is open.

[0172] In another implementable manner, if the operation state corresponding to the file to be deleted is open, the file to be deleted fails to be deleted, and an error that the file to be deleted is open is returned.

[0173] S904, if yes, modifying the available state of the index file to be deleted, calling the data file interface to delete the data file in the index file, and returning a success state to the external system.

[0174] The closing operation on the file to be closed will be specifically explained through the following embodiments.

[0175] Optionally, as shown in Figure 10 The method further includes:

[0176] S1001, receiving, by the closing file interface, the file identifier of the file to be closed transmitted by the external system.

[0177] The file identifier of the file to be closed can be the file name of the file to be closed.

[0178] S1002, calling the index file operation interface to query whether the file to be closed exists in the index file.

[0179] S1003, if yes, modifying the operation state of the index file to be closed to be closed, and returning success to the closing file interface.

[0180] In another implementable manner, if the file to be closed does not exist in the index file, the closing file fails, and failure is returned to the closing file interface.

[0181] Based on the same inventive concept, the present embodiment further provides a file transmission device corresponding to the file transmission method. Since the principle of solving problems of the device in the present embodiment is similar to the above-mentioned file transmission method of the present embodiment, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described here.

[0182] Referring to Figure 11 The present embodiment further provides a file transmission device, which is applied to a virtual access file system. The virtual access file system at least includes a write file interface, an index file operation interface, and a data file operation interface.

[0183] The device includes:

[0184] The receiving module 1101 is configured to receive, through a write file interface, a to-be-written file and write parameters of the to-be-written file transmitted by an external system, wherein the write parameters at least include a file handle, a total file size, a write file data length, and a file identification in the file handle.

[0185] The determining module 1102 is configured to determine, according to the write parameters, an index file corresponding to the to-be-written file by calling an index file operation interface.

[0186] The updating module 1103 is configured to update, according to an operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, the index file by calling the index file operation interface.

[0187] The writing module 1104 is configured to write the to-be-written file into a data file corresponding to the index file by calling a data file operation interface.

[0188] Optionally, the updating module 1103 is further configured to:

[0189] determine whether to perform integration processing on the to-be-written file according to the total file size and a preset first file length;

[0190] if yes, perform integration processing on the to-be-written file, determine a data file corresponding to the to-be-written file and storage location information according to an integration result after the integration processing, and update, by calling the index file operation interface, an identification of the data file corresponding to the to-be-written file and the storage location information into the index file.

[0191] Optionally, the writing module 1104 is further configured to:

[0192] transmit the identification of the data file corresponding to the to-be-written file and the storage location information into the data file operation interface, so as to write the to-be-written file into a position indicated by the storage location information in the data file corresponding to the to-be-written file by using the data file operation interface.

[0193] Optionally, the updating module 1103 is further configured to:

[0194] compare the total file size with a preset second file length, and determine whether to perform segmentation processing on the to-be-written file;

[0195] if yes, perform segmentation processing on the to-be-written file to obtain a plurality of sub-files, determine a data file corresponding to each sub-file and storage location information in the data file, and update, by calling the index file operation interface, an identification of the data file corresponding to each sub-file and the storage location information in the data file into the index file.

[0196] Optionally, the writing module 1104 is further configured to:

[0197] read the identification and storage location information of each data file from the index file in sequence;

[0198] According to the correspondence between each sub-file and each data file, the identification and storage location information of the data file corresponding to each sub-file are transmitted into the data file operation interface, so as to write each sub-file into the position indicated by the storage location information in the data file corresponding to each sub-file through the data file operation interface.

[0199] Optionally, the updating module 1103 is further configured to:

[0200] If it is determined that no integration processing or segmentation processing is to be performed on the to-be-written file according to the preset first file length and the preset second file length, the identification and storage location information of the data file corresponding to the to-be-written file are read from the index file, the target storage location information is determined according to the write parameter of the to-be-written file, and the index file operation interface is called to update the target storage location information into the index file.

[0201] Optionally, the virtual access file system further comprises an open file interface;

[0202] The receiving module 1101 is further configured to receive the file identification of the to-be-opened file transmitted by the external system through the open file interface;

[0203] The apparatus further comprises:

[0204] The querying module is configured to call the index file operation interface to query whether the to-be-written file exists in the index file;

[0205] The modifying module is configured to, if yes, modify the operation state of the to-be-written file in the index file to open, and return the file handle of the to-be-written file to the external system through the open file interface.

[0206] Optionally, the virtual access file system further comprises a read file interface;

[0207] The receiving module 1101 is further configured to receive the file handle of the to-be-read file and the receiving buffer transmitted by the external system through the read file interface;

[0208] The querying module is further configured to call the index file operation interface to query whether the to-be-read file exists in the index file;

[0209] The apparatus further comprises:

[0210] The reading module is configured to read the identifier and storage location information of the data file corresponding to the to-be-read file from the index file if yes; and transmit the identifier and storage location information of the data file corresponding to the to-be-read file into the data file operation interface, so as to read the to-be-read file from the corresponding storage location in the data file corresponding to the to-be-read file through the data file operation interface.

[0211] The caching module is configured to cache the to-be-read file to the receiving buffer.

[0212] The apparatus is configured to execute the method provided by the foregoing embodiments, and has similar implementation principles and technical effects, which will not be described here.

[0213] The above modules can be one or more integrated circuits configured to implement the above method, for example, one or more application specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs), etc. For another example, when the above module is implemented in the form of a processing element scheduling code, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can invoke program code. For another example, the modules can be integrated together in the form of a system on a chip (SOC).

[0214] Figure 12 A structural schematic diagram of an electronic device provided by an embodiment of the present application is provided. The electronic device is deployed with a virtual access file system, so as to implement the file transmission method provided by the present application.

[0215] As shown in Figure 12 The electronic device includes a memory 1201 and a processor 1202. The memory 1201 and the processor 1202 are directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines.

[0216] The memory 1201 stores software function modules in the form of software or firmware stored in the memory 1201. The processor 1202 executes various functional applications and data processing by running the software programs and modules stored in the memory 1201, that is, implements the file transmission method in the embodiments of the present application.

[0217] The memory 1201 can be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), etc. The memory 1201 is configured to store a program, and the processor 1202 executes the program after receiving an execution instruction.

[0218] The processor 1202 can be an integrated circuit chip having a processing capability. The processor 1202 described above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.

[0219] Optionally, the present application also provides a program product, for example, a computer readable storage medium, including a program, which is used to execute the above-mentioned method embodiments when executed by a processor.

[0220] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented by other means. For example, the apparatus embodiments described above are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0221] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.

[0222] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.

[0223] The integrated unit implemented in the form of software function unit can be stored in a computer readable storage medium. The software function unit is stored in a storage medium, and includes a plurality of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute part of steps of the method described in various embodiments of the present application. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.

Claims

1. A file transfer method characterized by, The application is applied to a virtual access file system, and the virtual access file system at least comprises a write file interface, an index file operation interface and a data file operation interface; The method comprises: Receiving a to-be-written file and write parameters of the to-be-written file from an external system through the write file interface, wherein the write parameters at least comprise a file handle, a total file size and a write file data length, and the file handle comprises a file identifier of the to-be-written file; According to the write parameters, calling the index file operation interface to determine an index file corresponding to the to-be-written file; According to the operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, calling the index file operation interface to update the index file, and calling the data file operation interface to write the to-be-written file into a data file corresponding to the index file; Wherein, before writing the to-be-written file, an index file of the to-be-written file is established, wherein the index file records the available state, the operation state, the file name, the total file size, the data file name, the data starting offset, the data length and the data ending offset of the to-be-written file, and according to the index file where the to-be-written file is located, the available state, the operation state and the storage location information of the to-be-written file are queried; After receiving the to-be-written file and the write parameters of the to-be-written file from the external system through the write file interface, according to the file name in the write parameters of the to-be-written file, the index file operation interface is called to query whether the to-be-written file has a corresponding index file; if yes, the query is successful, and the write operation on the to-be-written file is continued; if not, the query fails.

2. The method of claim 1, wherein, According to the operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, calling the index file operation interface to update the index file, comprising: According to the total file size and a preset first file length, determining whether to perform integration processing on the to-be-written file; If yes, performing integration processing on the to-be-written file, determining a data file corresponding to the to-be-written file and storage location information according to an integration result after the integration processing, and calling the index file operation interface to update the identifier of the data file corresponding to the to-be-written file and the storage location information into the index file.

3. The method of claim 2, wherein, Calling the data file operation interface to write the to-be-written file into the data file corresponding to the index file, comprising: Transmitting the identifier of the data file corresponding to the to-be-written file and the storage location information into the data file operation interface, so as to write the to-be-written file into a position indicated by the storage location information in the data file corresponding to the to-be-written file through the data file operation interface.

4. The method of claim 1, wherein, According to the operation state of the to-be-written file recorded in the index file and the write parameters of the to-be-written file, calling the index file operation interface to update the index file, comprising: comparing the total size of the file with a preset second file length to determine whether to perform splitting processing on the to-be-written file; if yes, performing splitting processing on the to-be-written file to obtain a plurality of sub-files, determining data files corresponding to each of the sub-files and storage location information in the data files, and calling the index file operation interface to update the identification of the data file corresponding to each of the sub-files and the storage location information in the data file to the index file.

5. The method of claim 4, wherein, The calling of the data file operation interface to write the to-be-written file into the data file corresponding to the index file comprises: reading the identification of each data file and the storage location information from the index file in sequence; according to the correspondence between each of the sub-files and each of the data files, transmitting the identification of the data file corresponding to each of the sub-files and the storage location information into the data file operation interface, so as to write each of the sub-files into the position indicated by the storage location information in the data file corresponding to each of the sub-files through the data file operation interface.

6. The method of claim 1, wherein, The calling of the index file operation interface to update the index file according to the operation state of the to-be-written file recorded in the index file and the write parameter of the to-be-written file comprises: if it is determined according to the preset first file length and the preset second file length that the to-be-written file is not subjected to integration processing or splitting processing, reading the identification of the data file corresponding to the to-be-written file and the storage location information from the index file, determining target storage location information according to the write parameter of the to-be-written file, and calling the index file operation interface to update the target storage location information to the index file.

7. The method according to any one of claims 1 to 6, characterized in that, The virtual file access system further comprises an open file interface; Before the receiving of the to-be-written file and the write parameter of the to-be-written file transmitted by the external system through the write file interface, the method further comprises: receiving the file identification of the to-be-opened file transmitted by the external system through the open file interface; calling the index file operation interface to query whether the to-be-written file has an index file; if yes, modifying the operation state of the to-be-written file in the index file to open, and returning the file handle of the to-be-written file to the external system through the open file interface.

8. The method according to any one of claims 1 to 6, characterized in that, The virtual file access system further comprises a read file interface; The method further comprises: receiving the file handle of the to-be-read file and a receiving buffer transmitted by the external system through the read file interface; calling the index file operation interface to query whether the to-be-read file has an index file; if yes, reading the identification of the data file corresponding to the to-be-read file and the storage location information from the index file; transmitting the identification of the data file corresponding to the to-be-read file and the storage location information into the data file operation interface, so as to read the to-be-read file from the corresponding storage location in the data file corresponding to the to-be-read file through the data file operation interface and cache the to-be-read file to the receiving buffer.

9. An electronic device, comprising: comprises: A processor, a storage medium storing machine readable instructions executable by the processor, and a bus for communication between the processor and the storage medium when the electronic device is running, the processor executing the machine readable instructions to perform the steps of the method of any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, A computer program stored on the storage medium, the computer program when executed by the processor performing the steps of the method of any one of claims 1-8.

Citation Information

Patent Citations

  • File management method, file management device, electronic device and storage medium

    CN109669623A

  • File processing method, device and equipment and storage medium

    CN110597762A