File query method and device, computer equipment and communication system

By sending a file query request to obtain multiple file attributes of the target directory, the problems of low file query efficiency and large network bandwidth in the prior art are solved, and query efficiency is improved and resource consumption is reduced.

CN119271629APending Publication Date: 2025-01-07HUAWEI TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310815614.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-04
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

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 excessive consumption of network transmission and memory resources.

Method used

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, reduces the consumption of network transmission and memory resources, and improves the efficiency of file query.

Benefits of technology

It realizes the efficiency of file query and the reduction of network bandwidth, reduces the consumption of memory and computing resources, and is suitable for multi-level directories and file organization structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271629A_ABST
    Figure CN119271629A_ABST
Patent Text Reader

Abstract

The invention discloses a file query method and device, computer equipment and a communication system, and relates to the field of computers. The method comprises the following steps: sending a file query request for indicating to query the file attribute of a target directory to obtain the file attribute of the target directory; wherein the file attribute of the target directory is used for indicating the file organization structure attribute of the target directory. The file attributes of the target directory can comprise file attributes of a plurality of files under the target directory. Compared with the condition that each file client needs to send the file query request, the file query method provided by the invention has the advantages that the client sends the file query request once, the request indicates to query the file attributes of the plurality of files under the target directory and receive the attribute results of the plurality of files under the target directory, and the file query efficiency is improved. And the query request and the attribute result are only transmitted once in the network, so that the overhead of the network bandwidth is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the computer field, and in particular to a file query method, device, computer equipment and communication system. Background Art

[0002] Currently, clients can mount the shared files of the server based on the network file system and remotely access the shared files of the server through the network. For example, the client queries the properties of the files in the server (such as the location and size of the files). Usually, the client first obtains the file list from the server, and then queries the properties of each file in the file list. The more files there are, the more query requests the client needs to send, resulting in low efficiency of file query and high network bandwidth overhead. Summary of the invention

[0003] The present application provides a file query method, device, computer equipment and communication system, which solve the problems of low efficiency of file query and high overhead of network bandwidth.

[0004] In a first aspect, the present application provides a file query method, the method comprising: obtaining the file attributes of a target directory by sending a file query request for 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.

[0005] The file organization structure may include multiple directories, such as subdirectories, first-level subdirectories, second-level subdirectories, etc., and each directory may contain multiple files or folders. The file attributes of the target directory may include the file attributes of multiple files under the target directory. Compared to the need to send a file query request for each file, the file query method provided by the present application requires the client to send a file query request once, which indicates to query the file attributes of multiple files under the target directory, and receive 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.

[0006] In addition, compared with the file attributes of the client cached files and counting the file attributes of multiple files, the file query method provided by the present application allows the client to receive the statistical results of the file attributes of multiple files without the need to cache the file attributes of the files, count and summarize the file attributes of each file, thereby reducing the consumption of memory resources and computing resources.

[0007] In a second aspect, the present application provides a file query method, the method comprising: receiving a file query request for indicating a file attribute of a target directory to be queried. The file attribute of the target directory is used to indicate a file organization structure attribute of the target directory. According to the received file query request, the file attribute of the target directory is obtained. The obtained file attribute of the target directory is sent.

[0008] After receiving the file query request sent by the client, the server can uniformly summarize the size, occupied space, total number of files contained, total number of folders contained, and other attributes of the target directory. 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 perform file attribute query operations on multiple files, which replaces the client performing file attribute query operations on each file in the target directory, thereby improving file query efficiency.

[0009] In a possible implementation, the file query request includes at least one attribute parameter of a directory, a file, or a folder.

[0010] In another possible implementation, the attribute parameter includes at least one of size, occupied space, quantity, or file type.

[0011] The file query request can satisfy different query granularities. The query granularities included in the file query request are different, and the attribute parameters of each level of query granularity are also different. The attribute parameters of a directory may include size, space occupied, number of files contained, number of folders contained, location, creation time, file type, etc. The attribute parameters of a file may include size, space occupied, location, creation time, file type, etc. The attribute parameters of a folder may include size, space occupied, number of files contained, location, creation time, etc.

