File query method and apparatus, computer device, and communication system
Obtaining multiple file attributes of the target directory through a file query request, the problems of low file query efficiency and large network bandwidth overhead in the prior art are solved, and more efficient file query and resource utilization are achieved.
Patent Information
- Application Number
- PCT/CN2024/070614
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-04
- Filing Date
- 2024-01-04
- Publication Date
- 2025-01-09
AI Technical Summary
In the prior art, file query efficiency is low and network bandwidth overhead is large. Especially when the number of files is large, the client needs to send multiple query requests to obtain file attributes, resulting in reduced efficiency and increased resource consumption.
By sending a file query request to instruct the file attributes of the target directory to query the file attributes of the target directory, the file attributes of the target directory, including the attributes of multiple files, reduce the consumption of network transmission and memory computing resources.
It improves file query efficiency, reduces network bandwidth overhead and memory resource consumption, and reduces the client's attribute statistics and summary operations for each file.
Smart Images

Figure CN2024070614_09012025_PF_FP_ABST
Abstract
Description
File query method, device, computer equipment and communication system
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on July 4, 2023, with application number 202310815614.4 and application name “A file query method, device, computer equipment and communication system”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computers, and in particular to a file query method, device, computer equipment, and communication system. Background Art
[0003] Currently, clients can mount shared files on servers using a network file system (NFS) to access shared files remotely over the network. For example, a client might query the properties of a file on the server (such as its location and size). Typically, the client first obtains a list of files from the server and then queries the properties of each file in the list. The more files a client has, the more query requests the client must send, resulting in lower file query efficiency and increased network bandwidth consumption.
[0004] Summary of the Invention
[0005] The present application provides a file query method, apparatus, computer equipment and communication system, which solve the problems of low efficiency of file query and high network bandwidth overhead.
[0006] In a first aspect, the present application provides a file query method, comprising: obtaining file attributes of a target directory by sending a file query request indicating the file attributes of the target directory, wherein the file attributes of the target directory are used to indicate the file organization structure attributes of the target directory.
[0007] The file organization structure can include multiple levels of directories, such as subdirectories, first-level subdirectories, second-level subdirectories, etc., and each level of directory can contain multiple files or folders. The file attributes of the target directory can include the file attributes of multiple files under the target directory. Compared to the client needing to send a file query request for each file, the file query method provided by this application requires the client to send a file query request once. This request indicates the query of the file attributes of multiple files under the target directory, and receives the attribute results of multiple files under the target directory, thereby improving the efficiency of file query. The query request and attribute results are only transmitted once in the network, reducing the network bandwidth overhead.
[0008] In addition, compared to the client caching the file attributes of files and counting the file attributes of multiple files, the file query method provided by this application allows the client to receive the statistical results of the file attributes of multiple files without caching the file attributes of files, counting and summarizing the file attributes of each file, thereby reducing the consumption of memory resources and computing resources.
[0009] In a second aspect, the present application provides a file query method, comprising: receiving a file query request indicating file attributes of a target directory to be queried. The file attributes of the target directory indicate file organizational structure attributes of the target directory; obtaining the file attributes of the target directory based on the received file query request; and transmitting the obtained file attributes of the target directory.
[0010] After receiving the file query request sent by the client, the server can uniformly summarize the target directory's attributes such as size, occupied space, total number of files contained, and total number of folders contained. Optionally, the server queries the size, occupied space, and other attributes of each folder contained in the target directory, or the size, occupied space, and other attributes of each file contained in the target directory. Optionally, the server uniformly summarizes the number, size, occupied space, and other attributes of the folders contained in the target directory, or the number, size, occupied space, and other attributes of the files contained in the target directory. The client sends a file query request to control the server to execute file attribute query operations for multiple files, instead of the client executing the file attribute query operation for each file in the target directory, thereby improving the efficiency of file queries.
[0011] In a possible implementation, the file query request includes attribute parameters of at least one of a directory, a file, or a folder.
[0012] In another possible implementation, the attribute parameter includes at least one of size, occupied space, quantity, or file type.
[0013] File query requests can satisfy different query granularities. Different query granularities include different attribute parameters at each level of query granularity. Directory attribute parameters may include size, space occupied, number of files contained, number of contained folders, location, creation time, and file type. File attribute parameters may include size, space occupied, location, creation time, and file type. Folder attribute parameters may include size, space occupied, number of contained files, location, and creation time.
[0014] In another possible implementation, the file attributes of the target directory include at least one of the following: attributes of the target directory, file attributes of files contained in the target directory, or folder attributes of folders contained in the target directory. The target directory may contain only files, or files and folders, and a folder may contain files and subfolders. Depending on the query granularity required, the attributes of all files and folders contained in the target directory may be obtained, the file attributes of any file or all files contained in the target directory may be obtained, and the folder attributes of any folder or all folders contained in the target directory may be obtained.
[0015] In another possible implementation, the target directory includes the root directory or any level of subdirectory contained in the root directory.
[0016] In another possible implementation, the file query request also includes a checksum, which includes a client identifier and a reboot verification flag. The client identifier can be used to uniquely identify the client, and the reboot verification flag can be used to indicate whether the client has been rebooted. Since multiple clients can send file query requests to the same server, the server verifies each client based on the checksum in the file query request, ensuring the uniqueness of the file query request sent by the client.
[0017] In another possible implementation, sending the file query request includes sending the file query request in a synchronous manner.
[0018] In another possible implementation, sending the file query request includes sending the file query request in an asynchronous manner.
[0019] To avoid waiting too long for file attribute results, the client can send file query requests synchronously or asynchronously. In the case of synchronous query requests, the server can provide file attribute results within a time threshold, saving the client waiting time. In the case of asynchronous query requests, the client can send subsequent file query requests after sending the current file query request, without having to wait for the server to return the file attribute results corresponding to the current request before sending the subsequent request. Once the file attribute query is completed, the server sends the file attribute results to the client.
[0020] In another possible implementation, the format of the file query request is set based on a file access protocol, including any one of Server Message Block (SMB), Network File System (NFS), or Network Attached Storage (NAS). Setting the file query request format based on the file access protocol complies with the design standards of the Internet Engineering Task Force (IETF). The standard file query request format is compatible with querying file attributes in different types of storage devices.
[0021] In another possible implementation, the method further includes displaying file attributes of the target directory. By displaying the file attribute results through the client interface, the user can clearly and conspicuously understand the file attributes of the queried target directory, thereby facilitating the user to organize the structure of the target directory and the files contained therein.
[0022] In a third aspect, the present application provides a file query device, comprising a processing module and a communication module. The processing module is configured to generate a file query request; the communication module is configured to send the file query request, wherein the file query request indicates the file attributes of a target directory to be queried, and the file attributes of the target directory indicate the file organization structure attributes of the target directory. The communication module is further configured to receive the file attributes of the target directory.
[0023] In a fourth aspect, the present application provides a file query device, comprising a communication module and a query module. The communication module is configured to receive a file query request, the file query request being used to indicate a query for file attributes of a target directory, the file attributes of the target directory being used to indicate the file organization structure attributes of the target directory; the query module is configured to obtain the file attributes of the target directory based on the file query request; and the communication module is further configured to transmit the file attributes of the target directory.
[0024] In a possible implementation, the file query request includes attribute parameters of at least one of a directory, a file, or a folder.
[0025] In another possible implementation, the attribute parameter includes at least one of size, occupied space, quantity, or file type.
[0026] In another possible implementation, the file attributes of the target directory include at least one of attributes of the target directory, file attributes of files contained in the target directory, or folder attributes of folders contained in the target directory.
[0027] In another possible implementation, the target directory includes the root directory or any level of subdirectory contained in the root directory.
[0028] In another possible implementation, the file query request further includes a verification value, where the verification value includes an identifier of the client and a restart verification identifier.
[0029] In another possible implementation, when the communication module sends the file query request, it is specifically configured to send the file query request in a synchronous manner.
[0030] In another possible implementation, when the communication module sends the file query request, it is specifically configured to send the file query request in an asynchronous manner.
[0031] In another possible implementation, the format of the file query request is set based on a file access protocol, where the file access protocol includes any one of SMB, NFS, or NAS.
[0032] In another possible implementation, the apparatus further includes a display module configured to display file attributes of the target directory.
[0033] In a fifth aspect, the present application provides a computer device comprising a processor and a memory, the memory being configured to store a set of computer instructions; when the processor, as an execution device in the first aspect or any possible implementation of the first aspect, executes the set of computer instructions, the operating steps of the file query method in the first aspect or any possible implementation of the first aspect are performed. Alternatively, when the processor, as an execution device in the second aspect or any possible implementation of the second aspect, executes the set of computer instructions, the operating steps of the file query method in the second aspect or any possible implementation of the second aspect are performed.
[0034] In a sixth aspect, the present application provides a communication system comprising a client and multiple servers. The client is configured to execute the steps of the file query method of the first aspect or any possible implementation of the first aspect, and the server is configured to execute the steps of the file query method of the second aspect or any possible implementation of the second aspect.
[0035] In a seventh aspect, the present application provides a computer-readable storage medium comprising: computer software instructions; when the computer software instructions are executed in a computing device, the computer device executes the operating steps of the file query method in the first aspect or any possible implementation of the first aspect. Alternatively, when the computer software instructions are executed in the computing device, the computer device executes the operating steps of the file query method in the second aspect or any possible implementation of the second aspect.
[0036] In an eighth aspect, the present application provides a computer program product that, when executed on a computer, causes the computer device to perform the operating steps of the file query method in the first aspect or any possible implementation of the first aspect. Alternatively, when executed on a computer, causes the computer device to perform the operating steps of the file query method in the second aspect or any possible implementation of the second aspect.
[0037] The technical effects brought about by any design method in the third to eighth aspects can refer to the technical effects brought about by the first aspect or different design methods in the first aspect, or can refer to the technical effects brought about by the second aspect or different design methods in the second aspect, and will not be repeated here.
[0038] Based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] FIG1 is a schematic diagram of a file query method provided by the prior art;
[0040] FIG2 is a schematic diagram of the structure of a communication system provided by the present application;
[0041] FIG3 is a flow chart of a file query method provided by the present application;
[0042] FIG4 is a schematic diagram of an interface for displaying file attributes of a target directory provided by the present application;
[0043] FIG5 is a schematic diagram of a synchronous query process provided by the present application;
[0044] FIG6 is a schematic diagram of the process of an asynchronous query method provided by this application;
[0045] FIG7 is a schematic structural diagram of a file query device provided by the present application;
[0046] FIG8 is a schematic structural diagram of another file query device provided by the present application;
[0047] FIG9 is a schematic structural diagram of a computer device provided in this application. DETAILED DESCRIPTION
[0048] A file refers to a piece of data stored in a computer using a computer hard drive as a carrier.
[0049] A folder is a data structure used to organize and manage files. A folder can contain at least one file. Folders can be nested, meaning a folder can contain at least one subfolder. This nesting feature allows you to categorize and store files for easier searching and management.
[0050] File Organization Structure refers to the logical structure of a file. The file organization structure can contain multiple levels of directories, such as subdirectories, first-level subdirectories, second-level subdirectories, etc. Each level of directory can contain multiple files or folders.
[0051] The Network File System (NFS) is a file-sharing protocol in a distributed file system. It enables computers running different operating systems (such as Linux, UNIX, and Windows) to share data over a network. Accessing files on remote computers on the network is like accessing files on a local computer, providing fast and reliable file sharing services. Specifically, NFS mounts the remote computer's file directory on the local computer's local directory, allowing access to the remote computer's files by accessing the local directory.
[0052] Network Attached Storage (NAS) refers to a data storage device connected to a network with storage capabilities. NAS is data-centric, centrally managing data and providing file services.
[0053] Mounting connects a directory on a remote computer to a subdirectory under the local computer's root directory. Accessing the subdirectory on the local computer is equivalent to accessing the contents of the directory on the remote computer. The subdirectory under the local computer's root directory can be empty. The subdirectory on the local computer can have the same name as the mounted directory on the remote computer.
[0054] Mounting is very common in the Linux operating system. It connects the top-level directory in the files on the storage device to a directory under the Linux root directory (such as the bin directory, home directory, lib directory, or an empty directory). Accessing this directory is equivalent to accessing the files on the storage device.
[0055] Clients can query file attributes (such as the file's location on disk, file size, and file type). File attributes help users easily find and organize files. For example, a NAS client can mount a NAS server's shared files using NFS and remotely query the attributes of files on the NAS server over the network.
[0056] Typically, the client first obtains a file list from the server, which includes multiple files, and then queries the properties of each file in the file list. Figure 1 is a schematic diagram of a file query method provided by the prior art. After the client mounts a shared folder, it queries the properties of this folder (for example, to query whether this file contains xx subfolders and xx files, and the size of this folder, that is, the total size of the subfolders and files, is xxMB). It is necessary to perform the operations shown in Figure 1: the client sends a file property query operation for each file to the server based on the number of files contained in each subfolder under this folder directory. The server returns the property results of each file to the client, such as the size of each file. The client can first summarize the property results of each file to obtain the property results of the subfolder, such as the size of the subfolder and the number of files contained in the subfolder. Then summarize the property results of each subfolder to obtain the property results of this shared folder, such as the size of the folder, the number of subfolders contained in the folder, and the number of files contained in the folder.
[0057] However, the more files a folder contains, the more file attribute query operations the client sends to the server. Consequently, the client receives more attribute results from the server, resulting in lower file query efficiency. The large number of query requests and attribute results transmitted across the network results in high network bandwidth overhead. Furthermore, during the query process, the client needs to cache the attribute results for each file in the file list, resulting in significant memory consumption. The client also needs to count and summarize the attribute results for each file, resulting in significant computing resource consumption.
[0058] In order to solve the problems of low file query efficiency and high network bandwidth overhead, the present application provides a file query method, which obtains the file attributes of a target directory by sending a file query request indicating the file attributes of the target directory. The file attributes of the target directory are used to indicate the file organization structure attributes of the target directory.
[0059] The file attributes of a target directory can include the file attributes of multiple files within the target directory. Compared to requiring the client to send a file query request for each file, the file query method provided in this application requires the client to send a single file query request, indicating a query for the file attributes of multiple files within the target directory, and then receive the attribute results for multiple files within the target directory, improving file query efficiency. The query request and attribute results are transmitted only once across the network, reducing network bandwidth overhead.
[0060] In addition, compared to the client caching the file attributes of files and counting the file attributes of multiple files, the file query method provided by this application allows the client to receive the statistical results of the file attributes of multiple files without caching the file attributes of files, counting and summarizing the file attributes of each file, thereby reducing the consumption of memory resources and computing resources.
[0061] The file query method provided by this application is described in detail below with reference to the accompanying drawings.
[0062] In this application, a client queries the attributes of a file stored in a target directory on a server. Application scenarios include, but are not limited to, querying file attributes under NAS, SMB, or NFS. For example, both the client and the server can have NAS, SMB, or NFS application software installed, and the client can remotely access files stored on the server over the network to obtain file attributes.
[0063] FIG2 is a schematic diagram of the structure of a communication system provided by the present application. As shown in FIG2 , the communication system 200 includes a client 210 , a server 220 , and a network 230 .
[0064] Depending on the application scenario, client 210 can be a NAS client, an SMB client for a Windows operating system, or an NFS client for a Linux or Unix operating system. Client 210 can send a file query request to server 220 via network 230, which can be the Internet, a local area network, or other networks. The file query request is used to indicate the file attributes of the target directory to be queried. For example, the file query request is used to indicate the file attributes of the files within the file organization structure of the target directory to be queried. The format of the file query request can be set based on the NAS protocol, the SMB protocol, or the NFS protocol.
[0065] Server 220 can be deployed in a cluster. The server cluster may include, but is not limited to, a computing cluster and a storage cluster. Servers in a computing cluster may also be referred to as computing nodes, and servers in a storage cluster may also be referred to as storage nodes. Depending on the application scenario, server 220 may be a NAS server, an SMB server for a Windows operating system, or an NFS server for a Linux or Unix operating system. Server 220 may receive file query requests sent by client 210 via network 230 and provide resource services for client 210's requests, such as providing functions and interfaces for querying file attributes, thereby obtaining the file attributes of a target directory, and sending the file attributes of the target directory to client 210.
[0066] Here, client 210 and server 220 may refer to computer devices connected to a network. When acting as client 210, the computer device may include a computer chassis, a display screen, and a keyboard, and may also include other components, such as a hard drive, an optical drive, a power supply, a cooling system, and other input / output controllers and interfaces. When acting as server 220, the computer device may include a computer chassis and may also include other components, such as a hard drive, a power supply, a cooling system, and other input / output controllers and interfaces.
[0067] Next, the file query method provided by this application is described in detail with reference to Figures 3 to 6. Figure 3 is a schematic flow chart of a file query method provided by this application. This description primarily uses the example of client 210 sending a file query request and receiving the file attributes of a target directory from server 220 in Figure 2. As shown in Figure 3, the method may include the following steps.
[0068] Step 310: The client 210 sends a file query request.
[0069] Client 210 sends a file query request to server 220. The file query request can be used to indicate the file attributes of the target directory to be queried. The target directory can be a root directory, such as a disk directory, or any subdirectory contained in the root directory, such as a subdirectory contained in the next level of the disk directory. The file attributes of the target directory can be used to indicate the file organizational structure attributes of the target directory. The attributes can be some descriptive information about the file, including at least one of size, occupied space, number, type, location, or creation time. Here, size can refer to the actual file storage space, and occupied space can refer to the size of the disk space occupied by the file. The value of the disk space occupied by the file can be greater than the value of the file storage space.
[0070] In some embodiments, the target directory may contain files, or files and folders, and the folders may further contain files and subfolders. The file organization structure of the target directory may indicate the logical structure of the files contained in the target directory. Alternatively, the file organization structure of the target directory may also indicate the logical structure of the folders and the logical structure of the files contained in the target directory.
[0071] Due to the different file organization structures of the target directory, the file attributes of the target directory may be different. For example, the file attributes of the target directory may include at least one of the attributes of the target directory, the file attributes of the files contained in the target directory, or the folder attributes of the folders contained in the target directory.
[0072] Optionally, the properties of the target directory may include the total size, total occupied space, total number of files, total number of folders, file types, etc. of all files and folders contained in the target directory.
[0073] Optionally, the file attributes of the files contained in the target directory may include the size, occupied space, type, etc. of each file; or, the size and occupied space of each file may be aggregated to obtain the size and occupied space of all files.
[0074] Optionally, the folder properties of the folders in the target directory may include the size of each folder, the space occupied, the number of files contained or the number of subfolders contained, etc.; or, the size, space occupied, the number of files contained or the number of subfolders contained in each folder may be summarized to obtain the total size of all folders, the total space occupied, the total number of files contained in all folders or the total number of subfolders contained.
[0075] Since the file query request can be used to indicate a query for the file attributes of the target directory, the file query request may include at least one attribute parameter of a directory, file, or folder. The attribute parameter may include at least one of size, occupied space, quantity, location, creation time, or file type. Among them, size, occupied space, and quantity can be used as important conventional attribute parameters. Location and creation time can be used as secondary conventional attribute parameters. File type can be used as a type attribute parameter, and the file type may include at least one of document, table, image, video, audio, etc. For example, documents include Word documents, PDF documents, etc. Tables include Excel tables, etc. Images include RGB images, PNG images, etc.
[0076] In some embodiments, the attribute parameters of a directory may include size, occupied space, number of files contained, number of folders contained, location, creation time, file type, etc. The attribute parameters of a file may include size, occupied space, location, creation time, file type, etc. The attribute parameters of a folder may include size, occupied space, number of files contained, location, creation time, etc.
[0077] Step 320: The server 220 receives the file query request.
[0078] The server 220 receives the file query request sent by the client 210 and obtains the file attributes of the target directory based on the attribute parameters of at least one of the directory, file or folder to be queried included in the file query request. The specific implementation method is described in the following step 330.
[0079] Step 330: The server 220 obtains the file attributes of the target directory according to the file query request.
[0080] Because multiple clients can send file query requests to the same server, the file query request may also include a checksum, which includes at least one of a client identifier and a restart verification identifier. The client identifier can be used to uniquely identify the client, such as by using the query_id identifier to represent the client identifier. The restart verification identifier can be used to indicate whether the client has been restarted, such as by using the verifier identifier to represent the restart verification identifier.
[0081] In some embodiments, the file query request may be a file query command. The format of the file query command is configured based on a file access protocol, such as SMB, NFS, or NAS. Server 220 may obtain file attributes of the target directory based on the file query command. For details on the format of the file query command, see the examples in the subsequent embodiments.
[0082] In other embodiments, to facilitate counting and organizing files by file type, the file query request may also include a file type identifier. For example, to query the file attributes of all video files in a target directory, the file query request may be used to instruct the server to query the size, occupied space, number, etc. of all video files in the target directory based on the video file type.
[0083] After obtaining the file attributes of the target directory, the server 220 may send the file attributes of the target directory to the client 210 in the form of a message, and the client 210 receives the file attributes of the target directory as the attribute result.
[0084] Step 340: The server 220 sends the file attributes of the target directory.
[0085] Step 350: The client 210 receives the file attributes of the target directory.
[0086] Optionally, after the client 210 receives the file attributes of the target directory sent from the server, in order to enable the user to clearly and obviously know the file attributes of the queried target directory, the interface of the client 210 can display the file attributes of the target directory. Figure 4 is a schematic diagram of an interface for displaying the file attributes of a target directory provided by the present application. As shown in Figure 4, taking the target directory as a folder under the C drive directory as an example, after the client 210 receives the file attributes of the target directory, its interface can display the file attributes of this folder, such as type, location, size, occupied space, number of files contained, number of folders contained, and creation time. The interface also includes "OK", "Cancel" and "Close" buttons.
[0087] The file attributes of a target directory can include the file attributes of multiple files within the target directory. Compared to requiring the client to send a file query request for each file, the file query method provided in this application requires the client to send a single file query request, indicating a query for the file attributes of multiple files within the target directory, and then receive the attribute results for multiple files within the target directory, improving file query efficiency. The query request and attribute results are transmitted only once across the network, reducing network bandwidth overhead.
[0088] In addition, compared to the client caching the file attributes of files and counting the file attributes of multiple files, the file query method provided by this application allows the client to receive the statistical results of the file attributes of multiple files without caching the file attributes of files, counting and summarizing the file attributes of each file, thereby reducing the consumption of memory resources and computing resources.
[0089] The following example explains the process of obtaining the file attributes of the target directory based on a file query request.
[0090] For example, to obtain the total space occupied by all files and folders in the target directory, the total number of folders, and the total number of files based on a file query request, the format of the file query command in the file query request based on the NAS protocol is PATH_INFO. For example, the parameters of PATH_INFO may include:
[0091] Steps 310 to 350 described above primarily describe the process by which client 210 sends a file query request and receives and displays the file attributes of the target directory. In some embodiments, to avoid excessive waiting time for client 210 to receive the file attribute results, client 210 can send the file query request synchronously or asynchronously. Specifically, the file attribute query method can include either synchronous or asynchronous query. The following describes these two query methods in conjunction with the parameters of the file query command.
[0092] The synchronous query mode may mean that the client 210 sends a current file query request to the server 220 , and waits for the server 220 to return a file attribute result before sending a subsequent file query request to the server 220 .
[0093] Figure 5 is a schematic diagram of the process of a synchronous query method provided by this application. As shown in Figure 5, the client sends the request parameters for the file query, and the value of isSync in the request parameter Path_info is true, indicating the synchronous query method. During the initial query, the value of query_id and the value of verifier in Path_info are both set to the initial value, which can be 0. For example, the client sends Path_info(query_id=0; verifier=0; isSync=true) (step 510).
[0094] If the server completes the query within the time threshold, it parses the values of Dir_space_total, Dir_subdir_total, and Dir_subfile_total in Path_info_ok, obtains the file attributes of the target directory, and returns the file attribute results to the client (step 520).
[0095] If the server cannot complete the query within the time threshold, to avoid the client waiting too long to receive the file attribute results, the server caches the query_id and verfier, sets the error code to NFS4_PENDING, and returns the query_id, verf and error code NFS4_PENDING to the client (step 530).
[0096] After the client receives the error code NFS4_PENDING, it triggers the client to continue sending the file query request parameter Path_info (step 540). Path_info includes query_id and verfier. After the server receives the file query command Path_info, it matches the received query_id value with the cached query_id value, and matches the received verfier value with the cached verfier value. If the match is successful, the server has completed the file attribute query of the target directory and returns the file attribute result to the client.
[0097] The asynchronous query method may refer to client 210 sending a subsequent file query request after sending the current file query request to server 220, without having to wait for server 220 to return the file attribute result corresponding to the current request before sending the subsequent request. After server 220 finds the file attribute result of the target directory, it returns the file attribute result to the client.
[0098] Figure 6 is a schematic diagram of the process of an asynchronous query method provided by this application. As shown in Figure 6, the client sends the request parameter Path_info for the file query, and the value of isSync in the request parameter Path_info is set to false, indicating an asynchronous query method. During the initial query, the value of query_id and the value of verifier in Path_info are both set to initial values, which can be 0. That is, the client sends Path_info(query_id=0; verifier=0; isSync=false) (step 610).
[0099] The server caches query_id and verfier, sets error code to NFS4_PENDING, and returns query_id, verfier and error code NFS4_PENDING to the client.Then the server continues to query file attributes (step 620).
[0100] After the client receives the error code NFS4_PENDING, it starts asynchronous message reception. After the server completes the file attribute query, it returns an asynchronous message CB_NOTIFY_PATH_INFO to the client. The parameters in this message body include query_id, verifier, and file attribute results (step 630).
[0101] After receiving the asynchronous message, the client matches the query_id value in the message body with the query_id value in the previously sent Path_info, and matches the verfier value in the message body with the verfier value in the previously sent Path_info (step 640). If both the query_id value and the verfier value match successfully, the file attribute result returned by the server is correct. If the query_id value matches, but the verfier value does not match, the file attribute result returned by the server is incorrect, and the client can send the file query request again. If the client does not receive the asynchronous message, it temporarily stops sending the file query request.
[0102] The parameters of the asynchronous message CB_NOTIFY_PATH_INFO may include:
[0103] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of method. It is understandable that in order to implement the above functions, the computer device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0104] The above describes in detail the file query method provided according to the embodiment of the present application in conjunction with Figures 3 to 6. The following describes the file query device provided according to the embodiment of the present application in conjunction with Figures 7 and 8.
[0105] Figure 7 is a schematic diagram of the structure of a file query device provided by the present application. These file query devices can be used to implement the functions of the client in the above method embodiments, and thus can also achieve the beneficial effects possessed by the above method embodiments.
[0106] As shown in FIG. 7 , the file query device 700 includes a processing module 710 , a communication module 720 , a display module 730 and a storage module 740 .
[0107] The processing module 710 is used to generate a file query request.
[0108] The communication module 720 is used to send a file query request, which is used to indicate the file attributes of the target directory to be queried, and the file attributes of the target directory are used to indicate the file organization structure attributes of the target directory. For example, the communication module 720 is used to execute step 310 in FIG.
[0109] The communication module 720 is further configured to receive the file attributes of the target directory. For example, the communication module 720 is configured to execute step 350 in FIG3 .
[0110] Optionally, the file query device 700 further includes a display module 730 and a storage module 740 .
[0111] The display module 730 is used to display the file attributes of the target directory.
[0112] The storage module 740 may correspond to the method embodiment described above and be used to store file query requests and file attributes of the target directory.
[0113] Figure 8 is a schematic diagram of the structure of another file query device provided by the present application. These file query devices can be used to implement the functions of the server in the above method embodiment, and thus can also achieve the beneficial effects possessed by the above method embodiment.
[0114] As shown in FIG. 8 , the file query device 800 includes a communication module 810 , a query module 820 and a storage module 830 .
[0115] The communication module 810 is used to receive a file query request, the file query request is used to indicate the file attributes of the target directory to be queried, and the file attributes of the target directory are used to indicate the file organization structure attributes of the target directory. For example, the communication module 810 is used to execute step 320 in Figure 3.
[0116] The query module 820 is used to obtain the file attributes of the target directory according to the file query request. For example, the query module 820 is used to execute step 330 in FIG3 .
[0117] The communication module 810 is further configured to send the file attributes of the target directory. For example, the communication module 810 is configured to execute step 340 in FIG3 .
[0118] Optionally, the file query device 800 further includes a storage module 830. The storage module 830 may correspond to the file attributes of the target directory in the above method embodiment.
[0119] It should be understood that the file query device 700 and the file query device 800 according to the embodiments of the present application can correspond to executing the methods described in the embodiments of the present application, and the above-mentioned and other operations and / or functions of each unit in the file query device 700 and the file query device 800 are respectively for implementing the corresponding processes of each method in Figure 3. For the sake of brevity, they will not be repeated here.
[0120] FIG9 is a schematic diagram of the structure of a computer device provided in this embodiment. As shown in FIG9 , computer device 900 includes a processor 910, a bus 920, a memory 930, a memory unit 950 (also referred to as a main memory unit), and a communication interface 940. Processor 910, memory 930, memory unit 950, and communication interface 940 are connected via bus 920.
[0121] It should be understood that in this embodiment, the processor 910 may be a CPU, or may be other general-purpose processors, DSPs, ASICs, FPGAs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0122] Communication interface 940 is used to enable communication between computer device 900 and external devices or components. In this embodiment, when used on a client, communication interface 940 is used to send file query requests and receive file attributes of a target directory. When used on a server, communication interface 940 is used to receive file query requests and send file attributes of a target directory. Optionally, communication interface 940 can also be used to exchange data with other computer devices.
[0123] The bus 920 may include a path for transmitting information between the aforementioned components (e.g., the processor 910, the memory unit 950, and the storage 930). In addition to the data bus, the bus 920 may also include a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as bus 920 in the figure. The bus 920 may be a Peripheral Component Interconnect Express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc.
[0124] As an example, computer device 900 may include multiple processors. The processor may be a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and / or computing units for processing data (e.g., computer program instructions). Processor 910 may implement the functionality of a client, generating a file query request. Alternatively, processor 910 may implement the functionality of a server, obtaining file attributes of a target directory based on the file query request.
[0125] It is worth noting that FIG9 only takes the computer device 900 including one processor 910 and one memory 930 as an example. Here, the processor 910 and the memory 930 are respectively used to indicate a type of device or equipment. In a specific embodiment, the number of each type of device or equipment can be determined according to business requirements.
[0126] Memory unit 950 may correspond to the method embodiment described above for storing file query requests and file attributes of the target directory. Memory unit 950 may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0127] The memory 930 is used to store file query related programs and can be a solid state drive or a mechanical hard drive.
[0128] It should be understood that the computer device 900 according to this embodiment may correspond to the file query device 700 and the file query device 800 in this embodiment, and may correspond to executing the corresponding subjects in Figure 3, and the above-mentioned and other operations and / or functions of each module in the file query device 700 and the file query device 800 are respectively for realizing the corresponding processes in Figure 3. For the sake of brevity, they will not be repeated here.
[0129] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a computer device. Of course, the processor and storage medium can also exist as discrete components in a network device or a terminal device.
[0130] The present application also provides a chip system, which includes a processor for implementing the functions of the data processing unit in the above method. In one possible design, the chip system also includes a memory for storing program instructions and / or data. The chip system can be composed of a chip alone or can include a chip and other discrete devices.
[0131] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is performed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instruction can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD).
[0132] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A file query method, characterized in that: include: Sending a file query request, wherein the file query request is used to indicate a file attribute of a query target directory, and the file attribute of the target directory is used to indicate a file organization structure attribute of the target directory; Receive file attributes of the target directory.
2. A file query method, characterized in that: include: Receiving a file query request, wherein the file query request is used to indicate a file attribute of a query target directory, and the file attribute of the target directory is used to indicate a file organization structure attribute of the target directory; Acquire the file attribute of the target directory according to the file query request; Sends the file attributes of the target directory.
3. The method according to claim 1 or 2, characterized in that: The file query request includes at least one attribute parameter of a directory, a file or a folder.
4. The method according to claim 3, characterized in that The attribute parameter includes at least one of size, occupied space, quantity or file type.
5. The method according to claim 3 or 4, characterized in that: The file attributes of the target directory include at least one of the attributes of the target directory, the file attributes of the files contained in the target directory, or the folder attributes of the folders contained in the target directory.
6. The method according to any one of claims 1 to 5, characterized in that The target directory includes the root directory or any level of subdirectory contained in the root directory.
7. The method according to any one of claims 1 to 6, characterized in that The file query request also includes a verification value, and the verification value includes at least one of a client identifier and a restart verification identifier.
8. The method according to any one of claims 1 to 7, characterized in that The format of the file query request is set based on a file access protocol, and the file access protocol includes any one of a server message block SMB, a network file system NFS, or a network attached storage NAS.
9. The method according to any one of claims 1, 3-8, characterized in that: Send a file query request, including: The file query request is sent in a synchronous manner.
10. The method according to any one of claims 1, 3-8, characterized in that: Send a file query request, including: The file query request is sent in an asynchronous manner.
11. A file query device, characterized in that: The file query device includes a module for executing the operation steps of the method described in any one of claims 1 and 3-10, or a module for executing the operation steps of the method described in any one of claims 2-8.
12. A computer device, characterized in that: It comprises a memory and a processor, wherein the memory is used to store a set of computer instructions; when the processor executes the set of computer instructions, the operation steps of the method described in any one of claims 1 and 3-10 are performed, or the processor is used to execute the operation steps of the method described in any one of claims 2-8.
13. A communication system, characterized in that: The communication system comprises a client and a server, wherein the client is used to execute the operation steps of the method described in any one of claims 1 and 3-10, and the server is used to execute the operation steps of the method described in any one of claims 2-8.
Citation Information
Patent Citations
File query method and device, computer equipment and communication system
CN119271629A
Data interaction method and articulated naturality web system
CN110535829A
Metadata retrieval method and device, storage medium and electronic equipment
CN111858496A
Method for querying metadata, computing equipment and distributed file system
CN113515487A
Query system and device
CN115495412A