summaryrefslogtreecommitdiff
path: root/kvmd/aiofs.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-05-29 04:33:35 +0300
committerDevaev Maxim <[email protected]>2020-05-29 04:33:35 +0300
commitcf5bf8e14732e7c0bdc67a08a0e410b81b2d4572 (patch)
tree32a0b872b8bf21d5b69e7686ba55ca0f85e50e3f /kvmd/aiofs.py
parenteb13da03be9f52954755930def2bfdf57fb6347c (diff)
refactoring
Diffstat (limited to 'kvmd/aiofs.py')
-rw-r--r--kvmd/aiofs.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/kvmd/aiofs.py b/kvmd/aiofs.py
new file mode 100644
index 00000000..c7bbd10d
--- /dev/null
+++ b/kvmd/aiofs.py
@@ -0,0 +1,35 @@
+# ========================================================================== #
+# #
+# KVMD - The main Pi-KVM daemon. #
+# #
+# Copyright (C) 2018 Maxim Devaev <[email protected]> #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <https://www.gnu.org/licenses/>. #
+# #
+# ========================================================================== #
+
+
+import os
+
+import aiofiles
+import aiofiles.base
+
+from . import aiotools
+
+
+# =====
+async def afile_write_now(afile: aiofiles.base.AiofilesContextManager, data: bytes) -> None:
+ await afile.write(data)
+ await afile.flush()
+ await aiotools.run_async(os.fsync, afile.fileno())