[0012] In another possible implementation, 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. The target directory may contain only files, or files and folders, and the folders may also contain files and subfolders. According to the requirements of the query granularity, the attributes of all files and all 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.

[0013] In another possible implementation, the target directory includes a root directory or any level of subdirectories contained in the root directory.

[0014] In another possible implementation, the file query request also includes a check value, and the check value includes a client identifier and a restart verification identifier. The client identifier can be used to uniquely indicate the client, and the restart verification identifier can be used to indicate whether the client has been restarted. Since multiple clients can send file query requests to the same server, the server verifies each client according to the check value in the file query request to ensure the uniqueness of the file query request sent by the client.

[0015] In another possible implementation, sending the file query request includes: sending the file query request in a synchronous manner.

[0016] In another possible implementation, sending the file query request includes: sending the file query request in an asynchronous manner.

[0017] In order to avoid a long waiting time for receiving file attribute results, the client can send a file query request in a synchronous or asynchronous manner. In the case of a synchronous query request, the server can feedback the file attribute results within the time threshold to save the client's waiting time. In the case of an asynchronous query request, the client sends a subsequent file query request 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. The server sends the file attribute results to the client after completing the file attribute query.

[0018] In another possible implementation, 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). The format of the file query request is set based on the file access protocol, which complies with the design standard of the Internet Engineering Task Force (IETF). The standard file query request format can be compatible with querying file attributes in different types of storage devices.

[0019] In another possible implementation, the method further includes: displaying the file attributes of the target directory. By displaying the file attribute results through the client interface, the user can clearly and obviously know the file attributes of the queried target directory, which is convenient for the user to organize the structure of the target directory and sort out the files contained in the target directory.

[0020] In a third aspect, the present application provides a file query device, the device comprising a processing module and a communication module. The processing module is used to generate a file query request; the communication module is used to send the file query request, the file query request is used to indicate the file attributes of the query target directory, the file attributes of the target directory are used to indicate the file organization structure attributes of the target directory, and the communication module is also used to receive the file attributes of the target directory;

[0021] In a fourth aspect, the present application provides a file query device, the device comprising a communication module and a query module. The communication module is used to receive a file query request, the file query request is used to indicate the file attributes of the query target directory, the file attributes of the target directory are used to indicate the file organization structure attributes of the target directory; the query module is used to obtain the file attributes of the target directory according to the file query request; the communication module is also used to send the file attributes of the target directory.

[0022] In a possible implementation, the file query request includes at least one attribute parameter of a directory, a file, or a folder.

[0023] In another possible implementation, the attribute parameter includes at least one of size, occupied space, quantity, or file type.

[0024] In another possible implementation, 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.

[0025] In another possible implementation, the target directory includes a root directory or any level of subdirectories contained in the root directory.

[0026] 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.

[0027] 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.

[0028] 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.

[0029] 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.

[0030] In another possible implementation, the apparatus further includes a display module configured to display file attributes of the target directory.

[0031] In a fifth aspect, the present application provides a computer device, the computer device comprising a processor and a memory, the memory being used to store a set of computer instructions; when the processor executes the set of computer instructions as an execution device in the first aspect or any possible implementation of the first aspect, the operation steps of the file query method in the first aspect or any possible implementation of the first aspect are executed. Alternatively, when the processor executes the set of computer instructions as an execution device in the second aspect or any possible implementation of the second aspect, the operation steps of the file query method in the second aspect or any possible implementation of the second aspect are executed.

[0032] In a sixth aspect, the present application provides a communication system, the communication system comprising a client and a plurality of servers, wherein the client is used to execute the operation steps of the file query method in the first aspect or any possible implementation of the first aspect; and the server is used to execute the operation steps of the file query method in the second aspect or any possible implementation of the second aspect.

[0033] 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 operation 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 a computing device, the computer device executes the operation steps of the file query method in the second aspect or any possible implementation of the second aspect.

[0034] In an eighth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer device to execute the operation steps of the file query method in the first aspect or any possible implementation of the first aspect. Alternatively, when executed on a computer, enables the computer device to execute the operation steps of the file query method in the second aspect or any possible implementation of the second aspect.

[0035] The technical effects brought about by any design method in the third aspect to the eighth aspect 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.

[0036] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A schematic diagram of a file query method provided by the prior art;

[0038] Figure 2A schematic diagram of the structure of a communication system provided for this application;

[0039] Figure 3 A flowchart of a file query method provided by this application;

[0040] Figure 4 A schematic diagram of an interface for displaying file attributes of a target directory provided by this application;

[0041] Figure 5 A process diagram of a synchronous query method provided by this application;

[0042] Figure 6 A schematic diagram of an asynchronous query process provided by this application;

[0043] Figure 7 A schematic diagram of the structure of a file query device provided by this application;

[0044] Figure 8 A schematic diagram of the structure of another file query device provided by the present application;

[0045] Fig. 9 A schematic diagram of the structure of a computer device provided in this application. DETAILED DESCRIPTION

[0046] A file refers to a piece of data stored in a computer using a computer hard disk as a carrier.

[0047] A folder refers to a data structure used to organize and manage files. A folder can contain at least one file. Folders can be nested, that is, a folder can contain at least one subfolder. The nesting function of folders can be used to classify and store files for easy search and management.

[0048] File Organization Structure refers to the logical structure of a file. The file organization structure may include multiple directories, such as sub-directories, first-level sub-directories, second-level sub-directories, etc. Each directory may contain multiple files or folders.

[0049] Network File System (NFS) is a file sharing protocol in a distributed file system, which enables computers with different operating systems (such as Linux, UNIX, and Windows) to share data through the network. Accessing files on remote computers on the network is like accessing files on a local computer, thus achieving fast and reliable file sharing services. That is, by mounting the file directory of the remote computer on the local directory of the local computer, the files of the remote computer can be accessed by accessing the local directory.

[0050] Network Attached Storage (NAS) refers to a data storage device that is connected to the network and has storage functions. NAS is data-centric, manages data in a centralized manner, and provides file services.

[0051] Mounting means connecting the directory of the remote computer to the subdirectory under the root directory of the local computer. Accessing the subdirectory of the local computer is equivalent to accessing the contents of the directory of the remote computer. The subdirectory under the root directory of the local computer can be an empty directory. The subdirectory name of the local computer can be the same as the name of the directory mounted on the remote computer.

[0052] Mounting is very common in the Linux operating system. It connects the top-level directory in the files in 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 in the storage device.

[0053] The client can obtain the file attributes (such as the file location on the disk, file size, file type, etc.) by querying. The file attributes can help users find and organize files conveniently. For example, the NAS client mounts the shared files of the NAS server based on NFS and remotely queries the attributes of the files in the NAS server through the network.

[0054] Typically, the client first obtains a file list from the server, where the file list includes multiple files, and then queries the properties of each file in the file list. Figure 1 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, querying that 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 needs to execute the following Figure 1The operation shown is as follows: The client sends a file attribute 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 attribute results of each file to the client, such as the size of each file. The client can first summarize the attribute results of each file to obtain the attribute results of the subfolder, such as the size of the subfolder and the number of files contained in the subfolder. Then summarize the attribute results of each subfolder to obtain the attribute 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.

[0055] However, the more files a folder contains, the more file attribute query operations the client sends to the server, and the more attribute results the client receives from the server, resulting in low efficiency in file query. A large number of query requests and attribute results are transmitted in the network, resulting in high network bandwidth overhead. In addition, during the query process, the client needs to cache the attribute results of each file in the file list, resulting in high consumption of memory resources. The client also needs to count and summarize the attribute results of each file, resulting in high consumption of computing resources.

[0056] In order to solve the problems of low efficiency of file query and high network bandwidth overhead, the present application provides a file query method, that is, obtaining the file attributes of the target directory by sending a file query request for indicating the file attributes of the target directory to be queried. The file attributes of the target directory are used to indicate the file organization structure attributes of the target directory.

[0057] The file attributes of the target directory may include the file attributes of multiple files under the target directory. Compared to the case where the client needs to send a file query request for each file, the file query method provided by the present application requires the client to send a file query request once, which indicates to query the file attributes of multiple files under the target directory, and receive the attribute results of multiple files under the target directory, thereby improving the efficiency of file query. The query request and the attribute results are only transmitted once in the network, thereby reducing the network bandwidth overhead.

[0058] In addition, compared with the file attributes of the client cached files and counting the file attributes of multiple files, the file query method provided by the present application allows the client to receive the statistical results of the file attributes of multiple files without the need to cache the file attributes of the files, count and summarize the file attributes of each file, thereby reducing the consumption of memory resources and computing resources.

[0059] The file query method provided by the present application is described in detail below with reference to the accompanying drawings.

[0060] In this application, the client queries the file attributes stored in the target directory of the server, and the 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 install NAS, SMB or NFS application software, and the client can remotely access the files stored in the server through the network to obtain file attributes.

[0061] Figure 2 This is a schematic diagram of the structure of a communication system provided by this application. Figure 2 As shown, the communication system 200 includes a client 210 , a server 220 , and a network 230 .

[0062] According to different application scenarios, the client 210 can be a NAS client, an SMB client of a Windows operating system, or an NFS client of a Linux operating system or a Unix operating system. The client 210 can send a file query request to the server 220 via a network 230, and the network 230 can be the Internet, a local area network, or other networks. The file query request is used to indicate the file attributes of the query target directory, for example, the file query request is used to indicate the file attributes of the files under the file organization structure of the query target directory. Among them, the format of the file query request can be set based on the NAS protocol, the SMB protocol, or the NFS protocol.

[0063] The server 220 may be deployed in the form of a cluster, and the server cluster may include but is not limited to a computing cluster and a storage cluster. The servers in the computing cluster may also be referred to as computing nodes, and the servers in the storage cluster may also be referred to as storage nodes. Depending on the application scenario, the server 220 may be a NAS server, an SMB server of a Windows operating system, or an NFS server of a Linux operating system or a Unix operating system. The server 220 may receive a file query request sent by the client 210 through the network 230, and provide resource services for the request of the client 210, such as providing a function and interface for querying file attributes, thereby obtaining the file attributes of the target directory, and sending the file attributes of the target directory to the client 210.

[0064] Here, the client 210 and the server 220 may refer to computer devices connected to the network. When the computer device is used as the client 210, it may include a chassis, a display screen and a keyboard, and may also include other components, such as a hard disk, an optical drive, a power supply, a cooling system, and other input-output controllers and interfaces. When the computer device is used as the server 220, it may include a chassis, and may also include other components, such as a hard disk, a power supply, a cooling system, and other input-output controllers and interfaces.

[0065] Next, combine Figures 3 to 6, the file query method provided by this application is described in detail. Figure 3 A flowchart of a file query method provided by this application. Figure 2 The following example illustrates the case where the client 210 sends a file query request and receives the file attributes of the target directory sent by the server 220. Figure 3 As shown, the method may include the following steps.

[0066] Step 310: The client 210 sends a file query request.

[0067] The client 210 sends a file query request to the server 220, and the file query request can be used to indicate the file attributes of the query target directory. The target directory can be a root directory, such as a disk directory, or any level of subdirectory contained in the root directory, such as a next level of subdirectory contained in the disk directory. The file attributes of the target directory can be used to indicate the file organization structure attributes of the target directory. The attributes can be some descriptive information about the file, and the attributes include at least one of size, occupied space, quantity, 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.

[0068] In some embodiments, the target directory may contain files, or files and folders, and the folders may also 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. Optionally, 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.

[0069] 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.

[0070] 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.

[0071] 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 summarized to obtain the size and occupied space of all files.

[0072] 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 are 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.

[0073] Since the file query request can be used to indicate the file attributes of the above-mentioned target directory, the file query request may include at least one attribute parameter of the 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, 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.

[0074] In some embodiments, the attribute parameters of a directory may include size, space occupied, number of files contained, number of folders contained, location, creation time, file type, etc. The attribute parameters of a file may include size, space occupied, location, creation time, file type, etc. The attribute parameters of a folder may include size, space occupied, number of files contained, location, creation time, etc.

[0075] Step 320: The server 220 receives a file query request.

[0076] The server 220 receives the file query request sent by the client 210, and obtains the file attribute of the target directory according to the attribute parameter 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.

[0077] Step 330: The server 220 obtains file attributes of the target directory according to the file query request.

[0078] Since multiple clients can send file query requests to the same server, the file query request may also include a verification value, which includes at least one of a client identifier and a restart verification identifier. The client identifier may be used to uniquely indicate the client, such as using a query_id identifier to indicate the client identifier. The restart verification identifier may be used to indicate whether the client has been restarted, such as using a verifier identifier to indicate the restart verification identifier.

[0079] In some embodiments, the file query request may be a file query command, the format of which is set based on a file access protocol, which may include any one of SMB, NFS, or NAS. The server 220 may obtain the file attributes of the target directory according to the file query command. The format of the file query command may refer to the examples in the subsequent embodiments.

[0080] In other embodiments, in order to facilitate the counting and sorting of files according to file types, the file query request may also include a file type identifier. For example, the file attributes of all video files in the target directory are queried. The file query request may be used to instruct the server to query the size, occupied space, quantity, etc. of all video files in the target directory based on the video file type.

[0081] After the server 220 obtains the file attributes of the target directory, it can 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. The communication process includes steps 340 to 350.

[0082] Step 340: The server 220 sends the file attributes of the target directory.

[0083] Step 350: The client 210 receives the file attributes of the target directory.

[0084] Optionally, after the client 210 receives the file attributes of the target directory sent from the server, in order to allow the user to clearly and obviously know the file attributes of the queried target directory, the interface of the client 210 may display the file attributes of the target directory. Figure 4 This is a schematic diagram of an interface for displaying the file attributes of a target directory provided by this application. Figure 4 As shown, taking the target directory as a folder in 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 included files, number of included folders, and creation time. The interface also includes "OK", "Cancel" and "Close" buttons.

[0085] The file attributes of the target directory may include the file attributes of multiple files under the target directory. Compared to the case where the client needs to send a file query request for each file, the file query method provided by the present application requires the client to send a file query request once, which indicates to query the file attributes of multiple files under the target directory, and receive the attribute results of multiple files under the target directory, thereby improving the efficiency of file query. The query request and the attribute results are only transmitted once in the network, thereby reducing the network bandwidth overhead.

[0086] In addition, compared with the file attributes of the client cached files and counting the file attributes of multiple files, the file query method provided by the present application allows the client to receive the statistical results of the file attributes of multiple files without the need to cache the file attributes of the files, count and summarize the file attributes of each file, thereby reducing the consumption of memory resources and computing resources.

[0087] The following example explains the process of obtaining the file attributes of the target directory based on the file query request.

[0088] Taking the total occupied space of all files and folders contained in the target directory, the total number of folders, and the total number of files as an example, the format of the file query command in the file query request based on the NAS protocol setting is PATH_INFO. For example, the parameter content of PATH_INFO may include:

[0089] Request parameters:

[0090] Path_info{

[0091] bool isSync; / / Used to indicate the query mode.

[0092] Long query_id; / / Used to uniquely indicate the client identity.

[0093] verifier4 verfier; / / Used to indicate whether the client has been restarted.

[0094] };

[0095] Return parameter:

[0096] Path_info_ok{

[0097] Long Dir_space_total; / / Used to obtain the total space occupied by the folders and files contained in the target directory.

[0098] Long Dir_subdir_total; / / Used to obtain the total number of folders contained in the target directory.

[0099] Long Dir_subfile_total; / / Used to obtain the total number of files contained in the target directory.

[0100] };

[0101] Path_info_pending{

[0102] Long query_id; / / Used to uniquely indicate the client identity.

[0103] Verfier4 verfier; / / Used to indicate whether the client has restarted.

[0104] };

