English 中文(简体)
以交易交易为基础的档案容器
原标题:Transaction-based archive container

I m creating a Windows service that runs when a specific USB key is plugged in. What it does is simple: contact an FTP server, download some files, and store them in an (encrypted) archive on the USB. The archive can be opened read-only with a tool provided to the client (but that s irrelevant to my problem).

此服务用于使 USB 与主服务器同步( 基本上像 Drobox 一样, 但只有下载和同步文件夹在可移动媒体上 ) 。 归档可以长到几千兆字节。 大约 1GB 文件每周更新大约400个用户的密钥 。

由于整个更新过程对用户是透明的,因此在数据写入归档时,他们“em>unplut USB(即使我用某种叫喊、闪烁的警告:DO ONT UPLUG ),也很有可能无法忽略。 要再次下载整个档案,就需要对档案进行腐蚀,这意味着已经装入的服务器上浪费了大量带宽。

因此基本上我需要归档的书写 transacted 。 如果他们失败了, 只要他们不将容器置于不一致的状态。 要么文件是完全写好的, 要么是“ em> not

The question is here: How can I guarantee data consistency at all times? Specifically, how do you make IO operations to work as transactions? What would you suggest? Shall I implement something on my own? Or are there already containers that offer this functionnality?

这是我至今为止得到的:

  • Create a new archive, rename on commit: not possible, the archive is too large.
  • Zip / Tar / 7z: unsuitable, a failed write will corrupt the archive
  • Truecrypt: unsuitable, as it requires a file system driver (Administrator privileges that the users dot not have).
  • Anything that requires mapping a file system to a file: unsuitable, pretty sure you can t do that without being Administrator, but if it s possible, it d be great.
  • Storing files in a SQLite DB: it s ACID so that could indeed be a solution. However, it would require splitting the files as SQLite has a limited BLOB capacity. Not very elegant, but I m ready to go that way. Also SQLite s transaction journal can get pretty large when storing large blobs.
  • Implement that on my own: I d rather avoid that as much as possible but I m not afraid to do it. I just find the topic pretty complex.

如果这个问题过于笼统,请将其移至SU或其它地方。

最佳回答

您可能想要尝试使用 svn 或 git 等工具下载加密差异; 当文件被损坏时, 它们通常可用于重建本地文件 。 或者只是下载 diffs 并使用补丁生成最新的文件版本 。

如果用户在写入数据的过程中拔出 FLASH 驱动器, 您还有其它问题。 许多人不可靠( 在闪光区块级别, 而不是文件系统级别), 并且可以被损坏到 NTFS 或 EXT3 这样的日记文件系统无法恢复。 这里的更多细节 : < a href=" https:// superuser. com/ questions/ can- flash- memory- be- physicly- damaged-if- power- is- interrupred- write' > https:// superuser. com/ questions/290060/ can- flash- memory- be- physidd-if- power- is- interruped- write- write

问题回答

它非常简单,真的。 写为临时, 然后设置为主, 如果写完成, 其它删除并再试一次 。

也许我们的“http://www.eldos.com/solfs/'rel=“nofolpol”>SolFS (应用版)会有效。SolFS在容器文件中提供了一个虚拟文件系统,它支持数据书写日记模式,这有助于保留文件系统的组成部分。





相关问题
WCF Transaction Flow Question

I would like to configure WCF service operations to accept a transaction if my client sends one, but not to create one if none is sent. I think this would be similar to the Supported transaction ...

question about pl/sql exception

the following text is an excerpt of oracle documentation Oracle® Database PL/SQL Language Reference 11g Release 1 (11.1) : Unhandled exceptions can also affect subprograms. If you exit a ...

SQL Server - transactions roll back on error?

We have client app that is running some SQL on a SQL Server 2005 such as the following: BEGIN TRAN; INSERT INTO myTable (myColumns ...) VALUES (myValues ...); INSERT INTO myTable (myColumns ...) ...

Cannot rollback transaction with Entity Framework

I have to do queries on uncommitted changes and I tried to use transactions, but I found that it do not work if there are exceptions. I made a simple example to reproduce the problem. I have a ...

mySQL - Prevent double booking

I am trying to work out the best way to stop double booking in my application. I have a table of unique id s each can be sold only once. My current idea is to use a transaction to check if the ...

热门标签