CN116775570A - Information query method and device and computer equipment - Google Patents

Information query method and device and computer equipment Download PDF

Info

Publication number
CN116775570A
CN116775570A CN202310547959.6A CN202310547959A CN116775570A CN 116775570 A CN116775570 A CN 116775570A CN 202310547959 A CN202310547959 A CN 202310547959A CN 116775570 A CN116775570 A CN 116775570A
Authority
CN
China
Prior art keywords
target file
information
target
file
related information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310547959.6A
Other languages
Chinese (zh)
Inventor
杨斌
李兆龙
宫凤明
马照云
季旻
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dawning Information Industry Co Ltd
Original Assignee
Dawning Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dawning Information Industry Co Ltd filed Critical Dawning Information Industry Co Ltd
Priority to CN202310547959.6A priority Critical patent/CN116775570A/en
Publication of CN116775570A publication Critical patent/CN116775570A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to an information query method, an information query device and computer equipment. The method comprises the following steps: and acquiring a query command input by a user, and reading the related information of the first target file corresponding to the query command from the related information of the batch files stored in advance in the local cache. The method aims at the distributed storage system, when the terminal is used for reading batch files, the related information of the required files can be directly read from the local cache of the terminal, the terminal is not required to send query instructions corresponding to each file to the storage server, and the data of the memory or the disk on the storage server is not required to be read, namely the data cannot be influenced by the time delay of network transmission data in the distributed storage system and the time consumption of reading the data on the memory or the disk, so that the query efficiency of the file information is greatly improved.

Description

Information query method and device and computer equipment
Technical Field
The present application relates to the field of file processing technologies, and in particular, to an information query method, an information query device, and a computer device.
Background
With the development of network technology, the distributed file system is widely applied to file, data and information storage in various technical fields.
Currently, users perform file querying, transmitting, and reading by logging into hosts in a distributed file system. In the existing file related information query process, a host in a distributed file system sends a query request to a corresponding storage server, and the storage server transmits the file related information queried by the host back to the host through a network so that the host obtains the queried information.
However, when the method is used for inquiring a large number of files, the inquiry efficiency is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an information query method, apparatus, and computer device that can improve query efficiency.
In a first aspect, the present application provides an information query method. The method comprises the following steps:
acquiring a query command input by a user;
reading the related information of a first target file corresponding to the query command from the related information of batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to the query command of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
According to the information query method provided by the embodiment of the application, aiming at the distributed storage system, when the terminal is faced with the reading of batch files, the related information of the required files can be directly read from the local cache of the terminal, the terminal is not required to send query instructions corresponding to each file to the storage server, and the data of the memory or the disk on the storage server is not required to be read, namely the time delay of network transmission data in the distributed storage system and the time consumption of data reading on the memory or the disk are not required to be greatly influenced, so that the query efficiency of the file information is greatly improved.
In one embodiment, reading the related information of the target file corresponding to the query command from the related information of the batch file stored in the local cache includes:
extracting a target identifier of a first target file from the query command;
and determining the related information of the first target file corresponding to the target identifier from the related information of the batch files stored in the local cache in advance according to the type of the first target file.
According to the method for reading the related information of the first target file, the information is searched from the local cache through the type of the first target file and the target identifier of the first target file, so that the searching range can be reduced, and the information searching efficiency is improved.
In one embodiment, according to the type of the target file, determining the related information of the target file corresponding to the target identifier from the related information of the batch file stored in advance in the local cache includes:
according to the type of the target file, determining a storage area corresponding to the type from a local cache;
and determining the related information of the first target file corresponding to the target identifier from the storage area corresponding to the type.
According to the method for reading the related information of the first target file, the storage area can be rapidly positioned according to the type of the first target file, so that the searching range is reduced, related information searching is performed on the basis of the storage area after the range is reduced according to the target identification of the first target file, and the information searching efficiency can be improved.
In a second aspect, the application further provides an information query method. The method comprises the following steps:
receiving a query request of a second target file sent by a terminal;
according to the query request of the second target file, reading the related information of the batch files corresponding to the query request; the batch file comprises a second target file and a plurality of files related to the second target file;
and returning the related information of the batch files corresponding to the query request to the terminal so as to instruct the terminal to store the related information of the corresponding batch files in the local cache.
According to the information query method provided by the embodiment of the application, in a distributed storage system, the storage server feeds back the related information of the batch files to the terminal in advance, so that the terminal can store the related information of the batch files in the local cache in advance, and when the related information of the batch files is queried next time, particularly when the related information of the batch files is queried, the related information of each file can be directly read from the local cache of the terminal, a query instruction is not required to be sent to the storage server by the terminal, and the data of a memory or a magnetic disk on the storage server is not required to be read, namely the data transmission delay of a network in the distributed storage system and the time consumption of the data reading on the memory or the magnetic disk are not greatly influenced, so that the query efficiency of the file information is greatly improved.
In one embodiment, according to a query request of the second target file, reading related information of a batch of files corresponding to the query request includes:
determining the position information of the second target file stored locally according to the query request of the second target file;
determining a target position according to the position information of the second target file on the local storage; the target position is adjacent to the position of the second target file;
And reading the position of the second target file and the related information of the files at the target position as the related information of the batch files.
According to the embodiment of the application, the related information containing the second target file and the related information of the files adjacent to the second target file are returned to the terminal as the related information of the batch files, so that information support is provided for the related information of the next file inquiry of the terminal, and the file information inquiry efficiency is improved.
In one embodiment, the method further comprises:
determining directory information of a second target file;
determining the target location according to the location information of the second target file on the local storage includes:
and determining the target position according to the position information of the second target file on the local storage and the directory information of the second target file.
According to the embodiment of the application, the related information containing the second target file and the related information of the files which are adjacent to the second target file and belong to the same father catalog are returned to the terminal as the related information of the batch files, so that information support is provided for the related information of the next file inquiry of the terminal, and the file information inquiry efficiency is improved.
In one embodiment, determining the target location based on the location information of the second target file on the local storage and the directory information of the second target file includes:
Determining candidate positions according to the position information of the second target file on the local storage; the candidate position is adjacent to the position where the second target file is located;
and determining the candidate position matched with the directory information of the second target file as the target position.
According to the embodiment of the application, the related information containing the second target file and the related information of the files which are adjacent to the second target file and belong to the same father catalog are returned to the terminal as the related information of the batch files, so that information support is provided for the related information of the next file inquiry of the terminal, and the file information inquiry efficiency is improved.
In a third aspect, the application further provides an information query device. The device comprises:
the acquisition module is used for acquiring a query command input by a user;
the reading module is used for reading the related information of the first target file corresponding to the query command from the related information of the batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to the query request of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
In a fourth aspect, the application also provides an information query device. The device comprises:
the receiving module is used for receiving a query request of the second target file sent by the terminal;
the reading module is used for reading the related information of the batch files corresponding to the query request according to the query request of the second target file; the batch file comprises a second target file and a plurality of files related to the second target file;
and the indication module is used for returning the related information of the batch files corresponding to the query request to the terminal so as to indicate the terminal to store the related information of the corresponding batch files in the local cache.
In a fifth aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring a query command input by a user;
reading the related information of a first target file corresponding to the query command from the related information of batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to the query command of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
In a sixth aspect, the present application also provides a computer readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring a query command input by a user;
reading the related information of a first target file corresponding to the query command from the related information of batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to the query command of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
acquiring a query command input by a user;
reading the related information of a first target file corresponding to the query command from the related information of batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to the query command of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
According to the information query method, the information query device and the computer equipment, the query command input by the user is firstly acquired, and then the related information of the first target file corresponding to the query command is read from the related information of the batch files stored in advance in the local cache. The method aims at the distributed storage system, when the terminal is used for reading batch files, the related information of the required files can be directly read from the local cache of the terminal, the terminal is not required to send query instructions corresponding to each file to the storage server, and the data of the memory or the disk on the storage server is not required to be read, namely the data cannot be influenced by the time delay of network transmission data in the distributed storage system and the time consumption of reading the data on the memory or the disk, so that the query efficiency of the file information is greatly improved.
Drawings
FIG. 1 is an application environment diagram of a method of information query in one embodiment;
fig. 2 is a flow chart (terminal side) of an information query method in one embodiment;
FIG. 3 is a flowchart illustrating the step S202 in the embodiment of FIG. 2;
FIG. 4 is a flowchart illustrating the step S302 in the embodiment of FIG. 3;
fig. 5 is a flow chart (terminal side) of an information query method in another embodiment;
FIG. 6 is a flow chart of a method of information query in one embodiment (storage server side);
FIG. 7 is a flowchart illustrating the step S602 in the embodiment of FIG. 6;
FIG. 8 is a flowchart illustrating the step S602 in another embodiment of FIG. 6;
FIG. 9 is a flowchart illustrating the step S702 in the embodiment of FIG. 8;
FIG. 10 is a flowchart of a method for information query in another embodiment (storage server side);
FIG. 11 is a flow diagram of information query method interactions between a terminal and a storage server in one embodiment;
FIG. 12 is a flow chart of a complete method of querying the file status of the information query;
FIG. 13 is a block diagram of an information query apparatus in one embodiment;
FIG. 14 is a block diagram of an information query apparatus in one embodiment;
FIG. 15 is a block diagram of an information query apparatus in one embodiment;
FIG. 16 is a block diagram of an information query apparatus in one embodiment;
fig. 17 is an internal structural view of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
With the development of network technology, the distributed file system is widely applied to file, data and information storage in various technical fields. The distributed file system comprises a storage server and a host, and typically, when a user performs basic operations (such as file creation, renaming, state inquiry, deletion, etc.) on the host, the host will transmit these basic operation requests to the corresponding storage server through a network, and after the storage server receives the basic operation requests and completes the basic operations, the storage server will transmit the operation results to the host sending the requests through the network. Taking the state information inquiry of a file as an example, when a user performs the state information inquiry operation of the file on a host, the host transmits a state information inquiry request of the file to a corresponding storage server through a network, and after the storage server receives the inquiry request and finishes the state information inquiry of the file, the storage server transmits an inquiry result to the host which transmits the inquiry request through the network.
However, in the above-mentioned inquiry process, the time delay of network transmission and the time consumption of inquiring the disk by the server account for a large proportion of the time consumption of inquiring the state information of the whole file. Especially, when the status information of a large number of files is queried, the proportion of network transmission delay and disk query time consumption is gradually increased. Therefore, when the method is used for inquiring a large quantity of files, the inquiry efficiency is low. The present application aims to solve this problem.
After the background technology of the information query method provided by the embodiment of the present application is introduced, an implementation environment related to the information query method provided by the embodiment of the present application will be briefly described below. The information query method provided by the embodiment of the application can be applied to the distributed file system shown in figure 1. The distributed file system includes a plurality of storage servers 101, a terminal 102, and a switch 103, and the terminal 102 performs data transmission with the storage servers 101 through the switch 103. In general, when a user performs a basic operation (such as creation, renaming, status query, and deletion of a file) on the terminal 102, the terminal 102 transmits the operation request to the corresponding storage server 101 through a network, and the storage server 101 packages the operation result after completing the operation requested by the terminal 102 and transmits the operation result to the terminal 102 through a communication network.
After the application scenario of the information query method provided by the embodiment of the application is introduced, the information query process is mainly introduced below.
In one embodiment, as shown in fig. 2, an information query method is provided, and the method is applied to the terminal in fig. 1 for illustration, and includes the following steps:
S201, acquiring a query command input by a user.
The inquiry command is a command which is input into the terminal by a user when related information of the file needs to be inquired; for example, in a Linux operating environment, a user entering a "stat" command may query for information about a file.
In the embodiment of the application, if the user needs to inquire the related information of the file, an inquiry command can be input on the terminal. Optionally, a corresponding application program is installed on the terminal, an input interface or an input window for inquiring the command is provided, and the user can input the inquiring command on the interface or the input window of the terminal in a text input mode or input the inquiring command on the interface of the terminal in a control triggering mode; alternatively, the user may input the query command on the terminal in a voice manner. After the terminal obtains the query command input by the user, the subsequent query operation can be performed.
S202, reading the related information of the first target file corresponding to the query command from the related information of the batch files stored in the local cache in advance.
The related information of the batch files is information returned by the storage server according to a query request of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files; the first target file is a file queried by a query command input by a user at the time. The related information of the file includes at least one of status information of the file, storage information of the file, type information of the file, and the like. Wherein the status information of the file includes a file name, a file size, an index number of the file, a modification time of the file, and the like. The first target file is an associated file of the second target file, for example, the first target file and the second target file belong to the same father directory; or the first target file and the second target file are stored in the same disk position or adjacent disk positions; or the first target file and the second target file belong to the same type of file; alternatively, the first target file and the second target file are files stored simultaneously.
In the embodiment of the present application, before reading the related information of the first target file corresponding to the query command, the related information of the batch file needs to be stored in the terminal in advance, and the method for storing the related information of the batch file is described below: the user inputs a query command of the second target file at the terminal, the terminal receives the query command and transmits the query command to a corresponding storage server through a network, the storage server packages the queried second target file and related information of the file related to the second target file and transmits the package to the terminal through the network, and the terminal stores the information in a local cache after receiving the second target file and related information of the file related to the second target file.
Further, after the terminal acquires the query command of the first target file input by the user again, the identifier of the first target file is extracted from the query command, and according to the mapping relationship between the file identifier and the related information, the related information of the batch files corresponding to the identifier of the first target file is searched in the local cache. It should be noted that, the mapping relationship between the file identifier and the related information may be predetermined.
According to the information query method provided by the embodiment of the application, the query command input by the user is firstly obtained, and then the related information of the first target file corresponding to the query command is read from the related information of the batch files stored in advance in the local cache. The method aims at the distributed storage system, when the terminal is used for reading batch files, the related information of the required files can be directly read from the local cache of the terminal, the terminal is not required to send query instructions corresponding to each file to the storage server, and the data of the memory or the disk on the storage server is not required to be read, namely the data cannot be influenced by the time delay of network transmission data in the distributed storage system and the time consumption of reading the data on the memory or the disk, so that the query efficiency of the file information is greatly improved.
In one embodiment, the process of acquiring the related information of the first target file may be described based on the embodiment shown in fig. 2, as shown in fig. 3, the reading the related information of the first target file corresponding to the query command from the related information of the batch files stored in advance in the local cache in S202 may include:
s301, extracting a target identifier of a first target file from the query command.
Wherein the object identifier is used to uniquely characterize the object file, and may be represented by one of text, letters, symbols, numbers, or by a combination of text, letters, symbols, numbers.
In the embodiment of the application, when the terminal acquires the query command input by the user, the target identifier of the first target file can be further extracted from the query command, so that the related information of the first target file can be acquired according to the target identifier. It should be noted that, the target identifier of the first target file in the query command may be an identifier generated by editing through a text input manner when the user inputs the query command on the terminal, or may be a file identifier automatically associated with the terminal when the user inputs the file name through a text manner.
S302, according to the type of the first target file, determining the related information of the first target file corresponding to the target identifier from the related information of batch files stored in the local cache in advance.
The target files may include text type files, video type files, and audio type files, among others. Or the type of the target file may be determined according to the storage time of the file, for example, the target file includes files of different storage times.
In the embodiment of the application, after the terminal extracts the target identifier of the first target file according to the query command, the terminal can further determine the type of the first target file, determine the storage area corresponding to the type from the local cache, and then search the related information of the batch files corresponding to the target identifier of the first target file from the storage area according to the mapping relation between the file identifier and the related information. It should be noted that, the mapping relationship between the file identifier and the related information may be predetermined.
Optionally, after extracting the target identifier of the first target file according to the query command, the terminal may first traverse the related information of the batch files stored in the local cache in advance according to the type of the first target file required to be queried by the user, screen the related information of the batch files with the same type as the first target file from the related information, and further search the related information of the batch files corresponding to the target identifier of the first target file from the screened related information of the batch files according to the mapping relationship between the file identifier and the related information. It should be noted that, the mapping relationship between the file identifier and the related information may be predetermined.
According to the method for reading the related information of the first target file, the information is searched from the local cache through the type of the first target file and the target identifier of the first target file, so that the searching range can be reduced, and the information searching efficiency is improved.
In one embodiment, a description may be made of a process of determining, based on the embodiment shown in fig. 3, the related information of the first target file corresponding to the target identifier from the related information of the batch files stored in advance in the local cache according to the type of the first target file, and "determining, based on the type of the first target file, the related information of the first target file corresponding to the target identifier from the related information of the batch files stored in advance in the local cache" in S302, as shown in fig. 4, includes:
s401, according to the type of the first target file, determining a storage area corresponding to the type from the local cache.
In the embodiment of the application, when the terminal determines the type of the first target file, the storage area corresponding to the type of the first target file is determined according to the corresponding relation between the type and the storage area. It should be noted that, the correspondence between the type and the storage area may be obtained by dividing the storage area for the related information of the batch file according to the type when the terminal obtains the related information of the batch file in advance. Specifically, when the terminal obtains the related information of the batch files, the local cache may be divided into storage areas according to the types of the files, so that different storage areas store different types of files, for example, the 1# storage area stores the files of the video type and the #2 area stores the files of the text type.
S402, determining relevant information of the target file corresponding to the target identifier from the storage area corresponding to the type.
In the embodiment of the application, when the terminal determines the storage area corresponding to the type from the local cache, according to the target identifier of the first target file, the terminal determines the related information of the target file corresponding to the target identifier from the storage area according to the corresponding relation between the target identifier and the identifiers of the files in the storage area. It should be noted that, the correspondence between the target identifier and the identifier of each file in the storage area may be previously obtained by constructing, by the terminal, related information of the batch of files in each type of storage area according to the target identifier of the file when the terminal obtains the related information of the batch of files.
According to the method for reading the related information of the first target file, the storage area can be rapidly positioned according to the type of the first target file, so that the searching range is reduced, related information searching is performed on the basis of the storage area after the range is reduced according to the target identification of the first target file, and the information searching efficiency can be improved.
In summary, as shown in fig. 5, the embodiment of the present application further provides a complete flowchart (terminal side) of an information query method, where the method includes:
S501, acquiring a query command input by a user;
s502, extracting a target identifier of a first target file from a query command;
s503, determining a storage area corresponding to the type from the local cache according to the type of the first target file;
s504, determining relevant information of a first target file corresponding to the target identifier from the storage area corresponding to the type.
The method described in the embodiments of fig. 2-5 above is illustrated on the terminal side, and the embodiments of fig. 6-10 below are illustrated on the storage server side.
In one embodiment, as shown in fig. 6, an information query method is provided, and the method is applied to any storage server 101 in fig. 1, for illustration, and includes the following steps:
s601, receiving a query request of a second target file sent by the terminal.
In the embodiment of the application, if the user needs to inquire the related information of the second target file, the terminal can input an inquiry command, the terminal can correspondingly generate an inquiry request after receiving the inquiry command input by the user, then the inquiry request is transmitted to the storage server through the network, and the storage server can receive the inquiry request of the second target file sent by the terminal, so that the storage server can perform subsequent inquiry operation according to the received inquiry request.
S602, according to the query request of the second target file, reading the related information of the batch files corresponding to the query request.
The batch file comprises a second target file and a plurality of files related to the second target file.
In the embodiment of the application, when the storage server receives the query request of the second target file sent by the terminal, the identification of the second target file can be further extracted from the query request, the second target file is searched on the local memory or the disk according to the mapping relation between the file identification and the related information, all files related to the second target file are further determined according to the identification of the second target file, and the related information of all files related to the second target file is searched on the local memory or the disk.
Optionally, when determining all the files related to the second target file, the storage server may further determine all the files related to the second target file according to the type of the second target file, for example, if the second target file is a video file, and then the storage server reads all the video files from the local memory or the disk as files related to the second target file.
And S603, returning the related information of the batch files corresponding to the query request to the terminal so as to instruct the terminal to store the related information of the corresponding batch files in the local cache.
In the embodiment of the application, after the related information of the batch files corresponding to the query request is obtained, the storage server transmits the related information of the batch files corresponding to the query request to the terminal through the network, so as to instruct the terminal to store the related information of the batch files corresponding to the batch files in the local cache, and the next time the terminal receives the query request input by the user, the related information of the query file is directly read from the local cache of the terminal.
According to the information query method provided by the embodiment of the application, the query request of the second target file sent by the terminal is received, then the related information of the batch files corresponding to the query request is read according to the query request of the second target file, and finally the related information of the batch files corresponding to the query request is returned to the terminal so as to instruct the terminal to store the related information of the corresponding batch files in the local cache. In the distributed storage system, the storage server feeds back the related information of the batch files to the terminal in advance, so that the terminal can store the related information of the batch files in the local cache in advance, and the related information of each file can be directly read from the local cache of the terminal when the related information of the batch files is queried next time, particularly when the related information of the batch files is queried, the terminal does not need to send a query instruction to the storage server, and the data of a memory or a disk on the storage server is not required to be read, namely the time delay of network transmission data in the distributed storage system and the time consumption for reading the data on the memory or the disk are not greatly influenced, and the query efficiency of the file information is greatly improved.
In one embodiment, a description may be made of a process of reading related information of a batch file corresponding to the query request according to the query request of the second target file on the basis of the embodiment shown in fig. 6, as shown in fig. 7, where "reading related information of a batch file corresponding to the query request according to the query request of the second target file" in S602 includes:
s701, determining the locally stored position information of the second target file according to the query request of the second target file.
The local storage comprises a local memory or a local disk and the like. The locally stored location information of the second target file may represent a location of the second target file on the disk, or represent a location of the second target file on the memory.
In the embodiment of the application, when the storage server receives the query request of the second target file, the identifier of the second target file can be further extracted from the query request, and then the locally stored position information corresponding to the identifier of the second target file is determined according to the mapping relationship between the file identifier and the storage position. The mapping relationship between the file identifier and the storage location is determined according to the correspondence relationship between the identifier and the storage location of each file when the storage server stores each file.
S702, determining the target position according to the position information of the second target file on the local storage.
The target position is adjacent to the position of the second target file.
In the embodiment of the present application, after determining the location information of the second target file stored locally, the storage server may continuously determine, according to the location information of the second target file stored locally, a target location adjacent to the location where the second target file is stored locally.
S703, reading the position of the second target file and the related information of the files at the target position as the related information of the batch files.
In the embodiment of the application, after the position of the second target file and the target position are obtained, the storage server reads the relevant information of the position of the second target file and the file at the target position, and takes the relevant information of the position of the second target file and the file at the target position as the relevant information of the batch files.
According to the embodiment of the application, the related information containing the second target file and the related information of the files adjacent to the second target file are returned to the terminal as the related information of the batch files, so that information support is provided for the related information of the next file inquiry of the terminal, and the file information inquiry efficiency is improved.
In one embodiment, based on the embodiment shown in fig. 7, as shown in fig. 8, the method further includes:
s704, determining directory information of the second target file.
The directory information of the second target file indicates a parent directory to which the second target file belongs.
In the embodiment of the application, when the storage server receives the query request of the second target file, the identifier of the second target file can be further extracted from the query request, and then the directory information corresponding to the identifier of the second target file is determined according to the mapping relationship between the file identifier and the directory information. The mapping relationship between the file identifier and the directory information is determined according to the correspondence relationship between the identifier of each file and the directory information of the parent directory when the storage server stores each file in the corresponding parent directory folder.
Correspondingly, when the user terminal executes the "determining the target position according to the position information of the second target file on the local storage" in S702, the specific steps are executed:
s702, determining the target position according to the position information of the second target file on the local storage and the directory information of the second target file.
In the embodiment of the application, after the position information of the second target file stored locally and the directory information of the second target file are determined, the storage server determines the files belonging to the same father directory as the second target file according to the directory information of the second target file, screens the files in adjacent positions from the files belonging to the same father directory according to the position information of the second target file stored locally, and determines the target position according to the position information of the screened files.
According to the embodiment of the application, the related information containing the second target file and the related information of the files which are adjacent to the second target file and belong to the same father catalog are returned to the terminal as the related information of the batch files, so that information support is provided for the related information of the next file inquiry of the terminal, and the file information inquiry efficiency is improved.
In one embodiment, the process of determining the target location according to the location information of the second target file on the local disk and the directory information of the second target file may be described based on the embodiment shown in fig. 8, and as shown in fig. 9, "determining the target location according to the location information of the second target file on the local disk and the directory information of the second target file" in S702 may include:
S801, determining candidate positions according to the position information of the second target file on the local storage.
The candidate position is adjacent to the position where the second target file is located.
In the embodiment of the present application, in the above-mentioned determining the location information of the second target file stored locally, the storage server may determine, according to the location information of the second target file stored locally, a location adjacent to the location of the second target file stored locally, and determine the location as the candidate location.
S802, determining a candidate position matched with the directory information of the second target file as a target position.
In the embodiment of the application, after the candidate position adjacent to the position of the second target file and the directory information of the second target file are determined, the storage server screens out files belonging to the same father directory from the files in the candidate position adjacent to the position of the second target file according to the directory information of the second target file, and determines the target position according to the position information of the screened files.
According to the embodiment of the application, the related information containing the second target file and the related information of the files which are adjacent to the second target file and belong to the same father catalog are returned to the terminal as the related information of the batch files, so that information support is provided for the related information of the next file inquiry of the terminal, and the file information inquiry efficiency is improved.
In one embodiment, as shown in fig. 10, the embodiment of the present application further provides a complete flowchart (storage server side) of an information query method, where the method includes:
s901, receiving a query request of a second target file sent by a terminal;
s902, determining the locally stored position information of the second target file according to the query request of the second target file;
s903, determining directory information of the second target file;
s904, determining candidate positions according to the position information of the second target file on the local storage;
s905, determining a candidate position matched with the directory information of the second target file as a target position;
s906, reading the position of the second target file and the related information of the files at the target position as related information of batch files;
s907, the related information of the batch files corresponding to the query request is returned to the terminal, so as to instruct the terminal to store the related information of the corresponding batch files in the local cache.
In summary, as shown in fig. 11, there is further provided an information query method implemented by interaction between a terminal and a storage server, where the method includes:
s10, sending a second target file query request to a storage server;
S11, receiving a query request of a second target file sent by the terminal, and reading related information of batch files corresponding to the query request according to the query request of the second target file;
s12, returning the related information of the batch files corresponding to the query request to the terminal;
s13, after receiving the related information of the batch files, the terminal stores the related information of the batch files in a local cache;
s14, acquiring a query command of a first target file input by a user;
s15, reading the related information of the first target file corresponding to the query command from the related information of the batch files stored in the local cache in advance.
In all the above embodiments, as shown in fig. 12, a complete file status query flowchart is also provided. When the user needs to inquire the file state information of other files, firstly searching from the local cache of the terminal, and if the file state information of the other files needing to be inquired is searched in the local cache, directly returning to the user; if the file state information of other files to be queried is not found in the local cache, a file state information query request is sent to a storage server node, the storage server searches related information in a memory and a disk after receiving the query request, if the file state information of the other files to be queried is found, the file state information of the batch files is prefetched in batches, the file state information of the batch files is returned to the terminal, the terminal adds the file state information of the batch files into the local cache after receiving the file state information of the batch files, and the file state information of the other files queried by a user is returned to a client.
According to the information query method provided by the embodiment of the application, the query command input by the user is firstly obtained, and then the related information of the first target file corresponding to the query command is read from the related information of the batch files stored in advance in the local cache. The method aims at the distributed storage system, when the terminal is used for reading batch files, the related information of the required files can be directly read from the local cache of the terminal, the terminal is not required to send query instructions corresponding to each file to the storage server, and the data of the memory or the disk on the storage server is not required to be read, namely the data cannot be influenced by the time delay of network transmission data in the distributed storage system and the time consumption of reading the data on the memory or the disk, so that the query efficiency of the file information is greatly improved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides an information query device for realizing the information query method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of one or more information query devices provided below may refer to the limitation of the information query method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 13, there is provided an information query apparatus including: an acquisition module 10, a reading module 11, wherein:
the acquiring module 10 is configured to acquire a query command input by a user.
The reading module 11 is configured to read, from the related information of the batch file stored in the local cache in advance, related information of the first target file corresponding to the query command; the related information of the batch files is information returned by the storage server according to the query command of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
In one embodiment, as shown in fig. 14, the reading module 11 includes: an extraction unit 110, a determination unit 111, wherein:
The extracting unit 110 is specifically configured to extract a target identifier of the first target file from the query command;
the determining unit 111 is specifically configured to determine, according to the type of the first target file, relevant information of the first target file corresponding to the target identifier from relevant information of batch files stored in advance in the local cache.
In one embodiment, the determining unit 111 is specifically configured to determine, according to the type of the first target file, a storage area corresponding to the type from the local cache; and determining the related information of the first target file corresponding to the target identifier from the storage area corresponding to the type.
In one embodiment, as shown in fig. 15, there is provided an information query apparatus including: a receiving module 20, a reading module 21, a transmitting module 22, wherein:
a receiving module 20, configured to receive a query request of a second target file sent by a terminal;
a reading module 21, configured to read, according to a query request of the second target file, related information of a batch of files corresponding to the query request; the batch file comprises a second target file and a plurality of files related to the second target file;
and the sending module 22 is configured to return, to the terminal, information about the batch file corresponding to the query request, so as to instruct the terminal to store the information about the batch file corresponding to the query request in the local cache.
In one embodiment, as shown in fig. 16, the reading module 21 includes: a first determination unit 210, a second determination unit 211, a third determination unit 212, wherein:
the first determining unit 210 is specifically configured to determine, according to the query request of the second target file, location information of the second target file stored locally;
a second determining unit 211, specifically configured to determine a target location according to the location information of the second target file on the local storage; the target position is adjacent to the position of the second target file;
the third determining unit 212 is specifically configured to read, as the related information of the batch file, the location of the second target file and the related information of the file at the target location.
In one embodiment, the apparatus further comprises:
a fourth determining unit, configured to determine directory information of the second target file;
the second determining unit 211 is specifically configured to determine the target location according to the location information of the second target file on the local storage and the directory information of the second target file.
In one embodiment, the second determining unit 211 is specifically configured to determine the candidate location according to the location information of the second target file on the local storage; the candidate position is adjacent to the position where the second target file is located; and determining the candidate position matched with the directory information of the second target file as the target position.
The modules in the information query apparatus may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 17. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing state information data of the file. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of querying information.
It will be appreciated by those skilled in the art that the structure shown in FIG. 17 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
acquiring a query command input by a user;
reading the related information of a first target file corresponding to the query command from the related information of batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to the query command of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
In one embodiment, the processor when executing the computer program further performs the steps of:
extracting a target identifier of a target file from the query command;
And determining the related information of the first target file corresponding to the target identifier from the related information of the batch files stored in the local cache according to the type of the target file.
In one embodiment, the processor when executing the computer program further performs the steps of:
according to the type of the first target file, determining a storage area corresponding to the type from a local cache;
and determining the related information of the first target file corresponding to the target identifier from the storage area corresponding to the type.
In one embodiment, the processor when executing the computer program further performs the steps of:
receiving a query request of a second target file sent by a terminal;
according to the query request of the second target file, reading the related information of the batch files corresponding to the query request; the batch file comprises a second target file and a plurality of files related to the second target file;
and returning the related information of the batch files corresponding to the query request to the terminal so as to instruct the terminal to store the related information of the corresponding batch files in the local cache.
In one embodiment, the processor when executing the computer program further performs the steps of:
determining the position information of the second target file stored locally according to the query request of the second target file;
Determining a target position according to the position information of the second target file on the local storage; the target position is adjacent to the position of the second target file;
and reading the position of the second target file and the related information of the files at the target position as the related information of the batch files.
In one embodiment, the processor when executing the computer program further performs the steps of:
determining directory information of a second target file;
determining the target location according to the location information of the second target file on the local storage includes:
and determining the target position according to the position information of the second target file on the local storage and the directory information of the second target file.
In one embodiment, the processor when executing the computer program further performs the steps of:
determining candidate positions according to the position information of the second target file on the local storage; the candidate position is adjacent to the position where the second target file is located;
and determining the candidate position matched with the directory information of the second target file as the target position.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
Acquiring a query command input by a user;
reading the related information of a first target file corresponding to the query command from the related information of batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to the query command of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
In one embodiment, the computer program when executed by the processor further performs the steps of:
extracting a target identifier of a first target file from the query command;
and determining the related information of the first target file corresponding to the target identifier from the related information of the batch files stored in the local cache in advance according to the type of the first target file.
In one embodiment, the computer program when executed by the processor further performs the steps of:
according to the type of the first target file, determining a storage area corresponding to the type from a local cache;
and determining the related information of the first target file corresponding to the target identifier from the storage area corresponding to the type.
In one embodiment, the computer program when executed by the processor further performs the steps of:
Receiving a query request of a second target file sent by a terminal;
according to the query request of the second target file, reading the related information of the batch files corresponding to the query request; the batch file comprises a second target file and a plurality of files related to the second target file;
and returning the related information of the batch files corresponding to the query request to the terminal so as to instruct the terminal to store the related information of the corresponding batch files in the local cache.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining the position information of the second target file stored locally according to the query request of the second target file;
determining a target position according to the position information of the second target file on the local storage; the target position is adjacent to the position of the second target file;
and reading the position of the second target file and the related information of the files at the target position as the related information of the batch files.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining directory information of a second target file;
determining the target location according to the location information of the second target file on the local storage includes:
And determining the target position according to the position information of the second target file on the local storage and the directory information of the second target file.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining candidate positions according to the position information of the second target file on the local storage; the candidate position is adjacent to the position where the second target file is located;
and determining the candidate position matched with the directory information of the second target file as the target position.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
acquiring a query command input by a user;
reading the related information of a first target file corresponding to the query command from the related information of batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to the query command of the second target files sent by the terminal, and the batch files comprise the second target files and a plurality of files related to the second target files.
In one embodiment, the computer program when executed by the processor further performs the steps of:
Extracting a target identifier of a first target file from the query command;
and determining the related information of the first target file corresponding to the target identifier from the related information of the batch files stored in the local cache in advance according to the type of the first target file.
In one embodiment, the computer program when executed by the processor further performs the steps of:
according to the type of the first target file, determining a storage area corresponding to the type from a local cache;
and determining the related information of the first target file corresponding to the target identifier from the storage area corresponding to the type.
In one embodiment, the computer program when executed by the processor further performs the steps of:
receiving a query request of a second target file sent by a terminal;
according to the query request of the second target file, reading the related information of the batch files corresponding to the query request; the batch file comprises a second target file and a plurality of files related to the second target file;
and returning the related information of the batch files corresponding to the query request to the terminal so as to instruct the terminal to store the related information of the corresponding batch files in the local cache.
In one embodiment, the computer program when executed by the processor further performs the steps of:
Determining the position information of the second target file stored locally according to the query request of the second target file;
determining a target position according to the position information of the second target file on the local storage; the target position is adjacent to the position of the second target file;
and reading the position of the second target file and the related information of the files at the target position as the related information of the batch files.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining directory information of a second target file;
determining the target location according to the location information of the second target file on the local storage includes:
and determining the target position according to the position information of the second target file on the local storage and the directory information of the second target file.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining candidate positions according to the position information of the second target file on the local storage; the candidate position is adjacent to the position where the second target file is located;
and determining the candidate position matched with the directory information of the second target file as the target position.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. An information query method, characterized in that the information query method comprises:
acquiring a query command input by a user;
reading the related information of the first target file corresponding to the query command from the related information of the batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to a query command of a second target file sent by the terminal, and the batch files comprise the second target file and a plurality of files related to the second target file.
2. The method according to claim 1, wherein the reading the related information of the first target file corresponding to the query command from the related information of the batch file stored in advance in the local cache includes:
extracting a target identifier of the first target file from the query command;
and determining the related information of the first target file corresponding to the target identifier from the related information of the batch files stored in the local cache in advance according to the type of the first target file.
3. The method according to claim 2, wherein the determining, according to the type of the first target file, the related information of the first target file corresponding to the target identifier from the related information of the batch files stored in advance in the local cache includes:
according to the type of the first target file, determining a storage area corresponding to the type from a local cache;
and determining the related information of the first target file corresponding to the target identifier from the storage area corresponding to the type.
4. An information query method, characterized in that the information query method comprises:
receiving a query request of a second target file sent by a terminal;
According to the query request of the second target file, reading the related information of batch files corresponding to the query request; the batch file comprises a second target file and a plurality of files related to the second target file;
and returning the related information of the batch files corresponding to the query request to the terminal so as to instruct the terminal to store the related information of the corresponding batch files in a local cache.
5. The method according to claim 4, wherein the reading, according to the query request of the second target file, the related information of the batch file corresponding to the query request includes:
determining the locally stored position information of the second target file according to the query request of the second target file;
determining a target position according to the position information of the second target file on the local storage; the target position is adjacent to the position of the second target file;
and reading the relevant information of the file at the position of the second target file and the target position as the relevant information of the batch files.
6. The method of claim 5, wherein the method further comprises:
Determining directory information of the second target file;
the determining the target position according to the position information of the second target file on the local storage includes:
and determining the target position according to the position information of the second target file on the local storage and the directory information of the second target file.
7. The method of claim 6, wherein determining the target location based on the location information of the second target file on the local storage and the directory information of the second target file comprises:
determining candidate positions according to the position information of the second target file on the local storage; the candidate position is adjacent to the position where the second target file is located;
and determining a candidate position matched with the directory information of the second target file as the target position.
8. An information query apparatus, the apparatus comprising:
the acquisition module is used for acquiring a query command input by a user;
the reading module is used for reading the related information of the first target file corresponding to the query command from the related information of the batch files stored in the local cache in advance; the related information of the batch files is information returned by the storage server according to a query request of a second target file sent by the terminal, and the batch files comprise the second target file and a plurality of files related to the second target file.
9. An information query apparatus, the apparatus comprising:
the receiving module is used for receiving a query request of the second target file sent by the terminal;
the reading module is used for reading the related information of the batch files corresponding to the query request according to the query request of the second target file; the batch file comprises a second target file and a plurality of files related to the second target file;
and the indication module is used for returning the related information of the batch files corresponding to the query request to the terminal so as to indicate the terminal to store the related information of the corresponding batch files in a local cache.
10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
CN202310547959.6A 2023-05-16 2023-05-16 Information query method and device and computer equipment Pending CN116775570A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310547959.6A CN116775570A (en) 2023-05-16 2023-05-16 Information query method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310547959.6A CN116775570A (en) 2023-05-16 2023-05-16 Information query method and device and computer equipment

