winapi - What are "transactional" file operations? -


i browsing win32 api functions file , directory management operations. saw of functions has called "transactional" counterparts.

examples:
createdirectory , createdirectorytransacted
removedirectory , removedirectorytransacted
createfile , createfiletransacted
copyfile , copyfiletransacted

i read explanations of these transacted functions, wikipedia article transactional ntfs , this msdn magazine page. because of heavy terminology (for me) in these pages, didn't understand these explanations. come common consensus these functions "atomic". far understand word "atom", nucleus spinning electrons around it...

can please explain me in basic , simple english sentences, purposes , operations of these functions? why , when 1 prefer transacted version of api function?

in short, transaction (be file system, database or bank) completed if no errors occurred in process.

using non-transactional file system , api, have file containing:

aaaa 

now want fill file b's, while doing in middle power lost , not data committed disk. have inconsistent state when read file (after power returns):

bbaa 

remember fat , scandisk?

now transactions, file system first write changes different location on disk, , change "file data location pointers" inodes towards new location of data when finished, marking space old data occupied 'available' again.

you don't need transactional ntfs (txf) this, 'standard' ntfs promises ensure consistency:

ntfs recoverable file system guarantees consistency of volume using standard transaction logging , recovery techniques. in event of system failure, ntfs runs recovery procedure accesses information stored in transaction log file. ntfs recovery procedure guarantees volume restored consistent state. transaction logging requires little overhead.


Comments