[0105] Union path_info_res switch(nfsstat4 status){

[0106] case NFS4_OK:Path_info_ok resok;

[0107] / / When the value of the expression nfsstat4 statusd corresponds to the constant NFS4_OK, the server executes the content of the code block Path_info_ok corresponding to the constant NFS4_OK.

[0108] case NFS4_PENDING:Path_info_pending res;

[0109] / / When the value of the expression nfsstat4 statusd corresponds to the constant NFS4_PENDING, the server executes the content in the code block Path_info_pending corresponding to the constant NFS4_PENDING.

[0110] default: void; / / When there is no constant equal to the value of the expression nfsstat4 statusd, the server reports an error.

[0111] };

[0112] The above steps 310 to 350 mainly introduce the process of the client 210 sending a file query request, receiving and displaying the file attributes of the target directory. In some embodiments, in order to avoid the client 210 waiting too long for receiving the file attribute result, the client 210 can send the file query request in a synchronous manner, or send the file query request in an asynchronous manner. That is, the method of querying file attributes can include either a synchronous query method or an asynchronous query method. The following introduces these two query methods respectively in combination with the parameter content of the above file query command.

[0113] The synchronous query method may refer to the client 210 sending a current file query request to the server 220 , waiting for the server 220 to return a file attribute result, and then sending a subsequent file query request to the server 220 .

[0114] Figure 5 A schematic diagram of a synchronous query method provided by this application. Figure 5As shown, the client sends the request parameters for file query, and the value of isSync in the request parameter Path_info is true, indicating a synchronous query mode. When querying for the first time, the values ​​of query_id and verifier in Path_info are both set to initial values, which can be 0. For example, the client sends Path_info (query_id = 0; verfier = 0; isSync = true) (step 510).

[0115] 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).

[0116] 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 query_id and verfier, sets the error code to NFS4_PENDING, and returns query_id, verf and error code NFS4_PENDING to the client (step 530).

[0117] After the client receives the error code NFS4_PENDING, it triggers the client to continue to send the request parameter Path_info for file query (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.

[0118] The asynchronous query method may refer to the client 210 sending a subsequent file query request after sending the current file query request to the server 220, without waiting for the server 220 to return the file attribute result corresponding to the current request before sending the subsequent request. After the server 220 queries the file attribute result of the target directory, it returns the file attribute result to the client.

[0119] Figure 6 A schematic diagram of an asynchronous query method provided by this application. Figure 6As shown, the client sends the request parameter Path_info for file query, and the value of isSync in the request parameter Path_info is set to false, indicating an asynchronous query mode. When querying for the first time, 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; verfier = 0; isSync = false) (step 610).

[0120] The server caches query_id and verfier, sets the error code to NFS4_PENDING, and returns query_id, verfier and error code NFS4_PENDING to the client. The server then continues to query file attributes (step 620).

[0121] 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, verfier and file attribute results (step 630).

[0122] After receiving the asynchronous message, the client matches the value of query_id in the message body with the value of query_id in the sent Path_info, and matches the value of verfier in the message body with the value of verfier in the sent Path_info (step 640). If the values ​​of query_id and verfier are matched successfully, the file attribute result returned by the server is correct. If the value of query_id matches, but the value of verfier 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 has not received the asynchronous message, it temporarily stops sending the file query request.

[0123] The parameter content of the asynchronous message CB_NOTIFY_PATH_INFO may include:

[0124] CB_NOTIFY_PATH_INFO{

[0125] Long query_id; / / Used to uniquely indicate the client identity.

[0126] verifier4 verfier; / / Used to indicate whether the client has been restarted.

[0127] Long Dir_space_total; / / Used to obtain the total space occupied by the folders and files contained in the target directory.

[0128] Long Dir_subdir_total; / / Used to obtain the total number of folders contained in the target directory.

[0129] Long Dir_subfile_total; / / Used to obtain the total number of files contained in the target directory.

[0130] };

[0131] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. It is understandable that in order to achieve 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 realize that, in combination with the algorithm steps of each example described in the embodiment 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 the form of hardware or computer software driving hardware 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 the present application.

[0132] Combined with the above Figures 3 to 6 , describes in detail the file query method provided according to the embodiment of the present application, and will be combined with Figure 7 and Figure 8 , describing a file query device provided according to an embodiment of the present application.

[0133] Figure 7 This 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.

