CN108573009B - File searching method and device - Google Patents

File searching method and device Download PDF

Info

Publication number
CN108573009B
CN108573009B CN201710531455.XA CN201710531455A CN108573009B CN 108573009 B CN108573009 B CN 108573009B CN 201710531455 A CN201710531455 A CN 201710531455A CN 108573009 B CN108573009 B CN 108573009B
Authority
CN
China
Prior art keywords
file
target
warehouse
repository
version number
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.)
Active
Application number
CN201710531455.XA
Other languages
Chinese (zh)
Other versions
CN108573009A (en
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.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology 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 Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201710531455.XA priority Critical patent/CN108573009B/en
Publication of CN108573009A publication Critical patent/CN108573009A/en
Application granted granted Critical
Publication of CN108573009B publication Critical patent/CN108573009B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

The embodiment of the invention provides a file searching method and a device, which are applied to any equipment in a local area network, and the method comprises the following steps: acquiring a downloading request for downloading a target file, wherein the downloading request carries an identifier of a target file warehouse where the target file is located; selecting target equipment from the equipment recorded by the locally stored incidence relation table according to the identification of the target file warehouse; sending a search request for a target file to a target device to cause the target device to search for the target file in its local file repository; and receiving a search result fed back by the target equipment, and obtaining a search result aiming at the target file according to the received search result. By applying the technical scheme provided by the embodiment of the invention, the selected target equipment which possibly comprises the target file is used for searching the target file, so that the searching range is reduced, the searching has pertinence, the invalid searching is reduced, and the searching efficiency can be improved.

Description

File searching method and device
Technical Field
The invention relates to the technical field of internet, in particular to a file searching method and device.
Background
In actual work, any device in the local area network needs to download a certain file from the network side, and generally, the file can be downloaded from the device in the local area network preferentially under the condition that the file is possibly stored on other devices in the local area network, so that the downloading efficiency can be improved.
Taking a network disk applied by an enterprise as an example, a cloud server deploys a network disk server, and a network disk client is deployed on each device in a network disk local area network. The file warehouse of the network disk client in the device is used for storing files and can be synchronized to the network disk server, and certainly, the file warehouse of the network disk server can be synchronized to the network disk client, and what kind of operation can be specifically set according to different permissions of the network disk client. In the process of synchronizing the file warehouse of the network disk server to the local device, the file needs to be downloaded from the corresponding file warehouse, and the shared files in the enterprise are the same. Therefore, the file to be downloaded is most likely to be synchronized to the cloud server from the device in the local area network, that is, the file required to be downloaded by the device is most likely to exist in the file repository of the device in the local area network, so that the file can be preferentially downloaded from other devices in the local area network.
In the prior art, downloading files from devices in the local area network is mainly implemented by accessing the devices in the local area network one by one. Specifically, the device that is not accessed in the local area network is accessed, the currently accessed device searches the target file in the local file repository, and if the target file is stored in the local file repository of the currently accessed device, the target file can be searched, and the target file is returned to the client. If the target file is not stored in the local file warehouse of the current accessed device, the target file cannot be searched, and the target file is not stored locally in the current accessed device, so that the search is invalid. The next unaccessed device will be accessed. Searching for the target file in this way may require multiple invalid searches, or even all searches may be invalid, throughout the search process.
Therefore, the searching method has blindness for the access of other devices in the local area network, and the searching efficiency is low.
Disclosure of Invention
The embodiment of the invention aims to provide a file searching method and device so as to achieve the aim of improving the searching efficiency. The specific technical scheme is as follows:
in a first aspect, a file search method provided in an embodiment of the present invention is applied to any device in a local area network, and the method includes:
acquiring a downloading request for downloading a target file, wherein the downloading request carries an identifier of a target file warehouse where the target file is located;
selecting target equipment from equipment recorded in an incidence relation table stored locally according to the identification of the target file warehouse, wherein the incidence relation table records the corresponding relation between other equipment in the local area network and the identification of the local file warehouse of the equipment, the file warehouse is a folder for storing files, and the files refer to files synchronized to a network end and files downloaded from the network end;
sending a search request for the target file to the target device to cause the target device to search for the target file in its local file repository;
and receiving a search result fed back by the target equipment, and obtaining a search result aiming at the target file according to the received search result.
Optionally, the association relationship table records the correspondence between other devices in the local area network and the warehouse information table thereof, and the warehouse information table of one device is used for recording the identifier of the local file warehouse of the device;
the method further comprises the following steps:
receiving a target repository information table broadcasted by a target broadcasting device, wherein the target repository information table records an identifier of a local file repository of the target broadcasting device, and the target broadcasting device is: any of the other devices within the local area network;
judging whether the target broadcasting equipment is recorded in an incidence relation table stored locally;
if yes, updating a warehouse information table corresponding to the target broadcasting equipment in an incidence relation table stored locally by using the received target warehouse information table;
and if the target broadcast equipment does not exist, correspondingly adding the target broadcast equipment and the target warehouse information table transmitted by the target broadcast equipment into the locally stored association relation table.
Optionally, the repository information table of one device is further configured to record a version number of a local file repository of the device;
the version number of a file warehouse and the version number of a file in the file warehouse have a preset incidence relation;
the downloading request also carries the version number of the target file;
the step of selecting a target device from devices recorded in an incidence relation table stored locally according to the identifier of the target file repository includes:
and selecting target equipment from the equipment recorded in the incidence relation table stored locally according to the identification of the target file warehouse, the version number of the target file and the preset incidence relation.
Optionally, the method further includes:
determining a file repository having locally existing file updates;
and increasing the version number of the determined file warehouse and updating the version number of the file corresponding to update in the determined file warehouse to the version number of the file warehouse.
Optionally, the step of selecting a target device from devices recorded in an association table stored locally according to the identifier of the target file repository, the version number of the target file, and the preset association includes:
selecting a file warehouse with the same identifier as that of the target file warehouse and the version number not less than that of the target file from the equipment recorded by the incidence relation table;
and determining the device corresponding to the selected file warehouse as the target device.
Optionally, the file searching method further includes:
under the condition of meeting the updating condition of the warehouse information table, generating a latest warehouse information table according to the identification of the local file warehouse;
broadcasting the latest warehouse information table.
Optionally, generating the latest repository information table according to the identifier of the local file repository under the condition that the update condition of the repository information table is satisfied includes:
judging whether the number of the local file warehouses changes or not, if so, generating a latest warehouse information table according to the identification of the local file warehouses; or
And judging whether a local file warehouse with a changed version number exists, and if so, generating a latest warehouse information table comprising a local file warehouse identifier and a local file warehouse version number.
Optionally, the method further includes:
obtaining a target file according to the search result aiming at the target file;
judging whether the target file warehouse exists locally or not;
if so, storing the target file in the local target file warehouse;
and if the target file does not exist, establishing the target file warehouse locally, and storing the target file in the local target file warehouse.
In a second aspect, an apparatus for searching for a file provided in an embodiment of the present invention is applied to any device in a local area network, and the apparatus includes:
the device comprises a first obtaining module, a second obtaining module and a third obtaining module, wherein the first obtaining module is used for obtaining a downloading request for downloading a target file, and the downloading request carries an identifier of a target file warehouse where the target file is located;
the selection module is used for selecting target equipment from equipment recorded in an incidence relation table stored locally according to the identification of the target file warehouse, wherein the incidence relation table records the corresponding relation between other equipment in the local area network and the identification of the local file warehouse of the equipment, the file warehouse is a folder used for storing files, and the files refer to files synchronized to a network end and files downloaded from the network end;
a sending module, configured to send a search request for the target file to the target device, so that the target device searches for the target file in its local file repository;
and the second receiving module is used for receiving the search result fed back by the target equipment and obtaining the search result aiming at the target file according to the received search result.
Optionally, the association relationship table records the correspondence between other devices in the local area network and the warehouse information table thereof, and the warehouse information table of one device is used for recording the identifier of the local file warehouse of the device;
the device further comprises:
a third receiving module, configured to receive a target repository information table broadcasted by a target broadcasting device, where the target repository information table records an identifier of a local file repository of the target broadcasting device, and the target broadcasting device is: any of the other devices within the local area network;
the first judgment module is used for judging whether the target broadcasting equipment is recorded in an incidence relation table stored locally;
the updating module is used for updating the warehouse information table corresponding to the target broadcasting equipment in the incidence relation table stored locally by using the received target warehouse information table when the judgment result of the judging module is present;
and the adding module is used for correspondingly adding the target broadcasting equipment and the target warehouse information table sent by the target broadcasting equipment into the incidence relation table stored locally when the judgment result of the judging module is that the target broadcasting equipment does not exist.
Optionally, the repository information table of one device is further configured to record a version number of a local file repository of the device;
the version number of a file warehouse and the version number of a file in the file warehouse have a preset incidence relation;
the downloading request also carries the version number of the target file;
the selection module is specifically configured to select a target device from devices recorded in an association table stored locally according to the identifier of the target file repository, the version number of the target file, and the preset association.
Optionally, the apparatus further comprises:
the determining module is used for determining a file warehouse with locally existing file updates;
and the processing module is used for increasing the version number of the determined file warehouse and updating the version number of the file which is correspondingly updated in the determined file warehouse into the version number of the file warehouse.
Optionally, the selecting module includes:
a selecting unit, configured to select, from the device recorded in the association table, a file repository whose identifier is the same as the identifier of the target file repository and whose version number is not less than the version number of the target file;
and the determining unit is used for determining the equipment corresponding to the selected file warehouse as target equipment.
Optionally, the file searching method further includes:
the generating module is used for generating a latest warehouse information table according to the identification of the local file warehouse under the condition of meeting the updating condition of the warehouse information table;
and the broadcasting module is used for broadcasting the latest warehouse information table.
Optionally, the generating module includes: the device comprises a first judging unit and a first generating unit, or a second judging unit and a second generating unit;
the first judging unit is used for judging whether the number of the local file warehouses changes or not;
the first generating unit is used for generating a latest warehouse information table according to the identification of the local file warehouse when the judgment result of the first judging unit is yes;
the second judging unit is used for judging whether a local file warehouse with a changed version number exists or not;
and the second generating unit is configured to generate a latest repository information table including a local file repository identifier and a local file repository version number when the determination result of the second determining unit is yes.
Optionally, the file searching apparatus further includes:
the obtaining module is used for obtaining the target file according to the search result aiming at the target file;
the second judgment module is used for judging whether the target file warehouse exists locally or not;
the first storage module is used for storing the target file in the local target file warehouse when the judgment result of the second judgment module is that the target file exists;
and the second storage module is used for establishing the target file warehouse locally and storing the target file in the local target file warehouse when the judgment result of the second judgment module is that the target file warehouse does not exist.
The embodiment of the invention provides a file searching method and a file searching device, which are used for obtaining a downloading request for downloading a target file, wherein the downloading request carries an identifier of a target file warehouse where the target file is located; selecting target equipment from equipment recorded in an incidence relation table stored locally, wherein the incidence relation table records the corresponding relation between other equipment in a local area network and the identification of a local file warehouse of the equipment, the file warehouse is a folder for storing files, and the files refer to files synchronized to a network end and files downloaded from the network end; and according to the comparison between the target file warehouse identification and the file warehouse identification in the association relation table, determining the target equipment possibly containing the target file. And then sending a search request to the target equipment to enable the target equipment to search the target file in a local file warehouse. And receiving a search result fed back by the target equipment, and finally obtaining a search result aiming at the target file according to the received search result. By applying the technical scheme provided by the embodiment of the invention, the selected target equipment which possibly comprises the target file is used for searching the target file, so that the searching range is reduced, the searching has pertinence, the invalid searching is reduced, and the searching efficiency can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a first flowchart of a file searching method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating an update method of an association table;
FIG. 3 is a second flowchart of a file searching method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a first structure of a file searching apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an association table update sub-apparatus;
fig. 6 is a schematic diagram of a second structure of the file searching apparatus according to the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, when any device in a local area network wants to download a file in the local area network, a search request needs to be sent to other devices except the device one by one to perform searching, and the searching efficiency is low. In order to solve the technical problem in the prior art, that is, to improve the search efficiency of a target file, embodiments of the present invention provide a file search method and apparatus, which are applied to any device in a local area network.
The device in the local area network is provided with a file warehouse which is a folder for storing files, and the files refer to files synchronized to a network end and files downloaded from the network end. Where the file may be a text document, a picture, a video, a program, and so forth. Files typically have a three letter file extension that indicates the file type (e.g., picture files are often saved in JPEG format and the file extension is. jpg). Each file repository has an identifier, which is used to mark the corresponding file repository, and may be a name of the file repository, for example, a file category name stored inside the file repository may be used as the name of the corresponding file repository. Each file also has an identifier, which is used to mark the corresponding file, and may be the name of the file.
In addition, both the file repository and the file may have version numbers, where the version number of the file repository may be used to record operations on the file in the file repository, for example, a total of 2 operations on the file under one file repository, including replacing one file, and adding one file, and then 2 may be used to indicate the version number of the file repository. The version number of the file is used to identify the file version, for example, if a file is added to the file repository, and the version number of the file repository changes to 3, then 3 may be used as the version number of the added file.
The execution subject mentioned herein may be any device that executes the downloading step provided in this embodiment in a local area network, for example, for any device in an office local area network of the jin shan corporation, if a file is downloaded through the downloading step provided by the implementation of the present invention, this device is the execution subject in the downloading process.
It should be noted that, as a whole, the status of each device in a local area network may be equal, and each device in the local area network may obtain a request for downloading a file, so as to achieve the purpose of searching for a target file from devices other than itself.
First, a file searching method provided by an embodiment of the present invention is described below.
Referring to fig. 1, fig. 1 is a first flowchart illustrating a file search method according to an embodiment of the present invention, where the file search method is applied to any device in a local area network, and the method includes:
s101, a downloading request for downloading the target file is obtained, wherein the downloading request carries an identifier of a target file warehouse where the target file is located.
The target file is a file to be downloaded, and the download request may be generated by the execution main body itself, for example, a user issues a download command through the execution main body to generate the download request, or of course, the download request may be sent to the execution main body by a device other than the execution main body in the local area network, or sent to the execution main body by a device other than the local area network. Specifically, the download request is obtained from, and is not particularly limited herein.
When a device wants to download a target file from other devices in a local area network, it needs to know the identifier of a target file repository where the target file is located in advance.
In an implementation manner of the embodiment of the present invention, the identifier of the target file repository in this step may be obtained by the following method: in the local area network, the corresponding relation between the identifier of the file warehouse on any device and the file in the file warehouse is preset, and the corresponding relation can be informed to a user of the local area network in advance, wherein other devices are devices except an execution main body in the local area network. Therefore, according to the corresponding relation between the file warehouse identification and the file and the target file, the user can know the identification of the target file warehouse in advance and input the identification into the execution main body through the user. For example, the identifier of the file repository is a category name to which the file in the corresponding file repository belongs, specifically, all the patent application documents fed back by the agent are stored in the file repository identified as "unapproved patent application documents", and the patent application documents fed back by the agent belong to the class of the unapproved patent application documents, so that the identifier of the target file repository can be predetermined as "unapproved patent application documents" according to the "one file search method and apparatus — the initial document returned by the agent" of the target file to be downloaded and the corresponding relationship between the identifier of the file repository and the file, and the execution subject can know the identifier of the target file repository where the target file is located in a user input manner.
In another implementation manner of the embodiment of the present invention, the identifier of the target file repository in this step may be obtained by the following method: the identification of the target file repository is communicated through an intermediary device so that the executing agent knows the identification of the target file repository. For example, in an enterprise network disk used by a jin shan enterprise, a file repository of a network disk server may be synchronized by a local area network device of the jin shan enterprise to the network disk server, and may also be synchronized by local area network devices of other enterprises to the network disk server. The execution main body of the embodiment of the invention can actively request the network disk server to inquire the file warehouse and the files inside the file warehouse, so that the network disk server sends the file warehouse and the file identifiers inside the file warehouse to the execution main body; or the network disk server side can actively push the file warehouse and the identification of the internal file thereof to the execution main body. In one case, the execution subject knows the target file to be downloaded in advance, and can query the target file from the received file repository and the identifier of the file therein, so that the identifier of the target file repository can be known. In another case, the user or the execution subject may select which file to download from the received file repository and the identifiers of the internal files thereof, and thus know the target file and the identifier of the target file repository.
It should be noted that, when any device in the local area network needs to download the target file, what manner is used to obtain the file repository identifier of the target file, which is not specifically limited herein.
Taking a network disk applied by an enterprise as an example, a network disk client is deployed on each device in a local area network, and a file warehouse of one network disk client is a local file warehouse of a device corresponding to the network disk client. The operation authority corresponding to each network disk client can be the same or different. According to different authorities, any one or any combination of the following operations can be performed on the file warehouse of the network disk client: adding a file, replacing a file, or deleting a file. Under the condition that the authority permits, after any one of the operations is carried out on the file warehouse of the network disk client, the file warehouse corresponding to the network disk server can be correspondingly changed through synchronous operation. Specifically, if a file is added or replaced in a file repository of a network disk client, a corresponding file is added or replaced in the file repository corresponding to the network disk server through synchronous operation. If a file is deleted from a file warehouse of a network disk client, the file in the file warehouse corresponding to the network disk server is deleted to a recycle bin of the network disk server through synchronous operation. If a file is added to the file warehouse of one network disk client in the local area network and is synchronized to the file warehouse corresponding to the network disk server, the network disk server can push a message about the file added to the file warehouse to other network disk clients needing to synchronize the file warehouse, and the network disk client can receive a downloading request for downloading the file by clicking a downloading mode through a user.
S102, selecting target equipment from the equipment recorded in the locally stored association relation table according to the identification of the target file repository, wherein the association relation table records the corresponding relation between other equipment in the local area network and the identification of the local file repository of the other equipment, the file repository is a folder for storing files, and the files refer to files synchronized to the network end and files downloaded from the network end.
The other devices in this step are devices other than the execution subject in this local area network.
In each device in the local area network according to the embodiment of the present invention, the file repository has file repository information XfileWareHouse, and the file has file information Xfile, where the Xfile is mainly used to describe information of the file and may include an identifier Xid of the file, and the identifier Xid of the file is used to uniquely identify the file. The XfileWareHouse may include an identification id of the file repository, which is used to uniquely identify the file repository.
The target file may exist because in a file repository having an identity that is the same as the identity of the target file repository, while in a file repository having an identity that is different from the identity of the target file repository, the target file may not exist. Therefore, according to the identification of the target file warehouse, the target device selected from the devices recorded in the locally stored association table is likely to have the target file, and the target file is not likely to exist in the devices except the target device in other devices. Therefore, the target file only exists on the target device, and the number of the target devices is smaller than that of other devices in the local area network, that is, the range of the target device is smaller than that of other devices in the local area network.
Illustratively, the devices in the local area network include a device a, a device B, a device C, a device D, a device E, and a device F, the execution subject is the device C, the device a has file warehouses identified as "intellectual property related file warehouse" and "contract related file warehouse", the device B has file warehouses identified as "project one related file warehouse", "project two related file warehouse", and "contract related file warehouse", the device D has file warehouses identified as "project one related file warehouse" and "project two related file warehouse", the device E has file warehouses identified as "project three related file warehouse" and "project four related file warehouse", the device F has "intellectual property related file warehouse", "contract related file warehouse", "project one related file warehouse", "project two related file warehouse", "and" project four related file warehouse A "project three-related file repository" and a "project four-related file repository".
The devices in the association table stored in the device C may include some devices other than the execution host in the local area network, in which case the association table may be as shown in table 1.
The identifier of the target file warehouse carried in the download request is an item-one related file warehouse, and the association table stored locally by the device C is shown in table 1.
TABLE 1
Figure BDA0001339438420000111
The devices in the association table stored in the device C may also include all devices except the execution host in the local area network, in which case the association table may be as shown in table 2.
The identifier of the target file warehouse carried in the download request is an intellectual property related file warehouse, and the incidence relation table stored locally by the equipment C is shown in table 2.
TABLE 2
Figure BDA0001339438420000121
S103, sending a search request about the target file to the target device so that the target device searches the target file in a local file warehouse of the target device;
in this step, only the search request is sent to the target device, and the range of the target device is reduced compared with other devices in the local area network, so that the search range for the target file is smaller compared with the prior art. And because the target file only can exist in the file warehouse of the target device but cannot exist in the device which cannot be used as the target device, the search in the embodiment of the invention has pertinence and high search efficiency.
And S104, receiving the search result fed back by the target device, and obtaining the search result aiming at the target file according to the received search result.
The form of the search result fed back by the target device may be various, but may include two types, one type containing information that the target file is searched for, and the other type containing information that the target file is not searched for. The former may be embodied as a target file, or information of "target file searched", and the latter may be embodied as information of "target file not searched". The search result fed back by the target device is specifically in which form, and is not specifically limited herein.
The search result for the target file can be obtained according to the received search result, and the search result for the target file can also have many forms, but can also comprise two types, wherein one type comprises the information that the target file is searched, and the other type comprises the information that the target file is not searched. The former may be specific to the target file obtained or to which specific device contains the target file. The latter may specifically be that the target file is not searched for, or that no device determined to contain the target file is found. The form of the search result for the target file is not particularly limited.
In the embodiment of the present invention, if at least one target device exists in all target devices in the other devices, the file repository of the at least one target device stores a target file. Through the steps, the search result which is fed back by at least one target device and contains the information of the searched target file can be received, and finally the search result aiming at the target file can be obtained according to the received search result. In this case, the search result for the target file may be that the target device is determined to store the target file, or that the target file is directly included in the search result.
In addition, if all target devices in other devices do not have target files, after all target devices search for target files locally, the fed-back search results are all search results containing information of the target files which are not searched, and finally the search results for the target files are obtained according to the received search results. At this time, the search result for the target file is that the target file is not searched, or that the device determined to contain the target file is not found.
By applying the embodiment shown in fig. 1, the target device that may contain the target file may be determined according to the comparison between the target file repository identifier and the file repository identifier in the association table. And then sending a search request to the target equipment to enable the target equipment to search the target file in a local file warehouse. And receiving a search result fed back by the target equipment, and finally obtaining a search result aiming at the target file according to the received search result. The selected target equipment which possibly contains the target file is used for searching the target file, the searching range is narrowed, the searching has pertinence, the invalid searching is reduced, and the searching efficiency can be improved.
In an implementation manner of the embodiment of the present invention, all target devices may be determined through S102, and a search request for a target file is sent to each target device through S103, so that each target device searches for the target file in its local file repository. And receiving the search result fed back by each device through S104, and finally obtaining the search result aiming at the target file.
In another implementation manner of the embodiment of the present invention, one target device, or a part of the target devices or all of the target devices may be determined at a time through S102, and a search request for a target file is sent to the target devices one by one through S103, so that the target device searches for the target file in a local file repository. And receiving the search result fed back by the current target device through S104, and if the search result contains the information of the searched target file, obtaining the target file or positioning the device with the target file, thus finishing the search. If the search result is that the target file is not searched, the search request of the target file is sent to the next target-free device, and the steps are repeated.
In an implementation manner of the embodiment of the present invention, the association relationship table records a correspondence between other devices in the local area network and identifiers of local file repositories thereof, and is specifically implemented in the following manner:
the association relation table records the corresponding relation between other devices in the local area network and the warehouse information table of the devices, and the warehouse information table of one device is used for recording the identification of the local file warehouse of the device.
It can be understood that, a device in the association table corresponds to its own repository information table, and the repository information table of a device records the identifier of the local file repository of the device, which means that the device also corresponds to the identifier of the local file repository of the device.
Illustratively, the devices in the local area network include a device a, a device B, a device C, a device D, a device E, and a device F, the execution subject is the device C, the device a has file warehouses identified as "intellectual property related file warehouse" and "contract related file warehouse", the device B has file warehouses identified as "project one related file warehouse", "project two related file warehouse", and "contract related file warehouse", the device D has file warehouses identified as "project one related file warehouse" and "project two related file warehouse", the device E has file warehouses identified as "project three related file warehouse" and "project four related file warehouse", the device F is provided with file warehouses of an intellectual property related file warehouse, a contract related file warehouse, an item one related file warehouse, an item two related file warehouse, an item three related file warehouse and an item four related file warehouse.
The warehouse information table for device a may be as shown in table 3.
TABLE 3
Figure BDA0001339438420000151
The warehouse information tables of device B, device D, device E, and device F are similar to the warehouse information table of device a, and the corresponding warehouse information tables are not listed one by one here.
The devices in the association table stored in the device C may include some devices in the local area network except the execution host, in which case the association table is shown in table 4:
TABLE 4
Figure BDA0001339438420000152
The devices in the association table stored in device C may also include some devices in the local area network except the execution host, and the association table in this case is similar to table 4 and is not listed here.
In an embodiment of the present invention, based on the embodiment shown in fig. 1, an update step of an association table is further added, referring to fig. 2, fig. 2 is a schematic flow chart of an update manner of the association table, where a corresponding relationship between other devices in the local area network and a warehouse information table of the other devices is recorded in the association table, and a warehouse information table of a device is used for recording an identifier of a local file warehouse of the device, where the update step of the association table may specifically include:
s201, receiving a target warehouse information table broadcasted by target broadcasting equipment, wherein the target warehouse information table records an identifier of a local file warehouse of the target broadcasting equipment, and the target broadcasting equipment is as follows: any of the other devices within the local area network;
it should be noted that the target repository information table of the target broadcast apparatus may be regenerated according to the identifiers of all file repositories local to the target broadcast apparatus when the number of file repositories local to the target broadcast apparatus changes or the repository identifier changes.
The target repository information table of the target broadcast device may also be regenerated according to the identifiers of all the file repositories local to the target broadcast device and other information when the number of the file repositories local to the target broadcast device changes, or the identifiers of the file repositories change, or other information of the file repositories changes, for example, the other information may include the version number of the file repository.
Of course, the target repository information table of the target broadcast device may also be regenerated according to the identifiers of all file repositories local to the target broadcast device at regular intervals, or regenerated according to the identifiers of all file repositories local to the target broadcast device and other information, for example, the other information may include the version number of the file repository.
In addition, the target broadcasting device may broadcast the target repository information table to the executing agent at regular intervals, or may broadcast the target repository information table to the executing agent when the local target file repository information table changes.
S202, judging whether the target broadcasting equipment is recorded in an incidence relation table stored locally; if yes, executing S203, and if not, executing S204;
it is understood that, in the association relationship table currently stored locally by the execution main body, the recorded devices may include all devices in the local area network except the execution main body, or may include some devices in the local area network except the execution main body.
S203, updating a warehouse information table corresponding to the target broadcasting equipment in the incidence relation table stored locally by using the received target warehouse information table;
specifically, the warehouse information table corresponding to the target broadcast device in the association relationship table may be replaced with the target warehouse information table.
S204, correspondingly adding the target broadcasting equipment and the target warehouse information table sent by the target broadcasting equipment into the association relation table stored locally.
Since there is no record in the association table about the target broadcast device and the corresponding repository information table, the target broadcast device and the target repository information table can only be recorded in the association table in an incremental manner.
By applying the embodiment in which the step of updating the association table is added, the execution subject can obtain the repository information table of other devices and can update the locally stored association table. Therefore, not only can the recording of other equipment and the corresponding warehouse information table be realized, but also the current latest warehouse information table of other equipment can be obtained. Therefore, the target device can be found accurately, and the searching efficiency can be improved.
It may be understood by those skilled in the art that, in the embodiment of the present invention, the target device is selected from the devices recorded in the locally stored association table according to the identifier of the target file repository, and a device having the identifier same as that of the target file repository may be directly used as the target device. Of course, it may further select, from the devices having the same identifier as the identifier of the target file repository, a device satisfying other preset rules as the target device according to other preset rules.
In an implementation manner of the embodiment of the present invention, a repository information table of an apparatus is further configured to record a version number of a local file repository of the apparatus; the version number of a file warehouse and the version number of a file in the file warehouse have a preset incidence relation; the download request also carries the version number of the target file.
The step of selecting a target device from the devices recorded in the locally stored association table according to the identifier of the target file repository may include:
and selecting target equipment from the equipment recorded in the locally stored association table according to the identification of the target file warehouse, the version number of the target file and the preset association relationship.
In each device in the local area network of the present embodiment, the file repository has file repository information XfileWareHouse, and the file has file information Xfile. The Xfile is mainly used for describing information of the file, and may include an identifier Xid and a version number opver of the file, the Xid of the file is used for uniquely identifying the file, and the version number opver may be a uint64 type value and is used for identifying the version of the file. The XfileWareHouse may include an id and a version number opver of the file repository, where the id of the file repository is used to uniquely identify the file repository, and the version number opver of the file repository may be a uint64 type value used to identify the operation records under the file repository. When any file in the file warehouse changes, a new oper is generated as the version number of the file warehouse.
The version number of one file warehouse and the version number of the file in the file warehouse have a preset incidence relation, the version number meets the version number of the target file, and the file warehouse with the preset incidence relation is a file warehouse possibly provided with the target file; and the target file cannot exist in the file warehouse of the preset association relation when the version number does not satisfy the version number of the target file. Therefore, it can be understood that the identifier is the same as the identifier of the target file repository, and the file repository with the version number satisfying the version number of the target file has the possibility of storing the target file.
And selecting the target equipment according to the identifier of the target file warehouse, the version number of the target file and the preset association relation, wherein the specific limiting conditions are more. The former can select a larger range of target devices, and the latter can select a smaller range of target devices. Moreover, the target device selected by the latter has a higher probability of having the target file, and the target file is unlikely to exist on other devices except the target device, so the target device selected by the latter is more targeted.
As can be seen from the above analysis, when the embodiment of the present invention is applied, specifically, according to the identifier of the target file repository, the version number of the target file, and the preset association relationship, the target device is selected from devices recorded in the locally stored association relationship table, so that the search efficiency can be further improved.
Illustratively, the devices in the local area network include a device a, a device B, a device C, a device D, a device E, and a device F, and the execution subject is the device C. The equipment A is provided with a file warehouse which is marked as an intellectual property related file warehouse and has a version number of 1, and a file warehouse which is marked as a contract related file warehouse and has a version number of 2; the device B is provided with a file warehouse which is marked as a 'project-one related file warehouse' and has a version number of 4, a file warehouse which is marked as a 'project-two related file warehouse' and has a version number of 5, and a file warehouse which is marked as a 'contract-related file warehouse' and has a version number of 3; the device D is provided with a file warehouse which is marked as an item-one related file warehouse and has a version number of 5, and a file warehouse which is marked as an item-two related file warehouse and has a version number of 4; the equipment E is provided with a file warehouse which is marked as a 'project three-related file warehouse' and has a version number of 1, and a file warehouse which is marked as a 'project four-related file warehouse' and has a version number of 2; the device F is provided with a file repository which is identified as "intellectual property related file repository" and has a version number of 1, a contract related file repository "and has a version number of 2, an item one related file repository" and has a version number of 5, an item two related file repository "and has a version number of 4, an item three related file repository" and has a version number of 1, and an item four related file repository "and has a version number of 2.
In the case where the version number is recorded in the repository information table, the repository information table of the device a may be as shown in table 5. The warehouse information tables for device B, device D, device E, and device F are similar to table 5, and the corresponding warehouse information tables are not listed one by one here.
The devices in the association table stored in the device C may include all devices except the execution host in the local area network, in which case the association table is shown in table 6. The devices in the association table stored in device C may include only some devices in the local area network except the execution host, in which case the association table is similar to table 6.
TABLE 5
Figure BDA0001339438420000191
TABLE 6
Figure BDA0001339438420000201
Further, the file searching method may further include the following two steps:
(1) determining a file warehouse with locally existing file updates;
through the steps, when the file is added or replaced in any local file warehouse, the file warehouse can be determined.
During specific implementation, whether the files in each local file warehouse are updated or not can be monitored in real time, and if the files exist, the corresponding file warehouse is determined.
(2) And increasing the version number of the determined file warehouse and updating the version number of the file which is correspondingly updated in the determined file warehouse into the version number of the file warehouse.
Through the steps, the operation records in the file warehouse can be recorded for each file warehouse. For example, in a file repository with a version number of 2, which is identified as "an unexamined patent application original," the file searching method and apparatus identified as "one file searching method and apparatus" is replaced with a new file of a patent application original with a version number of 1. Then the version number 3 of the file repository identified as "the first draft of an unexamined patent application" is obtained by adding 1 to 2, and 3 is taken as the version number of the first draft of the new patent application identified as "a file search method and apparatus".
For another example, a file repository with a version number of 2, which is labeled "first unexamined patent application manuscript", is added with a first patent application manuscript labeled "a file searching method and device". Then the version number 3 of the file repository identified as "the first draft of an unexamined patent application" is obtained by adding 1 to 2, and this 3 is taken as the version number of the first draft of the patent application identified as "a file search method and apparatus" added.
Through the two steps (1) and (2) in this embodiment, the preset association relationship between the version number of one file repository and the version number of a file in the file repository can be specifically as follows: the version number of any file in a file repository is less than or equal to the version number of the file repository.
In an implementation manner of the embodiment of the present invention, when the version number of any file in one file repository is less than or equal to the version number of the file repository, the step of selecting a target device from devices recorded in an association table stored locally according to the identifier of the target file repository, the version number of the target file, and a preset association relationship may include the following two steps:
(1) selecting a file warehouse with the same identifier as that of the target file warehouse and the version number not less than that of the target file from the equipment recorded by the association relationship table;
for example, the association relationship table in the device C is shown in table 6, the identifier of the target repository where the target file is located is "contract-related file repository", and the version number of the target file is 3. It can be determined from table 6 that there is only one file repository identified as "contract-related file repository" with a version number of 3, and the device corresponding to this determined file repository is device B.
(2) And determining the equipment corresponding to the selected file warehouse as target equipment.
For example, the determined device B in the above example of step may be further taken as the target device.
Through the steps (1) and (2) in this embodiment, the target device can be selected specifically according to two conditions, namely, the file repository with the identifier identical to that of the target file repository and the version number not less than that of the target file.
In an implementation manner of the embodiment of the present invention, the file searching method may further include:
(1) under the condition that the update condition of the warehouse information table is met, generating a latest warehouse information table according to the identification of the local file warehouse;
when the step is implemented, at least two situations can be included, wherein one situation is as follows:
when the update condition of the warehouse information table is satisfied, the following may be specifically mentioned: and judging whether the number of the local file warehouses changes or not, and if so, meeting the updating condition of the warehouse information table.
The other situation is that:
in the case that the warehouse information table update condition is satisfied, it may be: and judging whether a local file warehouse with a changed version number exists, and if so, meeting the updating condition of the warehouse information table. In this case, the step of generating the latest repository information table according to the identifier of the local file repository may specifically include: and generating a latest warehouse information table containing the local file warehouse identification and the local file warehouse version number.
(2) And broadcasting the latest warehouse information table.
By broadcasting the latest warehouse information table, other devices can receive the latest warehouse information table. It will be appreciated that since each device within the local area network may be peer-to-peer, the executive may also obtain the most up-to-date repository information tables for other devices.
In an implementation manner of the embodiment of the present invention, the file searching method may further include the following steps, and the steps may be used to locally store the target file:
(1) obtaining the target file according to the search result aiming at the target file;
(2) judging whether a target file warehouse exists locally or not;
if so, storing the target file in a local target file warehouse;
if not, the target file warehouse is established locally, and the target file is stored in the local target file warehouse.
Through the step of storing the target file, the file warehouse or the file of the network disk server can be synchronized to the local execution main body, or the target file warehouse or the file on other equipment can be synchronized to the local, for example, in the field of enterprise network disks, after one equipment synchronizes the local file warehouse to the network disk server, other equipment can be informed, so that the other equipment can synchronize the corresponding file warehouse to the local through the embodiment of the invention.
Referring to fig. 3, fig. 3 is a second flowchart illustrating a file search method according to an embodiment of the present invention, where the file search method is applied to any device in a local area network, and the method includes:
s301, a downloading request for downloading the target file is obtained, wherein the downloading request carries the identifier of the target file warehouse where the target file is located and also carries the version number of the target file.
S302, determining a device to be judged from the devices recorded in the locally stored association relation table in sequence; the association relation table records the corresponding relation between the identifiers and the version numbers of other devices in the local area network and the local file warehouse thereof, and the version number of one file warehouse is not less than the version number of any file in the file warehouse.
In specific implementation, the association relationship table records the correspondence between the identifiers of other devices in the local area network and the local file repository thereof, which may be specifically implemented by the following form:
the association relation table records the corresponding relation between other devices in the local area network and the warehouse information table of the devices, and the warehouse information table of one device is used for recording the identification and the version number of the local file warehouse of the device.
And S303, judging whether the file warehouse with the identifier which is the same as the identifier of the target file warehouse and the version number which is not less than the version number of the target file exists in the equipment to be judged, if so, executing S304, and if not, returning to S302 until all the equipment in the association relation table is traversed.
Specifically, for one device in the association table, according to the identifier and the version number of the file repository corresponding to the device, it may be determined whether a file repository exists in the file repository corresponding to the device, where the identifier is the same as the identifier of the target file repository, and the version number is not less than the version number of the target file. If so, S304 is performed. If not, returning to S302, and sequentially determining the next device as the device to be judged.
In carrying out this step, there may be two cases, one of which is: after traversing all the devices in the association table, the device of the file warehouse with the identifier identical to that of the target file warehouse and the version number not less than that of the target file is not found, so that the device can be determined only from the local association table, and the target file cannot be found in the local area network. The network request does not need to be sent to any other device in the local area network, so that the corresponding device is locally searched, the target file cannot be searched, and the search is invalid. The other situation is that: at least one device having a file repository with an identifier that is the same as the identifier of the target file repository and a version number that is not less than the version number of the target file may be determined.
S304, determining the device to be judged as the target device, and sending a network request about searching the target file to the target device so that the target device searches the target file locally.
This step enables the network request to be sent only to the target device, i.e. the target device is caused to search for the target file only locally at the target device.
S305, receiving a search result fed back by the target device.
The target device searches the target file in a local file warehouse of the target device, and feeds back the final search result to the execution main body, so that the execution main body receives the search result fed back by the target device.
S306, judging whether a target file exists in the target equipment or not according to the received search result, and if so, executing S307; if not, returning to S302 until all the devices in the association relation table are traversed.
In this step, if the process returns to execute S302, it is determined that the next device is a device to be determined.
S307, the target device is positioned as a device with a target file or the target file is obtained according to the received search result.
Through the step, if the target file exists in the equipment recorded in the local incidence relation table, the search result of the target file can be obtained through the step. If the target file does not exist in the local association relation table, the search result of the target file which is not searched can be obtained through the step.
For example, the identifier of the target file repository where the target file is located is "contract-related file repository", the version number of the target file is 3, and the association table of the local storage is shown in table 6. According to the sequence of the equipment from front to back recorded in the association relation table, firstly, for the equipment a, whether a file warehouse with the same identifier as the contract-related file warehouse and the version number not less than 3 exists in the file warehouse on the equipment a is judged, and as a result, the file warehouse does not exist.
Then, for the apparatus B, it is determined whether or not there is a file repository whose identifier is the same as the "contract-related file repository" and whose version number is not less than 3 in the file repository on the apparatus B, and as a result, there is a file repository. And determining the device B as a target device, and sending a network request for searching the target file to the device B, so that the device B searches the target file in a file warehouse local to the device B, and feeding back a search result. And receiving a search result fed back by the device B, judging whether the target file exists in the device B according to the search result fed back by the device B, and if so, positioning the device B through S307.
If the target file does not exist in the device B, then for the device D, it is determined whether a file warehouse exists in the file warehouse on the device D, the identifier of which is the same as the "contract-related file warehouse" and the version number of which is not less than 3, and the result is that no file warehouse exists. And then, for the equipment E, judging whether a file warehouse exists in the file warehouse on the equipment E, wherein the file warehouse has the identifier which is the same as the contract-related file warehouse and has the version number not less than 3, and the result is that the file warehouse does not exist. Finally, for the equipment E, it is determined whether there is a file warehouse in which the identifier is the same as the "contract-related file warehouse" and the version number is not less than 3 in the file warehouse on the equipment E, and as a result, there is no file warehouse.
Finally, if the target file exists in the device B, the device with the target file can be located, and the target file can be searched. Otherwise, the target device with the target file cannot be located, that is, the target file cannot be searched.
With the embodiment of fig. 3, the file repository exists in the selected target device, and the file repository must satisfy the conditions of the same identifier as the target file repository and the version number not less than the version number of the target file. A file repository that does not satisfy both conditions is unlikely to have a target file. Not only the target device is searched for the target file, but also the search range is smaller than or equal to the range determined by all possible target devices in a mode of access one by one. Therefore, compared with the prior art, the invalid search can be reduced, and the possibility of searching all target devices can be further reduced when the target files exist in the corresponding devices in the association relation table. Therefore, the search efficiency for the target file can be improved.
On the basis of the embodiment shown in fig. 3, the following steps can be added:
(1) and determining that a first file in a local first file warehouse is changed, wherein the first file warehouse is any one of all local file warehouses, and the first file is any one of files in the first file warehouse.
(2) And adding one to the version number of the first file warehouse to obtain a new version number, and updating the changed version number of the first file and the version number of the first file warehouse into the obtained new version number.
Through the steps (1) and (2) of the embodiment of the invention, the version numbers of the file warehouse and the file can be updated.
Further, a step can be added:
and at a preset time point, constructing a warehouse information table according to the identifications and version numbers of all local file warehouses, and broadcasting.
The preset time point may be a time point when the version number of the file repository is updated, or a time point in each preset time period, which is not described herein.
Further, the following can be added:
receiving the warehouse information table broadcasted by other equipment, and if the equipment broadcasting the warehouse information table is already in the association relation table, updating the warehouse information table on the corresponding equipment; and if the equipment sending the broadcast warehouse information table is not in the association relation table, adding the corresponding equipment and the warehouse information table into the association relation table.
Through the step, the warehouse information tables of other devices can be obtained and recorded in the local incidence relation table, so that the aim of updating the locally stored incidence relation table is fulfilled.
Hereinafter, a file search apparatus according to an embodiment of the present invention will be described.
Referring to fig. 4, fig. 4 is a schematic diagram of a first structure of a file search apparatus according to an embodiment of the present invention, where the file search apparatus is applied to any device in a lan, and includes:
a first obtaining module 41, configured to obtain a downloading request for downloading an object file, where the downloading request carries an identifier of an object file repository where the object file is located;
a selecting module 42, configured to select a target device from devices recorded in a locally stored association table according to an identifier of a target file repository, where the association table records a correspondence between other devices in the local area network and the identifier of the local file repository;
a sending module 43, configured to send a search request about a target file to a target device, so that the target device searches a local file repository of the target device for the target file;
and the second receiving module 44 is configured to receive the search result fed back by the target device, and obtain a search result for the target file according to the received search result.
By applying the embodiment shown in fig. 4, the target device that may contain the target file may be determined according to the comparison between the target file repository identifier and the file repository identifier in the association table. And then sending a search request to the target equipment to enable the target equipment to search the target file in a local file warehouse. And receiving a search result fed back by the target equipment, and finally obtaining a search result aiming at the target file according to the received search result. The selected target equipment is used for searching the target file, the searching range is narrowed in the process, the searching is targeted, invalid searching is reduced, and the searching efficiency can be improved.
In an embodiment of the present invention, based on the embodiment shown in fig. 4, an association table updating sub-apparatus is further added, referring to fig. 5, fig. 5 is a schematic structural diagram of the association table updating sub-apparatus, a corresponding relationship between other devices in the local area network and a warehouse information table of the other devices is recorded in the association table, and the association table updating sub-apparatus specifically may include:
a third receiving module 51, configured to receive a target repository information table broadcasted by a target broadcasting device, where the target repository information table records an identifier of a local file repository of the target broadcasting device, and the target broadcasting device is: any of the other devices within the local area network;
a first judgment module 52, configured to judge whether the target broadcast device is recorded in the locally stored association table;
an updating module 53, configured to update the warehouse information table corresponding to the target broadcast device in the locally stored association table with the received target warehouse information table when the determination result of the determining module is present;
and an adding module 54, configured to correspondingly add the target broadcast device and the target warehouse information table sent by the target broadcast device to the locally stored association relation table when the determination result of the determining module is that the target broadcast device does not exist.
In an implementation manner of the embodiment of the present invention, a repository information table of an apparatus is further configured to record a version number of a local file repository of the apparatus;
the version number of a file warehouse and the version number of a file in the file warehouse have a preset incidence relation;
the downloading request also carries the version number of the target file;
the selecting module 42 is specifically configured to select the target device from the devices recorded in the locally stored association table according to the identifier of the target file repository, the version number of the target file, and the association relationship.
Further, the file search apparatus provided in the embodiment of the present invention may further include:
the determining module is used for determining a file warehouse with locally existing file updates;
and the processing module is used for increasing the version number of the determined file warehouse and updating the version number of the file which is correspondingly updated in the determined file warehouse into the version number of the file warehouse.
Further, the selecting module 42 includes:
the selecting unit is used for selecting a file warehouse of which the identifier is the same as that of the target file warehouse and the version number is not less than that of the target file from the equipment recorded in the association relationship table;
and the determining unit is used for determining the equipment corresponding to the selected file warehouse as target equipment.
In an implementation manner of the embodiment of the present invention, the file searching apparatus may further include:
the generating module is used for generating a latest warehouse information table according to the identification of the local file warehouse under the condition of meeting the updating condition of the warehouse information table;
and the broadcasting module is used for broadcasting the latest warehouse information table.
Further, the generating module includes: the device comprises a first judging unit and a first generating unit, or a second judging unit and a second generating unit;
the first judging unit is used for judging whether the number of the local file warehouses changes or not;
the first generation unit is used for generating a latest warehouse information table according to the identification of the local file warehouse when the judgment result of the first judgment unit is yes;
the second judging unit is used for judging whether a local file warehouse with a changed version number exists or not;
and the second generating unit is used for generating a latest warehouse information table containing the local file warehouse identification and the local file warehouse version number when the judgment result of the second judging unit is yes.
The file searching apparatus provided in the embodiment of the present invention may further include:
the second judgment module is used for judging whether a target file warehouse exists locally or not under the condition that the search result aiming at the target file comprises the target file;
the first storage module is used for storing the target file in a local target file warehouse when the judgment result of the second judgment module is that the target file exists;
and the second storage module is used for establishing a target file warehouse locally and storing the target file in the local target file warehouse when the judgment result of the second judgment module is that the target file warehouse does not exist.
Referring to fig. 6, fig. 6 is a schematic diagram of a second structure of a file searching apparatus according to an embodiment of the present invention, where the file searching apparatus is applied to any device in a lan, and includes:
the download request receiving module 61 is configured to obtain a download request for downloading the target file, where the download request carries an identifier of a target file repository where the target file is located, and also carries a version number of the target file.
A device to be judged determining module 62, configured to determine a device to be judged sequentially from devices recorded in the locally stored association table; the association relation table records the corresponding relation between the identifiers and the version numbers of other devices in the local area network and local file warehouses of the devices, the file warehouses are folders used for storing files, the files refer to files synchronized to the network end and files downloaded from the network end, and the version number of one file warehouse is not smaller than the version number of any file in the file warehouse.
A third judging module 63, configured to judge whether a file repository exists in the device to be judged, where the identifier is the same as the identifier of the target file repository, and the version number of the file repository is not less than the version number of the target file, if the file repository exists, trigger the target processing module 64 to act, and if the file repository does not exist, trigger the device to be judged determining module 62 to act until all devices in the association table are traversed.
And the target processing module 64 is configured to determine the device to be determined as the target device, and send a network request for searching the target file to the target device, so that the target device searches the target file locally.
And a result receiving module 65, configured to receive the search result fed back by the target device.
And the result judging module 66 is used for judging whether the target file exists in the target device according to the received search result, if so, triggering the result processing module 67 to act, and if not, triggering the device to be judged determining module 62 to act until all devices in the association relation table are traversed.
And the result processing module 67 is configured to locate the target device as a device with a target file or obtain the target file according to the received result.
With the embodiment of fig. 6, the file repository exists in the selected target device, and the file repository must satisfy the conditions of the same identifier as the target file repository and the version number not less than the version number of the target file. A file repository that does not satisfy both conditions is unlikely to have a target file. Not only the target device is searched for the target file, but also the search range is smaller than or equal to the range determined by all possible target devices in a mode of access one by one. Therefore, compared with the prior art, the invalid search can be reduced, and the possibility of searching all target devices can be further reduced when the target files exist in the corresponding devices in the association relation table. Therefore, the search efficiency for the target file can be improved.
On the basis of the embodiment shown in fig. 6, the following modules may be added:
the file storage module is used for storing a file to be stored in a file storage of the file.
And the version number updating module is used for adding one to the version number of the first file warehouse to obtain a new version number, and updating the version number of the changed first file and the version number of the first file warehouse into the obtained new version number.
Further, a module can be added:
and the warehouse information table broadcasting module is used for constructing a warehouse information table according to the identification and the version number of all local file warehouses at a preset time point and broadcasting.
Further, a module can be added:
and the warehouse information table receiving module is used for receiving the warehouse information table broadcasted by other equipment, updating the warehouse information table on the corresponding equipment if the equipment broadcasting the warehouse information table is already in the association relationship table, and adding the corresponding equipment and the warehouse information table into the association relationship table if the equipment broadcasting the warehouse information table is not in the association relationship table.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (16)

1. A file searching method is applied to any device in a local area network, and is characterized by comprising the following steps:
acquiring a downloading request for downloading a target file, wherein the downloading request carries an identifier of a target file warehouse where the target file is located and a version number of the target file;
according to the identification of the target file warehouse, selecting target equipment from equipment recorded in an incidence relation table stored locally, wherein the incidence relation table records the corresponding relation between other equipment in the local area network and the warehouse information table of the equipment, the warehouse information table of one equipment is used for recording the identification of the local file warehouse of the equipment and is also used for recording the version number of the local file warehouse of the equipment, the file warehouse is a folder used for storing files, and the files refer to files synchronized to a network end and files downloaded from the network end;
sending a search request for the target file to the target device to cause the target device to search for the target file in its local file repository;
and receiving a search result fed back by the target equipment, and obtaining a search result aiming at the target file according to the received search result.
2. The method of claim 1, further comprising:
receiving a target repository information table broadcasted by a target broadcasting device, wherein the target repository information table records an identifier of a local file repository of the target broadcasting device, and the target broadcasting device is: any of the other devices within the local area network;
judging whether the target broadcasting equipment is recorded in an incidence relation table stored locally;
if yes, updating a warehouse information table corresponding to the target broadcasting equipment in an incidence relation table stored locally by using the received target warehouse information table;
and if the target broadcast equipment does not exist, correspondingly adding the target broadcast equipment and the target warehouse information table transmitted by the target broadcast equipment into the locally stored association relation table.
3. The method according to claim 1 or 2,
the version number of a file warehouse and the version number of a file in the file warehouse have a preset incidence relation;
the step of selecting a target device from devices recorded in an incidence relation table stored locally according to the identifier of the target file repository includes:
and selecting target equipment from the equipment recorded in the incidence relation table stored locally according to the identification of the target file warehouse, the version number of the target file and the preset incidence relation.
4. The method of claim 3, further comprising:
determining a file repository having locally existing file updates;
and increasing the version number of the determined file warehouse and updating the version number of the file corresponding to update in the determined file warehouse to the version number of the file warehouse.
5. The method of claim 4,
the step of selecting the target device from the devices recorded in the locally stored association table according to the identifier of the target file repository, the version number of the target file and the preset association includes:
selecting a file warehouse with the same identifier as that of the target file warehouse and the version number not less than that of the target file from the equipment recorded by the incidence relation table;
and determining the device corresponding to the selected file warehouse as the target device.
6. The method of claim 4 or 5, further comprising:
under the condition of meeting the updating condition of the warehouse information table, generating a latest warehouse information table according to the identification of the local file warehouse;
broadcasting the latest warehouse information table.
7. The method according to claim 6, wherein in the case that the update condition of the repository information table is satisfied, generating a latest repository information table according to the identifier of the local file repository includes:
judging whether the number of the local file warehouses changes or not, if so, generating a latest warehouse information table according to the identification of the local file warehouses; or
And judging whether a local file warehouse with a changed version number exists, and if so, generating a latest warehouse information table comprising a local file warehouse identifier and a local file warehouse version number.
8. The method of claim 1, further comprising:
obtaining the target file according to the search result aiming at the target file;
judging whether the target file warehouse exists locally or not;
if so, storing the target file in the local target file warehouse;
and if the target file does not exist, establishing the target file warehouse locally, and storing the target file in the local target file warehouse.
9. A file search device is applied to any device in a local area network, and is characterized by comprising:
the device comprises a first obtaining module, a second obtaining module and a third obtaining module, wherein the first obtaining module is used for obtaining a downloading request for downloading a target file, and the downloading request carries an identifier of a target file warehouse where the target file is located and a version number of the target file;
a selecting module, configured to select a target device from devices recorded in an association table stored locally according to an identifier of the target file repository, where the association table records a correspondence between other devices in the local area network and a repository information table thereof, and a repository information table of one device is used to record an identifier of a local file repository of the device and also record a version number of the local file repository of the device, where the file repository is a folder for storing files, and the files are files synchronized to a network end and files downloaded from the network end;
a sending module, configured to send a search request for the target file to the target device, so that the target device searches for the target file in its local file repository;
and the second receiving module is used for receiving the search result fed back by the target equipment and obtaining the search result aiming at the target file according to the received search result.
10. The apparatus of claim 9, further comprising:
a third receiving module, configured to receive a target repository information table broadcasted by a target broadcasting device, where the target repository information table records an identifier of a local file repository of the target broadcasting device, and the target broadcasting device is: any of the other devices within the local area network;
the first judgment module is used for judging whether the target broadcasting equipment is recorded in an incidence relation table stored locally;
the updating module is used for updating the warehouse information table corresponding to the target broadcasting equipment in the incidence relation table stored locally by using the received target warehouse information table when the judgment result of the judging module is present;
and the adding module is used for correspondingly adding the target broadcasting equipment and the target warehouse information table sent by the target broadcasting equipment into the incidence relation table stored locally when the judgment result of the judging module is that the target broadcasting equipment does not exist.
11. The apparatus of claim 9 or 10,
the version number of a file warehouse and the version number of a file in the file warehouse have a preset incidence relation;
the selection module is specifically configured to select a target device from devices recorded in an association table stored locally according to the identifier of the target file repository, the version number of the target file, and the preset association.
12. The apparatus of claim 11, further comprising:
the determining module is used for determining a file warehouse with locally existing file updates;
and the processing module is used for increasing the version number of the determined file warehouse and updating the version number of the file which is correspondingly updated in the determined file warehouse into the version number of the file warehouse.
13. The apparatus of claim 12,
the selection module comprises:
a selecting unit, configured to select, from the device recorded in the association table, a file repository whose identifier is the same as the identifier of the target file repository and whose version number is not less than the version number of the target file;
and the determining unit is used for determining the equipment corresponding to the selected file warehouse as target equipment.
14. The apparatus of claim 12 or 13, further comprising:
the generating module is used for generating a latest warehouse information table according to the identification of the local file warehouse under the condition of meeting the updating condition of the warehouse information table;
and the broadcasting module is used for broadcasting the latest warehouse information table.
15. The apparatus of claim 14, wherein the generating module comprises: the device comprises a first judging unit and a first generating unit, or a second judging unit and a second generating unit;
the first judging unit is used for judging whether the number of the local file warehouses changes or not;
the first generating unit is used for generating a latest warehouse information table according to the identification of the local file warehouse when the judgment result of the first judging unit is yes;
the second judging unit is used for judging whether a local file warehouse with a changed version number exists or not;
and the second generating unit is configured to generate a latest repository information table including a local file repository identifier and a local file repository version number when the determination result of the second determining unit is yes.
16. The apparatus of claim 9, further comprising:
an obtaining module, configured to obtain the target file according to a search result for the target file;
the second judgment module is used for judging whether the target file warehouse exists locally or not;
the first storage module is used for storing the target file in the local target file warehouse when the judgment result of the second judgment module is that the target file exists;
and the second storage module is used for establishing the target file warehouse locally and storing the target file in the local target file warehouse when the judgment result of the second judgment module is that the target file warehouse does not exist.
CN201710531455.XA 2017-07-03 2017-07-03 File searching method and device Active CN108573009B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710531455.XA CN108573009B (en) 2017-07-03 2017-07-03 File searching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710531455.XA CN108573009B (en) 2017-07-03 2017-07-03 File searching method and device

Publications (2)

Publication Number Publication Date
CN108573009A CN108573009A (en) 2018-09-25
CN108573009B true CN108573009B (en) 2021-05-25

Family

ID=63576068

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710531455.XA Active CN108573009B (en) 2017-07-03 2017-07-03 File searching method and device

Country Status (1)

Country Link
CN (1) CN108573009B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104704494A (en) * 2013-06-09 2015-06-10 苹果公司 Device, method, and graphical user interface for managing folders with multiple pages
CN106372102A (en) * 2015-07-21 2017-02-01 三星电子株式会社 Electronic device and method for managing object in folder on electronic device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4291077B2 (en) * 2003-07-29 2009-07-08 株式会社日立製作所 Distributed storage device file management method and distributed storage system
US9262496B2 (en) * 2012-03-30 2016-02-16 Commvault Systems, Inc. Unified access to personal data
CN102882985B (en) * 2012-10-23 2015-08-05 上海够快网络科技有限公司 Based on the file sharing method that cloud stores
US9471587B2 (en) * 2013-06-07 2016-10-18 Apple Inc. Remote enumeration of a directory
CN104679782A (en) * 2013-11-30 2015-06-03 鸿富锦精密工业(深圳)有限公司 File version control system and method
CN104199863B (en) * 2014-08-15 2017-11-21 小米科技有限责任公司 Lookup method, device and the router of file in storage device
CN104780204A (en) * 2015-03-24 2015-07-15 四川长虹电器股份有限公司 Method and system for rapidly sharing files between terminals
CN105872039A (en) * 2016-03-29 2016-08-17 乐视控股(北京)有限公司 Method for transmitting file between terminal devices, terminal device and a file transmission system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104704494A (en) * 2013-06-09 2015-06-10 苹果公司 Device, method, and graphical user interface for managing folders with multiple pages
CN106372102A (en) * 2015-07-21 2017-02-01 三星电子株式会社 Electronic device and method for managing object in folder on electronic device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"巧记妙招,提升Windows文件搜索效率";刘景云;《电脑知识与技术》;20130430;第26-30页 *

Also Published As

Publication number Publication date
CN108573009A (en) 2018-09-25

Similar Documents

Publication Publication Date Title
US8290900B2 (en) Apparatus, and associated method, for synchronizing directory services
US9792340B2 (en) Identifying data items
US11144510B2 (en) System and method for synchronizing file systems with large namespaces
CN106959963B (en) Data query method, device and system
US6915333B2 (en) Method of managing attached document
RU2619195C2 (en) Method and device for finding a file in a storage unit and router
US20090187622A1 (en) Method, system and apparatus for data synchronization
US8959062B2 (en) Data storage device with duplicate elimination function and control device for creating search index for the data storage device
CN1866249B (en) Data management system, data server, and data management method
CN105701096A (en) Index generation method, data inquiry method, index generation device, data inquiry device and system
CN109376121B (en) File indexing system and method based on elastic search full-text retrieval
CN102882985A (en) File sharing method based on cloud storage
CN111008521B (en) Method, device and computer storage medium for generating wide table
KR20040111156A (en) System and method for managing cached objects using notification bonds
CN106250476B (en) Method, device and system for updating and synchronizing white list
CN113067853A (en) Data pushing method and device, electronic equipment and storage medium
US7536404B2 (en) Electronic files preparation for storage in a server
US9417796B2 (en) Method, a server, a system and a computer program product for copying data from a source server to a target server
CN100357943C (en) A method for inspecting garbage files in cluster file system
JP2009129195A (en) Backup server, mobile unit, communication system using the same, and backup method
US20060123087A1 (en) Email storage format including partially ordered logs of updates to email message attributes
CN108573009B (en) File searching method and device
CN112445986B (en) Cache information updating method, pushing method, device and medium
CN104462967A (en) Method, device and system for file recovery
US20110029587A1 (en) Updating Retrieval Codes In Response To File Transfers

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
GR01 Patent grant
GR01 Patent grant