File path searching method and device, electronic equipment and storage medium
By introducing file hit ring and hit mark management, the file hit block is found from the file hit ring based on the index number of the target file, which solves the problem of low efficiency in file path search in the existing technology and realizes fast target file search.
Patent Information
- Application Number
- CN202111564473.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-20
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2041-12-20
AI Technical Summary
Existing methods for finding file paths are inefficient, requiring a 1:1 search from the root directory of the file, resulting in low search efficiency.
A file hit ring is introduced. The file hit block is found from the file hit ring by the index number of the target file. The file hit block is traversed to find the target file, and the file hit block is managed by the hit mark.
It greatly shortens the time to find the target file, improves search efficiency, and solves the problem of low efficiency in file path search.
Smart Images

Figure CN114490520B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of data processing, in particular to a file path searching method and device, electronic equipment and storage medium. BACKGROUND
[0002] At present, the common file system searching file path method needs to start from the root directory of the file, find the directory file node according to the directory name, and then find the next directory name according to the directory file node, and so on, to find the required file node. This kind of searching scheme needs to compare the directory names at each level, and the searching efficiency is low. SUMMARY
[0003] The present disclosure provides a file path searching method and device, electronic equipment and storage medium, which aims to shorten the time of searching for a target file by introducing a file hit ring, and thus improve the searching efficiency.
[0004] According to an aspect of the present disclosure, a file path searching method is provided, which comprises:
[0005] searching for a file hit block from a file hit ring based on the index number of the target file, wherein the file hit ring is a circular array with a preset length, and contains at least two file hit blocks;
[0006] searching for the target file by traversing the file hit block.
[0007] Optionally, the method further comprises:
[0008] performing hit marking on the target file according to the searching result of the target file;
[0009] managing the target file based on the hit marking.
[0010] Optionally, performing hit marking on the target file according to the searching result of the target file comprises:
[0011] if the target file is successfully searched, performing number increment processing on the hit marking of the successfully searched target file;
[0012] if the target file is unsuccessfully searched, performing number decrement processing on the hit marking of the unsuccessfully searched target file.
[0013] Optionally, managing the target file based on the hit marking comprises:
[0014] sorting the files in the file hit block according to the hit marking.
[0015] Optionally, the managing the target file based on the hit mark of the file hit block comprises:
[0016] judging whether the file in the file hit block meets a preset deletion condition based on the hit mark, and if so, deleting the file; or
[0017] replacing the file in the file hit block based on the hit mark.
[0018] Optionally, the method further comprises:
[0019] sequentially traversing the file hit block according to a preset addition condition to determine whether there is a blank file hit block;
[0020] if so, setting an index number of the blank file hit block based on a file path name of a to-be-added file whose search is successful;
[0021] storing the to-be-added file in the blank file hit block to complete addition processing of the blank file hit block.
[0022] According to another aspect of the present disclosure, a file path searching device is provided, comprising:
[0023] a first searching unit configured to search a file hit block from a file hit ring based on an index number of a target file, the file hit ring being a ring-shaped array with a preset length and containing at least two file hit blocks;
[0024] a second searching unit configured to traverse the file hit block to search the target file.
[0025] Optionally, the method device further comprises:
[0026] a marking unit configured to mark the target file according to a search result of the target file;
[0027] a managing unit configured to manage the target file searched by the file hit block based on the hit mark.
[0028] Optionally, the marking unit comprises:
[0029] a first marking module configured to incrementally process the hit mark of the target file whose search is successful when the search of the target file is successful;
[0030] a second marking module configured to decrementally process the hit mark of the target file whose search is unsuccessful when the search of the target file fails.
[0031] Optionally, the management unit is further configured to sort the files in the file hit block according to the hit marks.
[0032] Optionally, the management unit comprises:
[0033] a judging module configured to judge whether the files in the file hit block meet a preset deletion condition based on the hit marks;
[0034] a deleting module configured to delete the files when it is determined that the preset deletion condition is met;
[0035] a replacing module configured to replace the files in the file hit block based on the hit marks.
[0036] Optionally, the apparatus further comprises:
[0037] a traversing unit configured to traverse the file hit block one by one according to a preset addition condition;
[0038] a determining unit configured to determine whether there is a blank file hit block;
[0039] a setting unit configured to set an index number of the blank file hit block based on a file path name of a file to be added which is successfully searched when it is determined that the blank file hit block exists;
[0040] an adding unit configured to store the file to be added in the blank file hit block to complete addition processing of the blank file hit block.
[0041] According to another aspect of the present disclosure, an electronic device is provided, comprising:
[0042] at least one processor; and
[0043] a memory connected to the at least one processor in communication; wherein,
[0044] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of the preceding aspect.
[0045] According to another aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method of the preceding aspect.
[0046] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method of the preceding aspect.
[0047] The file path searching method and device, the electronic device and the storage medium provided by the present disclosure search for a file hit block from a file hit ring based on an index number of a target file, the file hit ring is a ring-shaped array with a preset length, contains at least two file hit blocks, and the target file is searched for by traversing the file hit block. Compared with the related art, the present application introduces a file hit ring, searches for a target file from the file hit ring through an index number, can greatly shorten the time for searching for the target file, and further improves the searching efficiency.
[0048] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0049] The accompanying drawings are used to better understand the present scheme and do not constitute a limitation on the present disclosure. Among them:
[0050] Figure 1 A flowchart of a file path searching method provided by an embodiment of the present disclosure;
[0051] Figure 2 A schematic diagram of a file hit ring provided by an embodiment of the present disclosure;
[0052] Figure 3 A flowchart of another file path searching method provided by an embodiment of the present disclosure;
[0053] Figure 4 A structural schematic diagram of a file path searching device provided by an embodiment of the present disclosure;
[0054] Figure 5 A structural schematic diagram of another file path searching device provided by an embodiment of the present disclosure;
[0055] Figure 6 A schematic block diagram of an example electronic device 500 provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0056] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to help understanding, and should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in order to be clear and concise, the description below omits the description of well-known functions and structures.
[0057] The file path searching method, device, electronic device and storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0058] In the present disclosure, in order to avoid the problem of low search efficiency caused by searching the target file level by level from the root directory, the embodiments of the present application search the target file by introducing a file hit ring and by an index number, which can greatly shorten the time for searching the target file and improve the search efficiency.
[0059] Figure 1 A flowchart of a file path search method provided by the embodiments of the present disclosure is shown in FIG. 1. As shown in the figure, the method comprises the following steps: Figure 1
[0060] 101. Search a file hit block from a file hit ring based on an index number of a target file, wherein the file hit ring is a circular array with a preset length and comprises at least two file hit blocks.
[0061] Calculate the index number of the file hit ring based on the path name of the target file, wherein the file hit ring is a circular array with a preset length and comprises at least two file hit blocks.
[0062] In the calculation of the index number, each character of the path name is converted into a coded value in sequence, the coded values corresponding to each character are summed up, the sum result value is calculated modulo the preset length value of the file hit ring, and the index number of the file hit ring is obtained.
[0063] For the convenience of understanding, the path name of the target file is described by way of example. The path name is usually a text describing the location of the target file, usually separated by “ / ”, for example: home / xxx / abc.txt, etc. The above is only an example, and the embodiments of the present application are not limited thereto.
[0064] Since the path name may contain Chinese characters, English letters and / or English symbols, the conversion method of the path name into coded values will be different. When the path name contains Chinese characters, the Chinese characters are converted into utf-8 coded values, the English letters in the path name are converted into coded values using the alphabet sequence ALPHABET (e.g. normal alphabet sequence a=1, b=2, c=3, etc.), and the English symbols in the path name are converted into coded values using ASCII encoding. The above three conversion methods need to be determined according to the actual Chinese characters, English letters and / or English symbols in the path name. For the specific implementation process of how to convert into coded values, please refer to the specific description of related technologies, which will not be described one by one in the embodiments of the present application. The coded values are added up one by one to obtain a sum result value SUM.
[0065] For the convenience of understanding the hit ring, please refer to Figure 2 , Figure 2 An exemplary description of a file hit ring provided by an embodiment of the present application, the file hit block is a data structure, including file path name PATH, file path length LEN, file INODE, state STATE, last hit time TIME, hit count COUNT, hit flag FLAG, wherein the file path name PATH is a word describing the location of the file, usually divided by " / ", for example: "home / xxx / abc.txt"; the file path length LEN is the length of the file path name word, the length of each English character is 1, and the length of Chinese character is 2; the file INODE is the actual location of the file in the file system; the state STATE is to indicate whether the file hit block is valid, there are two states of valid and invalid; the last hit time TIME is to record the last time when the file hit block is found; the hit count COUNT is to record the number of times when the file hit block is found. It should be noted that, Figure 2 The description is based on the example that the file hit ring contains 8 file hit blocks, it should be clear that, Figure 2 It is only an exemplary example, and the preset length of the file hit ring can be flexibly adjusted.
[0066] The file hit ring is an array with a preset length of CSIZE, which contains file hit blocks, and the file hit block corresponds to an index number, assuming that the index number of the file hit block is 0 to CSIZE-1.
[0067] When determining the index number, the sum result value SUM and the preset length value CSIZE of the file hit ring are calculated by modulo, and the result CINDEX is obtained, which is the index of the file hit ring, and the index number of the file hit ring is obtained.
[0068] 102. Traverse the file hit block to find the target file.
[0069] In a file hit ring, it may contain one file or at least two files. When there is only one file in the file hit block, the index number of the file hit ring corresponds to the file hit block in this scenario, and only one query is needed to complete the search of the target file, which greatly saves the search time and improves the search efficiency; when the file hit block contains at least two files, only two queries are needed in this scenario, including one is to find the file hit block corresponding to the index number, and the other is to query the target file from the file hit block.
[0070] Therefore, the file hit ring is used to accelerate the searching speed of the file path in the embodiment of the application, and the file hit block is used to solve the conflict caused by the same index number of the file hit ring, that is, the target file can be found by only twice comparison in the worst case.
[0071] The method for searching the file path provided by the disclosure searches the file hit block from the file hit ring based on the index number of the target file, the file hit ring is a circular array with a preset length, contains at least two file hit blocks, and the target file is searched by traversing the file hit blocks. Compared with the related art, the file hit ring is introduced in the embodiment of the application, the target file is searched from the file hit ring by the index number, the time for searching the target file can be greatly shortened, and the searching efficiency is improved.
[0072] The time for searching the target file can be greatly shortened, and the searching efficiency is improved.
[0073] As a further extension of step 102, searching the target file by traversing the file hit blocks includes: determining the first file path name length according to the path name; determining whether the first file path name length is equal to the second file path name length in turn; wherein the second file path name length is the file path name length corresponding to each file hit block in the file hit block; determining the decay / increase processing of the hit mark of the file hit block according to the comparison result of the file path name length; comparing the first character with the second character in turn from the first character, and determining whether the first character is the same as the second character, wherein the first character is the first character of the path name of the target file, and the second character is the first character of the path name corresponding to the file hit block with the same file path name length in the file hit block; if the first character is the same as the second character, comparing the next character of the path name of the target file in turn until all characters of the path name of the target file are compared; when all characters are the same, increasing the hit mark of the file hit block, and modifying the hit state of the file hit block to the valid state.
[0074] In order to further improve the searching efficiency, the embodiment of the application further provides a method for searching the file path, as shown in Figure 3 The method comprises:
[0075] 201, searching the file hit block from the file hit ring based on the index number of the target file, the file hit ring is a circular array with a preset length, and contains at least two file hit blocks.
[0076] 202, searching the target file by traversing the file hit blocks.
[0077] For the implementation process of steps 201 and 202, please refer to Figure 1The detailed description of the related specific description, the embodiments of the present application will not be described here.
[0078] 203、According to the search result of the target file, mark the target file as a hit.
[0079] It can be understood that the hit mark can be various marks for identifying the target file, such as a label, etc., to identify the target file faster.
[0080] Further, in the present embodiment, the hit mark can be a value recording the number of hits of the target file, and if the target file search is successful, the hit mark of the target file that has successfully searched is incremented by one; if the target file search fails, the hit mark of the target file that has not successfully searched is decremented by one.
[0081] If the file path name lengths are not equal (the search fails), the hit marks of the file hit blocks that are not equal are decayed until the hit marks decay to zero; if the file path name lengths are equal (the search succeeds), the hit marks of the file hit blocks that are equal are increased. In the present embodiment, the decay process is a decrement by one process, and the increase process is an increment by one process. As a feasible way of the present embodiment, the decay and increase processes are not limited to increment by one or decrement by one processes, and any value that can represent decay and increase can be implemented.
[0082] In the specific implementation process, the following steps are included:
[0083] Step one: set the hit mark bit FLAG in the file hit block to 1, introduce a hit mark statistic SUM set to BSIZE, and introduce a position mark POS set to 1;
[0084] Step two: sequentially traverse the file hit block, compare the first file path name length with the second file path length of the file hit block, set the hit mark bit FLAG of the file hit block that is not equal to 0, and decrement the hit mark statistic SUM by 1;
[0085] Step three: sequentially traverse the file hit block, skip the file hit block with FLAG set to 0, compare the POSth character in the file path name with the POSth character in the file path name of the file hit block, set FLAG to 0 when the first comparison is not equal, and decrement SUM by 1. After the traversal is completed, POS is incremented by 1;
[0086] Step four: repeat step three, if the SUM is 0, it means that the index number is not acquired, the hit state of the file hit block is modified to invalid state, and the algorithm is terminated; if the POS is equal to the file path name length, the algorithm is continued;
[0087] Step five: if the SUM is 1, the index number of the file hit block with FLAG being 1 is acquired, and the hit state of the file hit block is modified to valid state; if the SUM is other values, it means that the index number is not acquired.
[0088] 204, based on the hit mark, the target file in the file hit block is searched.
[0089] As a first feasible mode of the embodiment of the present application, when the files in the file hit block are managed, the files in the file hit block are sorted based on the hit mark, and the file at the last of the sorting is deleted or replaced.
[0090] As a second feasible mode of the embodiment of the present application, when the hit mark is the hit times, all the files are sorted based on the hit times, and when the files in the file hit block are managed, the files in the file hit block are deleted or replaced based on the actual requirement of the user without sorting.
[0091] As a third feasible mode of the embodiment of the present application, after the files in the file hit block are sorted based on the hit mark, the sorting result is numbered, and when the files are managed (searched, deleted or replaced), the management can be based on the numbering. The above three application scenarios are flexibly switched, and the embodiment of the present application is not limited.
[0092] In this embodiment, the purpose of sorting is to improve search efficiency. When searching for the target file in the above steps, files ranked higher in the sorting can be searched first. If the target file is successfully found, the last hit time and hit mark of the successfully found file hit block are incremented, and the hit mark of the unsuccessfully found file hit block is decremented. That is, after each successful search, the information of the file hit block needs to be updated, that is, the files in the file hit block are sorted based on the hit mark: the most recent hit time TIME of the successfully found file hit block is set to the time when the search was successful, and the hit count COUNT is incremented by 1. The hit count COUNT of other file hit blocks is decremented by 1. It is determined whether the files in the file hit block meet the preset deletion conditions, and the files that meet the preset deletion conditions are deleted. In this embodiment, the preset deletion condition is that the hit count is 0. When the hit count COUNT of the file hit block is 0, the corresponding file in the file hit block is deleted. It should be noted that the preset deletion conditions can be flexibly set according to different application scenarios. The above description is only an example and not a specific limitation.
[0093] For example:
[0094] Step 1: Obtain the file hit blocks based on the index number BINDEX;
[0095] Step 2: Set the file path length LEN of the file hit block to 0, the hit count COUNT to 0, and the status STATE to invalid.
[0096] Step 3: Sort the hit blocks of the file in descending order by the number of hits (COUNT).
[0097] In practical applications, the file hit ring needs to be maintained periodically. The time interval is TIMESET. The current time TIMENOW is obtained, and file hit blocks whose current time TIMENOW minus the most recent hit time TIME is greater than a preset add time TIMEOUT are deleted. The preset add time TIMEOUT is an empirical value, such as setting it to 900 seconds, 800 seconds, etc. This application embodiment does not limit this.
[0098] The above embodiments describe in detail the process of finding and deleting files based on file hit rings. The following describes the addition of file hit blocks in the file hit ring.
[0099] Add new operations for file hit blocks:
[0100] Step 1: According to the preset new conditions, traverse the file hit blocks sequentially to determine whether there are blank file hit blocks. The preset new conditions are that the file path length LEN is 0, the number of hits COUNT is 0, the status STATE is invalid, and its index number is BINDEX.
[0101] Step 2: Set the file path name PATH of the blank file hit block to the actual file path name, the file path length LEN to the actual file path length, the hit count COUNT to 1, the status STATE to valid, the most recent hit time TIME to the current time, and the file INODE to the actual file node. Through the above operations, the blank file hit block is added.
[0102] The above embodiments have described the target file search process in detail, which introduces a pre-search method (based on file hit ring search). When the operating system needs to search for a file path, it first uses the pre-search method. If the search fails, it then uses the classic search method, which is to search down level by level starting from the root directory.
[0103] In summary, using file hit rings accelerates file path lookup, while using file hit blocks resolves conflicts caused by identical ring index numbers in filenames. In the worst case, only two comparisons are needed to find the existing target file node. By employing appropriate parameters, such as the set of parameters proposed in this application, the ALPHABET value corresponding to each character in the path name allows for better insertion balance in the file hit ring. The length of the file hit ring (CSIZE) and the length of the file hit block (BSIZE) can adjust resource usage. Regular maintenance, with timed TIMESET and preset addition time TIMEOUT, can adjust the system's response sensitivity.
[0104] Figure 4 This is a schematic diagram of the structure of a file path finding device provided in an embodiment of the present disclosure, as shown below. Figure 4 As shown, it includes:
[0105] The first search unit 31 is used to search for file hit blocks from the file hit ring based on the index number of the target file. The file hit ring is a ring-shaped array with a preset length, containing at least two file hit blocks.
[0106] The second search unit 32 is used to traverse the file hit blocks to search for the target file.
[0107] Furthermore, in one possible implementation of the embodiments of this application, such as Figure 4 As shown, the method apparatus further includes:
[0108] The marking unit 33 is used to mark the target file as a hit based on the search results of the target file;
[0109] The management unit 34 is used to manage the target file found by the file hit block based on the hit mark.
[0110] Furthermore, in one possible implementation of the embodiments of this application, such as Figure 5 As shown, the marking unit 33 includes:
[0111] The first marking module 331 is used to increment the number of hit marks of the successfully found target file when the target file is successfully found.
[0112] The second marking module 332 is used to decrement the number of hit marks for the unsuccessfully found target files when the target file search fails.
[0113] Furthermore, in one possible implementation of this application embodiment, the management unit 34 is also used to sort the files in the file hit block according to the hit flag.
[0114] Furthermore, in one possible implementation of the embodiments of this application, such as Figure 5 As shown, the management unit 34 includes:
[0115] The judgment module 341 is used to determine whether the file in the file hit block meets the preset deletion conditions based on the hit mark;
[0116] Deletion module 342 is used to delete the file when it is determined that the preset deletion conditions are met;
[0117] Replacement module 343 is used to replace the file in the file hit block based on the hit mark.
[0118] Furthermore, in one possible implementation of the embodiments of this application, such as Figure 5 As shown, the device further includes:
[0119] Traversal unit 35 is used to traverse the file hit blocks sequentially according to preset new conditions;
[0120] Determining unit 36 is used to determine whether there is a blank file hit block;
[0121] Setting unit 37 is used to set the index number of the blank file hit block based on the file path name of the successfully found new file when it is determined that the blank file hit block exists;
[0122] The newly added unit 38 is used to store the file to be added in the blank file hit block to complete the addition processing of the blank file hit block.
[0123] The file path search device provided in this application embodiment searches for file hit blocks from a file hit ring based on the index number of the target file. The file hit ring is a circular array of a preset length, containing at least two file hit blocks. The target file is searched by traversing the file hit blocks. Compared with related technologies, this application embodiment introduces a file hit ring and searches for the target file from the file hit ring using the index number, which can greatly shorten the time for searching the target file and thus improve search efficiency.
[0124] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatus of this embodiment, and the principle is the same, so it is not limited in this embodiment.
[0125] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0126] Figure 6 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0127] like Figure 6 As shown, device 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 502 or a computer program loaded from storage unit 508 into RAM (Random Access Memory) 503. RAM 503 can also store various programs and data required for the operation of device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. I / O (Input / Output) interface 505 is also connected to bus 504.
[0128] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0129] The computing unit 501 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as file path lookup methods. For example, in some embodiments, the file path lookup method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the aforementioned file path lookup method by any other suitable means (e.g., by means of firmware).
[0130] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0131] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0132] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0133] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0134] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.
[0135] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0136] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0137] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0138] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for finding file paths, characterized in that, include: Each character of the target file's path name is converted into an encoded value. The encoded values corresponding to each character are summed. The sum is then moduloed by the preset length of the file hit ring to obtain the index number of the file hit ring. Based on the index number of the target file, the file hit block is searched from the file hit ring, wherein the file hit ring is a ring-shaped array of a preset length, containing at least two file hit blocks; wherein, the file hit block contains at least one file; Traverse the file hit blocks to find the target file.
2. The search method according to claim 1, characterized in that, The method further includes: Based on the search results for the target file, the target file is marked as a hit; The target file is located and managed based on the hit markers.
3. The search method according to claim 2, characterized in that, The step of marking the target file as a hit based on the search results of the target file includes: If the target file is found successfully, the number of hit markers for the successfully found target file is incremented. If the target file search fails, the number of hit markers for the unsuccessfully searched target files is reduced.
4. The search method according to claim 3, characterized in that, The management of finding the target file based on the hit marker includes: The files in the file hit block are sorted according to the hit flag.
5. The search method according to any one of claims 2-4, characterized in that, The management of finding the target file based on the hit marker includes: Based on the hit marker, determine whether the file in the file hit block meets the preset deletion conditions; if it does, delete the file; or Replace the file in the file hit block based on the hit flag.
6. The search method according to claim 1, characterized in that, The method further includes: Based on the preset new conditions, the file hit blocks are traversed sequentially to determine whether there are any blank file hit blocks; If it exists, set the index number of the blank file hit block based on the file path name of the successfully found file to be added; The file to be added is stored in the blank file hit block to complete the addition process of the blank file hit block.
7. A file path lookup device, characterized in that, include: The calculation unit is used to convert each character of the path name of the target file into an encoded value, sum the encoded values corresponding to each character, and perform a modulo operation based on the summation result and the preset length value of the file hit ring to obtain the index number of the file hit ring. The first search unit is used to search for file hit blocks from the file hit ring based on the index number of the target file. The file hit ring is a circular array of a preset length, containing at least two file hit blocks; wherein, the file hit block contains at least one file. The second search unit is used to traverse the file hit blocks to find the target file.
8. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
9. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.
10. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.
Citation Information
Patent Citations
File searching method and device, mobile terminal and computer-readable storage medium
CN107562835A
Method and device for storing, retrieving and deleting embedded audio and video data, and memory
CN112558873A