summaryrefslogtreecommitdiff
path: root/mytasks.py
diff options
context:
space:
mode:
authorLudovic Pouzenc <lpouzenc@gmail.com>2015-06-28 18:32:04 +0200
committerLudovic Pouzenc <lpouzenc@gmail.com>2015-06-28 18:32:04 +0200
commitc0a4cd0c626f5d91c9c0f29799255bd20b2cac48 (patch)
treeecea56e649593e4294826ecb656490711a43a1a9 /mytasks.py
parent45e7b53b013999e4cc2f72c080651cc2ece5a346 (diff)
downloadraidguessfs-c0a4cd0c626f5d91c9c0f29799255bd20b2cac48.tar.gz
raidguessfs-c0a4cd0c626f5d91c9c0f29799255bd20b2cac48.tar.bz2
raidguessfs-c0a4cd0c626f5d91c9c0f29799255bd20b2cac48.zip
New module to handle background / long tasks
Diffstat (limited to 'mytasks.py')
-rw-r--r--mytasks.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/mytasks.py b/mytasks.py
new file mode 100644
index 0000000..6c03262
--- /dev/null
+++ b/mytasks.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+# RaidGuessFS, a FUSE pseudo-filesystem to guess RAID parameters of a damaged device
+# Copyright (C) 2015 Ludovic Pouzenc <ludovic@pouzenc.fr>
+#
+# This file is part of RaidGuessFS.
+#
+# RaidGuessFS 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.
+#
+# RaidGuessFS 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 RaidGuessFS. If not, see <http://www.gnu.org/licenses/>
+
+import logging
+
+class MyTasks():
+ """Auxiliary class, managing long or background tasks"""
+
+ TASK_NAMES = [ 'find_bootsect', 'find_files' ]
+
+ def __init__(self, *args, **kwargs):
+ self.tasks = []
+ self.find_files_pathlist = []
+
+ def get_task_start(self):
+ return 'Write a task_name in this pseudo-file to start it\n'
+
+ def get_task_kill(self):
+ return 'Write a task_name in this pseudo-file to kill it\n'
+
+ def get_find_files_pathlist(self):
+ return self.find_files_pathlist
+
+ def get_find_files_pathlist_str(self):
+ return '\n'.join(self.find_files_pathlist)
+
+ def set_task_start(self, task_name):
+ raise Exception('Not yet implemented')
+
+ def set_task_kill(self, task_name):
+ raise Exception('Not yet implemented')
+
+ def set_find_files_pathlist(self, new_find_files_pathlist):
+ self.find_files_pathlist = new_find_files_pathlist
+
+ def read_find_bootsect(self):
+ return 'This task is not started\n'
+
+ def read_find_files(self):
+ return 'This task is not started\n'
+