Back to index

obnam  1.1
Public Member Functions | Public Attributes | Private Member Functions
obnamlib.repo.HookedFS Class Reference

List of all members.

Public Member Functions

def __init__
def __getattr__
def cat
def lock
def write_file
def overwrite_file

Public Attributes

 repo
 fs
 hooks

Private Member Functions

def _get_toplevel

Detailed Description

A class to filter read/written data through hooks.

Definition at line 42 of file repo.py.


Constructor & Destructor Documentation

def obnamlib.repo.HookedFS.__init__ (   self,
  repo,
  fs,
  hooks 
)

Definition at line 46 of file repo.py.

00046 
00047     def __init__(self, repo, fs, hooks):
00048         self.repo = repo
00049         self.fs = fs
00050         self.hooks = hooks
        

Member Function Documentation

def obnamlib.repo.HookedFS.__getattr__ (   self,
  name 
)

Definition at line 51 of file repo.py.

00051 
00052     def __getattr__(self, name):
00053         return getattr(self.fs, name)
        
def obnamlib.repo.HookedFS._get_toplevel (   self,
  filename 
) [private]

Definition at line 54 of file repo.py.

00054 
00055     def _get_toplevel(self, filename):
00056         parts = filename.split(os.sep)
00057         if len(parts) > 1:
00058             return parts[0]
00059         else: # pragma: no cover
00060             raise obnamlib.Error('File at repository root: %s' % filename)
        

Here is the caller graph for this function:

def obnamlib.repo.HookedFS.cat (   self,
  filename,
  runfilters = True 
)

Definition at line 61 of file repo.py.

00061 
00062     def cat(self, filename, runfilters=True):
00063         data = self.fs.cat(filename)
00064         toplevel = self._get_toplevel(filename)
00065         if not runfilters:
00066             return data
00067         return self.hooks.filter_read('repository-data', data,
00068                                       repo=self.repo, toplevel=toplevel)

Here is the call graph for this function:

def obnamlib.repo.HookedFS.lock (   self,
  filename,
  data 
)

Definition at line 69 of file repo.py.

00069 
00070     def lock(self, filename, data):
00071         self.fs.lock(filename, data)

def obnamlib.repo.HookedFS.overwrite_file (   self,
  filename,
  data,
  runfilters = True 
)

Definition at line 80 of file repo.py.

00080 
00081     def overwrite_file(self, filename, data, runfilters=True):
00082         tracing.trace('overwriting hooked %s' % filename)
00083         toplevel = self._get_toplevel(filename)
00084         if runfilters:
00085             data = self.hooks.filter_write('repository-data', data,
00086                                            repo=self.repo, toplevel=toplevel)
00087         self.fs.overwrite_file(filename, data)
00088         

Here is the call graph for this function:

def obnamlib.repo.HookedFS.write_file (   self,
  filename,
  data,
  runfilters = True 
)

Definition at line 72 of file repo.py.

00072 
00073     def write_file(self, filename, data, runfilters=True):
00074         tracing.trace('writing hooked %s' % filename)
00075         toplevel = self._get_toplevel(filename)
00076         if runfilters:
00077             data = self.hooks.filter_write('repository-data', data,
00078                                            repo=self.repo, toplevel=toplevel)
00079         self.fs.write_file(filename, data)
        

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 48 of file repo.py.

Definition at line 49 of file repo.py.

Definition at line 47 of file repo.py.


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