Publications (1)

Publication Number Publication Date
CN116775570A true CN116775570A (en) 2023-09-19

Family

ID=88008966

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310547959.6A Pending CN116775570A (en) 2023-05-16 2023-05-16 Information query method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN116775570A (en)

Similar Documents

Publication Publication Date Title
US11068441B2 (en) Caseless file lookup in a distributed file system
CN101727465B (en) Methods for establishing and inquiring index of distributed column storage database, device and system thereof
CN111177302B (en) Service bill processing method, device, computer equipment and storage medium
EP3767483A1 (en) Method, device, system, and server for image retrieval, and storage medium
CN107704202B (en) Method and device for quickly reading and writing data
WO2018121430A1 (en) File storage and indexing method, apparatus, media, device and method for reading files
CN106407360B (en) Data processing method and device
CN110888837B (en) Object storage small file merging method and device
WO2014110940A1 (en) A method, apparatus and system for storing, reading the directory index
CN112817973A (en) Data processing method, data processing device, data processing equipment and storage medium
CN114925041A (en) Data query method and device
CN112035413B (en) Metadata information query method, device and storage medium
US9626378B2 (en) Method for handling requests in a storage system and a storage node for a storage system
US8005844B2 (en) On-line organization of data sets
CN108228101B (en) Method and system for managing data
CN116775570A (en) Information query method and device and computer equipment
CN115129789A (en) Bucket index storage method, device and medium of distributed object storage system
CN115114289A (en) Data query method and device and electronic equipment
CN114116723A (en) Snapshot processing method and device and electronic equipment
CN113986828A (en) Method and device for storing mass files, electronic equipment and storage medium
CN114238264A (en) Data processing method, data processing device, computer equipment and storage medium
CN109960695B (en) Management method and device for database in cloud computing system
CN108989245B (en) User data storage method and device
CN116821102B (en) Data migration method, device, computer equipment and storage medium
CN117493284B (en) File storage method, file reading method, file storage and reading system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination