lib.FileContext.put(): Add parameter "atomic"
Add the parameter "atomic" to put() / _put(). If instructs the implementation to take extra precautions to make sure the operation either succeeds or fails entirely, i.e. doesn't leave a broken target file behind.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
bbb2d16956
commit
94eee5c4bb
3 changed files with 16 additions and 26 deletions
|
|
@ -88,6 +88,7 @@ class FileContext(abc.ABC):
|
|||
owner: str|None,
|
||||
group: str|None,
|
||||
mode: str|None,
|
||||
atomic: bool,
|
||||
) -> Result:
|
||||
raise NotImplementedError()
|
||||
|
||||
|
|
@ -98,13 +99,14 @@ class FileContext(abc.ABC):
|
|||
wd: str|None = None,
|
||||
throw: bool = True,
|
||||
verbose: bool|None = None,
|
||||
title: str=None,
|
||||
owner: str|None=None,
|
||||
group: str|None=None,
|
||||
mode: str|None=None,
|
||||
title: str = None,
|
||||
owner: str|None = None,
|
||||
group: str|None = None,
|
||||
mode: str|None = None,
|
||||
atomic: bool = False
|
||||
) -> Result:
|
||||
return await self._put(content, path, wd=wd, throw=throw, verbose=verbose,
|
||||
title=title, owner=owner, group=group, mode=mode)
|
||||
title=title, owner=owner, group=group, mode=mode, atomic=atomic)
|
||||
|
||||
async def _close(self) -> None:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue