MCPcopy Create free account
hub / github.com/wal-e/wal-e / _fsync_files

Function _fsync_files

wal_e/tar_partition.py:158–184  ·  view source on GitHub ↗

Call fsync() a list of file names The filenames should be absolute paths already.

(filenames)

Source from the content-addressed store, hash-verified

156
157
158def _fsync_files(filenames):
159 """Call fsync() a list of file names
160
161 The filenames should be absolute paths already.
162
163 """
164 touched_directories = set()
165
166 mode = os.O_RDONLY
167
168 # Windows
169 if hasattr(os, 'O_BINARY'):
170 mode |= os.O_BINARY
171
172 for filename in filenames:
173 fd = os.open(filename, mode)
174 os.fsync(fd)
175 os.close(fd)
176 touched_directories.add(os.path.dirname(filename))
177
178 # Some OSes also require us to fsync the directory where we've
179 # created files or subdirectories.
180 if hasattr(os, 'O_DIRECTORY'):
181 for dirname in touched_directories:
182 fd = os.open(dirname, os.O_RDONLY | os.O_DIRECTORY)
183 os.fsync(fd)
184 os.close(fd)
185
186
187def cat_extract(tar, member, targetpath):

Callers 1

tarfile_extractMethod · 0.85

Calls 3

openMethod · 0.80
addMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected