EldoS | Feel safer!

Software components for data protection, secure storage and transfer

copy an open SolFS file: will the copy always work?

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#21679
Posted: 09/22/2012 05:46:58
by Robbie  (Basic support level)
Joined: 09/22/2012
Posts: 3

Hi,

I’m evaluating SolFS Application edition in .NET 4 / C#.

In code, I create/open a SolFS container and perform some file operations (add files / remove files). I close the SolFS container when I close the program.
If I copy the SolFS container while it is open in the program, will I always have a working, consistent, and non-corrupted copy?

In other words, I open a container, add a first set of files, take a copy of the open container in code using a simple FileStream read operation, add a second set of files to the container and finally close the container: is the copy guaranteed to be a valid and correct SolFS container containing the first set of files? Do I need to take care of something before I start to copy the container (like a .flush() command)?

If not, how can I realize that (take a backup copy while the program is running)?
#21680
Posted: 09/22/2012 12:44:10
by Eugene Mayevski (EldoS Corp.)

Quote
Robbie wrote:
If I copy the SolFS container while it is open in the program, will I always have a working, consistent, and non-corrupted copy?


No. SolFS caches some data in memory and if you copy the file as the cache is flushed to disk, you'll get a corrupted storage. Not fatally corrupted, but still damaged.

Quote
Robbie wrote:
If not, how can I realize that (take a backup copy while the program is running)?


There's no easy way to do this now. Do you want to make backups using the application itself (eg. in another thread) or using third-party application?


Sincerely yours
Eugene Mayevski
#21681
Posted: 09/24/2012 01:55:24
by Robbie  (Basic support level)
Joined: 09/22/2012
Posts: 3

Hi Eugene,

Quote
Do you want to make backups using the application itself (eg. in another thread) or using third-party application?


I create the backup in a separate thread, cancelling the copy if another thread (the main thread) is adding/deleting a file in the container.

I did consider closing the container after each operation and re-opening it before another action, but that implies that the container file could be removed/delete in Windows Explorer between operations (in my current solution I did had some problems with that as some users didn't understand why they could not do that...); I'm also not sure that this would imply a slowdown because of the time to open/close a (large) file.

Any thoughts/suggestions?

Kind regards,
Robbie De Sutter
#21682
Posted: 09/24/2012 02:29:45
by Alexander Plas (EldoS Corp.)

Hello

I can confirm there is no way to make a backup of opened storage file. You have to close it. But you can open the storage file before closing with appropriate opening mode (GENERIC_READ) and sharing mode (FILE_SHARE_READ | FILE_SHARE_WRITE), then close it via SolFS function and make the backup. When backup is done, you open the storage via SolFS and close it as usual file. Does this scenario solve your problem?
#21729
Posted: 09/26/2012 04:43:54
by Robbie  (Basic support level)
Joined: 09/22/2012
Posts: 3

Thanks Alexander,

I did indeed now close it before copying.

One last related question: if while copying another thread opens the SolFS container and only performs read operations (e.g., GetFileModificationTime, FileExists, ...), can that corrupt the copy?

Kind regards,
Robbie De Sutter
#21730
Posted: 09/26/2012 05:01:15
by Alexander Plas (EldoS Corp.)

If you open the storage in read only mode, it's definitely not changed. If you open it in read-write mode, storage will be marked as dirty and some changes may occur even if you don't create, change, delete or write anything.
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.

Reply

Statistics

Topic viewed 2711 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!