[0134] like Figure 7 As shown, the file query device 700 includes a processing module 710 , a communication module 720 , a display module 730 and a storage module 740 .

[0135] The processing module 710 is used to generate a file query request.

[0136] The communication module 720 is used to send a file query request, the file query request is used to indicate the file attributes of the query target directory, and the file attributes of the target directory are used to indicate the file organization structure attributes of the target directory. Figure 3 Step 310.

[0137] The communication module 720 is also used to receive the file attributes of the target directory. For example, the communication module 720 is used to perform Figure 3 Step 350.

[0138] Optionally, the file query device 700 further includes a display module 730 and a storage module 740 .

[0139] The display module 730 is used to display the file attributes of the target directory.

[0140] The storage module 740 may correspond to the method embodiment described above and be used to store file query requests and file attributes of a target directory.

[0141] Figure 8 This 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.

[0142] like Figure 8 As shown, the file query device 800 includes a communication module 810 , a query module 820 and a storage module 830 .

[0143] The communication module 810 is used to receive a file query request, the file query request is used to indicate the file attribute of the target directory to be queried, and the file attribute of the target directory is used to indicate the file organization structure attribute of the target directory. Figure 3 Step 320.

[0144] 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 Figure 3 Step 330.

[0145] The communication module 810 is also used to send the file attributes of the target directory. For example, the communication module 810 is used to perform Figure 3 Step 340.

[0146] 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.

[0147] It should be understood that the file query device 700 and the file query device 800 according to the embodiment of the present application may correspond to the method described in the embodiment of the present application, and the above 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 Figure 3 For the sake of brevity, the corresponding processes of each method in are not repeated here.

[0148] Fig. 9 A schematic diagram of the structure of a computer device provided in this embodiment. Fig. 9 As shown, the 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. The processor 910, the memory 930, the memory unit 950, and the communication interface 940 are connected via the bus 920.

[0149] It should be understood that in this embodiment, the processor 910 may be a CPU, and the processor 910 may also 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.

[0150] The communication interface 940 is used to implement communication between the computer device 900 and an external device or device. In this embodiment, when the communication interface 940 is applied to the client, it is used to send a file query request and receive the file attributes of the target directory. When the communication interface 940 is applied to the server, it is used to receive the file query request and send the file attributes of the target directory. Optionally, the communication interface 940 can also be used to exchange data with other computer devices.

[0151] The bus 920 may include a path for transmitting information between the above components (such as the processor 910, the memory unit 950, and the memory 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, or 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.

[0152] As an example, the computer device 900 may include multiple processors. The processor may be a multi-core (multi-CPU) processor. The processor here may refer to one or more devices, circuits, and / or computing units for processing data (e.g., computer program instructions). The processor 910 may implement the function of a client to generate a file query request. Alternatively, the processor 910 may implement the function of a server to obtain the file attributes of a target directory according to the file query request.

[0153] It is worth mentioning that Fig. 9 In the example, a computer device 900 including a processor 910 and a memory 930 is taken 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.

[0154] The memory unit 950 may correspond to the file attributes for storing the file query request and the target directory in the above method embodiment. The memory unit 950 may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, 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 dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0155] The memory 930 is used to store file query related programs and can be a solid state drive or a mechanical hard disk.

[0156] 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 the computer device 900 according to the embodiment. Figure 3 The above and other operations and / or functions of the modules in the file query device 700 and the file query device 800 are respectively implemented Figure 3 For the sake of brevity, the corresponding process in will not be repeated here.

[0157] 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 ROM (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 a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a computer device. Of course, the processor and the storage medium can also exist as discrete components in a network device or a terminal device.

[0158] 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, or can include a chip and other discrete devices.

[0159] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may 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 may 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 may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, for example, a floppy disk, a hard disk, a tape; it may also be an optical medium, for example, a digital video disc (DVD); it may also be a semiconductor medium, for example, a solid state drive (SSD).

[0160] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A file 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

Cited By

  • File query method and apparatus, computer device, and communication system

    EP4722935A1

  • File query method and apparatus, computer device, and communication system

    WO2025007535A1