Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.plugins.fsck_plugin.FsckPlugin Class Reference
Inheritance diagram for obnamlib.plugins.fsck_plugin.FsckPlugin:
Inheritance graph
[legend]
Collaboration diagram for obnamlib.plugins.fsck_plugin.FsckPlugin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def enable
def configure_ttystatus
def fsck
def add_item
def error
def warning

Public Attributes

 repo
 errors
 chunkids_seen
 work_items

Detailed Description

Definition at line 266 of file fsck_plugin.py.


Member Function Documentation

def obnamlib.plugins.fsck_plugin.FsckPlugin.add_item (   self,
  work,
  append = False 
)

Definition at line 324 of file fsck_plugin.py.

00324 
00325     def add_item(self, work, append=False):
00326         work.warning = self.warning
00327         work.error = self.error
00328         work.repo = self.repo
00329         work.settings = self.app.settings
00330         work.chunkids_seen = self.chunkids_seen
00331         if append:
00332             self.work_items.append(work)
00333         else:
00334             self.work_items.insert(0, work)
00335         self.app.ts.increase('items', 1)
00336         self.app.dump_memory_profile('after adding %s' % repr(work))

Here is the call graph for this function:

Definition at line 273 of file fsck_plugin.py.

00273 
00274     def configure_ttystatus(self):
00275         self.app.ts.clear()
00276         self.app.ts['item'] = None
00277         self.app.ts['items'] = 0
00278         self.app.ts.format(
00279             'Checking %Counter(item)/%Integer(items): %String(item)')
        

Definition at line 268 of file fsck_plugin.py.

00268 
00269     def enable(self):
00270         self.app.add_subcommand('fsck', self.fsck)
00271         self.app.settings.boolean(['fsck-fix'], 
00272                                   'should fsck try to fix problems?')

Here is the call graph for this function:

Definition at line 337 of file fsck_plugin.py.

00337 
00338     def error(self, msg):
00339         self.app.ts.error(msg)
00340         self.errors += 1

Here is the caller graph for this function:

Verify internal consistency of backup repository.

Definition at line 280 of file fsck_plugin.py.

00280 
00281     def fsck(self, args):
00282         '''Verify internal consistency of backup repository.'''
00283         self.app.settings.require('repository')
00284         logging.debug('fsck on %s' % self.app.settings['repository'])
00285         self.repo = self.app.open_repository()
00286         
00287         self.repo.lock_root()
00288         client_names = self.repo.list_clients()
00289         client_dirs = [self.repo.client_dir(
00290                             self.repo.clientlist.get_client_id(name))
00291                        for name in client_names]
00292         self.repo.lockmgr.lock(client_dirs)
00293         self.repo.lock_shared()
00294 
00295         self.errors = 0
00296         self.chunkids_seen = set()
00297         self.work_items = []
00298         self.add_item(CheckRepository())
00299         final_items = [CheckForExtraChunks()]
00300         
00301         self.configure_ttystatus()
00302         i = 0
00303         while self.work_items:
00304             work = self.work_items.pop()
00305             logging.debug('doing: %s' % str(work))
00306             self.app.ts['item'] = work
00307             for more in reversed(list(work.do() or [])):
00308                 self.add_item(more, append=True)
00309             i += 1
00310             if not self.work_items:
00311                 for work in final_items:
00312                     self.add_item(work)
00313                 final_items = []
00314 
00315         self.repo.unlock_shared()
00316         self.repo.lockmgr.unlock(client_dirs)
00317         self.repo.unlock_root()
00318 
00319         self.repo.fs.close()
00320         self.app.ts.finish()
00321         
00322         if self.errors:
00323             sys.exit(1)

Here is the caller graph for this function:

Definition at line 341 of file fsck_plugin.py.

00341 
00342     def warning(self, msg):
00343         self.app.ts.notify(msg)
00344 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 295 of file fsck_plugin.py.

Definition at line 294 of file fsck_plugin.py.

Definition at line 284 of file fsck_plugin.py.

Definition at line 296 of file fsck_plugin.py.


The documentation for this class was generated from the following file: