EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Delayed evaluation

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 12/06/2011 11:39:30
by Morgan Parry (Priority Standard support level)
Joined: 12/06/2011
Posts: 3

I am driving my file system from a database among other sources and would like to delay evaluation of this slow source as much as possible. For the files i currently return them as being zero length in both the directory enum and getFileInfo requests until someone actually tries to open the file. The data is then cached and these then report the correct information. This works most of the time but sometime apps like notepad will open an empty file and i then have to reopen it.

I have no cheap way of getting the correct size ahead of time and so was wondering what the correct way to implement this pattern might be? Directories can contain lots of files and so i need to avoid getting the infomation in the case when someone is just browsing through a directory.

I set the following on startup,

Posted: 12/07/2011 02:12:27
by Volodymyr Zinin (Team)

The problem can be if some application gets file size from directory enumeration. It's possible to workaround it - check the Mask parameter in the OnEnumerateDirectory callback and if it's different from "*" or "*.*" (for example it's "filename.ext") then most possible that some app wants to get full file information (file size, etc). Also the OnGetFileInfo callback must return complete information.
BTW: In addition you can set for files FILE_ATTRIBUTE_OFFLINE if the files don't contain full information yet. It seems it doesn't influence on any behavior, but icons for such files in Explorer become to be marked as "offline".
Posted: 12/07/2011 08:32:58
by Morgan Parry (Priority Standard support level)
Joined: 12/06/2011
Posts: 3

Thank you, changing onGetFileInfo to evaluate the information for only files has worked well. Combined with NotifyDirectoryChange so that file sizes are updated after someone opens them provides the support i needed.



Topic viewed 1073 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!