开发者

How Windows Indexing Service works?

开发者 https://www.devze.com 2023-02-02 19:25 出处:网络
I have a task to implement service with behavior like this one. My question is: How Indexing Serviceremember what files was already indexed and what no, what files changed and need to reindex them?

I have a task to implement service with behavior like this one. My question is:

How Indexing Service remember what files was already indexed and what no, what files changed and need to reindex them?

Also, I c开发者_如何学编程an stop this service and then start it after a few days, it continues to work. Does it have its own database with information about files?

Thank you


Usually the indexing-service stays in the background using WaitForSingleObject / WaitForMultipleObjects on Handles created by calls to FindFirstChangeNotification. If you want to support that the indexing service can be shut down (or be used for an already existent directory) you should definitely store the timestamp of your last index run on every file. You can compare this to the LastWriteTime of the given file.

EDIT: you should use ReadDirectoryChangesW and another thread which asynchronously indexes the files to be sure to not miss any changes. You can either spawn new threads for every file to index(expensive) or use a job queue and a fixed amount of worker threads(1 or 2 preferably)

0

精彩评论

暂无评论...
验证码 换一张
取 消