From c0a4cd0c626f5d91c9c0f29799255bd20b2cac48 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 28 Jun 2015 18:32:04 +0200 Subject: New module to handle background / long tasks --- mytasks.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 mytasks.py (limited to 'mytasks.py') 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 +# +# 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 + +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' + -- cgit v1.2.3