EldoS | Feel safer!

Software components for data protection, secure storage and transfer

OnReadFile --> worker thread, that will do the job

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#20954
Posted: 08/01/2012 05:58:25
by Christopher Lenz (Basic support level)
Joined: 07/25/2012
Posts: 16

Hello,

the help file says:
Quote
To make your code fast, don't perform lengthy operations (especially network operations) from the callback. Create a worker thread, that will do the job. When you need to write the data, pass this data to the worker thread and return. The worker thread will send the data to the remote side. When the file is opened, cache some of it's data with help of the worker thread and return this data from reading callback.


But what can I return to the ref BytesRead? The Length of the Buffer?

No sample uses a thread.

I use C#

Regards Chris
#20956
Posted: 08/01/2012 06:22:31
by Volodymyr Zinin (EldoS Corp.)

The help suggests to implement a local cache. The callbacks can't support asynchronous processing.
#20957
Posted: 08/01/2012 06:23:37
by Eugene Mayevski (EldoS Corp.)

OnRead is always synchronous and the text you quoted suggests read-ahead cache and postponed *writing*.


Sincerely yours
Eugene Mayevski
#20958
Posted: 08/01/2012 06:37:54
by Christopher Lenz (Basic support level)
Joined: 07/25/2012
Posts: 16

Okay, I'm a little bit confused

I have a network based filesystem. Some of these files take 30 seconds or more to load.

A user double-clicked a file and I get some Open and Close Callbacks.
Now I get a Read Callback and need to transfer the file from the remote-system to mine.
What I have to do?

Of course the file is cached if it is loaded sometimes but until this time no files are preventative cached.

My only possibility is to reset the Timeout in the read callback?
#20960
Posted: 08/01/2012 07:23:16
by Eugene Mayevski (EldoS Corp.)

In your OnOpenFile callback handler spawn a worker thread which will read some data and store it in the temporary cache. On OnRead callback read the data from the cache or wait until the data appears there.


Sincerely yours
Eugene Mayevski
#20974
Posted: 08/02/2012 00:52:26
by Christopher Lenz (Basic support level)
Joined: 07/25/2012
Posts: 16

But if I open a Folder every file inside this folder is opened one times.
And while OnOpenFile appears with another access and share mode it is too late because it is immediately called before the OnReadFile.

I'm not able to cache every file on an OpenFile just because one person is opening a folder.

So my only way is to reset the timeout on reading files, correct?
#20975
Posted: 08/02/2012 00:57:19
by Eugene Mayevski (EldoS Corp.)

Quote
Christopher Lenz wrote:
But if I open a Folder every file inside this folder is opened one times.


This happens only in Explorer and in shell open dialogs. Setting disk type to network reduces amount of reading.

Quote
Christopher Lenz wrote:
So my only way is to reset the timeout on reading files, correct?


In this case yes, only reset timeout.


Sincerely yours
Eugene Mayevski
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

Topic viewed 879 times

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




|

Back to top

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

Got it!