diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-08-31 14:24:32 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-08-31 14:24:32 -0400 |
commit | a7383bc94e41d94e77e67406e1a4085d34241bfc (patch) | |
tree | 4a9dc422ada9ad424bef84dcb7466812e1f51f2f /Types/Remote.hs | |
parent | 36b222bf699023f3e460c8bc231b2916aa27ab5c (diff) |
make storeExport atomic
This avoids needing to deal with the complexity of partially transferred
files in the export. We'd not be able to resume uploading to such a file
anyway, so just avoid them.
The implementation in Remote.Directory is not completely ideal, because
it could leave the temp file hanging around in the export directory.
This only happens if it's killed with -9, or there's a power failure;
normally viaTmp cleans up after itself, even when interrupted. I could
not see a better way to do it though, since the export directory might
be the root of a filesystem.
Also some design thoughts on resuming, which depend on storeExport being
atomic.
This commit was sponsored by Fernando Jimenez on Partreon.
Diffstat (limited to 'Types/Remote.hs')
-rw-r--r-- | Types/Remote.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Types/Remote.hs b/Types/Remote.hs index 6a4d2039e..6e78bf238 100644 --- a/Types/Remote.hs +++ b/Types/Remote.hs @@ -98,7 +98,8 @@ data RemoteA a = Remote { checkPresentCheap :: Bool, -- Exports content to an ExportLocation. - -- The exported file does not need to be updated atomically. + -- The exported file should not appear to be present on the remote + -- until all of its contents have been transferred. storeExport :: Maybe (FilePath -> Key -> ExportLocation -> MeterUpdate -> a Bool), -- Retrieves exported content to a file. -- (The MeterUpdate does not need to be used if it writes |