EldoS | Feel safer!

Software components for data protection, secure storage and transfer

How to know if file is written

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#32895
Posted: 04/02/2015 06:28:07
by Vladimir Cherniga (EldoS Corp.)

You may use CloseCallback safely. CloseNotify has different interface - UserContext field is not present.
#32896
Posted: 04/02/2015 06:34:57
by Manoj Jain (Standard support level)
Joined: 02/28/2013
Posts: 94

In addition to file encryption, I need a file close notification

This is my requirement

You suggested to remove closecallback and use close notification .

That's why I have question. How will it affect the encryption process?

I repeat I am using EncryptwithHeader sample, no change, c++
#32898
Posted: 04/02/2015 06:44:56
by Vladimir Cherniga (EldoS Corp.)

Quote
Manoj Jain wrote:
That's why I have question. How will it affect the encryption process?

Close callback and notification are both called before sending to file system. They are difference in synchronization - notification doesn't wait for completion. It may be performed with delay, depends on callback queue capacity. But as I said before, there is a number of concurrent requests may be exists at the same time with open/close file callbacks. Every notification or callback reports about single CloseHandle() event.
#32900
Posted: 04/02/2015 06:53:55
by Manoj Jain (Standard support level)
Joined: 02/28/2013
Posts: 94

In short, I cannot get a definite file write completion event while I am still using EncryptwithHeader.

That is file is written completely and all resources are free. That's the topic of this discussion.
#32902
Posted: 04/02/2015 06:58:27
by Vladimir Cherniga (EldoS Corp.)

Quote
Manoj Jain wrote:
In short, I cannot get a definite file write completion event while I am still using EncryptwithHeader.

You cannot, until the last handle for the file is closed. But this this a common limitation, not connected with sample or CallbackFilter.
#32903
Posted: 04/02/2015 07:05:09
by Eugene Mayevski (EldoS Corp.)

Another customer asked us the same question but about Callback File System. The principle is the same and I describe it below.

Even when it's one application accessing the file, it may open and close this file multiple times during saving this file. You have no way to know when the last operation was complete. Imagine the following sequence of operations for one file:

1. FileOpen
2. FileOpen
3. FileClose
4. FileOpen
5. FileClose
6. FileClose
7. FileOpen
8. FileClose

In this case on step 6 you will have the file being closed with no open handles left. You can track this using a open-close counter.

But if you need to act only on step 8, I don't know a way to distinguish between step 6 and step 8.


The above scheme can be even more complicated in case of various MS Office software modules which write the data to the temporary file and then rename that temporary file.


Sincerely yours
Eugene Mayevski
#32904
Posted: 04/02/2015 07:20:11
by Manoj Jain (Standard support level)
Joined: 02/28/2013
Posts: 94

I saw your reply here:

http://stackoverflow.com/questions/4974563/how-to-determine-when-files-are-done-copying-for-further-processing


The topic is exactly same and my need is also exactly same. You said that callbackfilter is right solution

Anyway, I understand what you said in previous reply and have seen same in my logs also

Still if you have an implementable solution, let me know
#32907
Posted: 04/02/2015 08:29:13
by Eugene Mayevski (EldoS Corp.)

The question is not in the "implementable solution". The question is to define (as in "give a definitive description") when the file is ready for being processed. Once you have defined this for your scenarios, the rest is trivial.


Sincerely yours
Eugene Mayevski
#32928
Posted: 04/03/2015 01:47:16
by Manoj Jain (Standard support level)
Joined: 02/28/2013
Posts: 94

In the first post itself I have clearly defined what I want.

===================
C++ EncryptWithHeader:

Using a copy operation on button click, I copy a file to the folder to encrypt. What to know when copy process is complete
========================================

What you are explaining in the replies is known to me because I am using CallbvackFilter for more than one year.

In you public posts in StakeOverFlow, you said it is possible to know when copy operation is complete.

I asked same question here and you are not giving me any way to know that copy process is complete.

Either give me a definitive answer as to how to know that copy is complete or I think you have accepted that it is not possible.
#32930
Posted: 04/03/2015 02:25:58
by Eugene Mayevski (EldoS Corp.)

I am afraid that there's some misunderstanding. The answer has been given to you - count open and close operations and when the counter is 0 in the OnCloseFileC event, perform your operation.

If you for whatever reason don't like the answer, then there's nothing else I can help you with.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 8389 times

Number of guests: 1, 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!