Package twisted :: Package persisted :: Module filepile :: Class FilePile
[show private | hide private]
[frames | no frames]

Class FilePile


Method Summary
  __init__(self, dirname, loader, pilext, itemext, cmpfunc)
Create a FilePile.
  __iter__(self)
Return me.
  backwards(self)
Return an iterator that goes backwards over me.
  insertLink(self, name, *path)
Create an item with proper extensions at the given itemPath.
  itemPath(self, *path)
itemPath('1','2','3') => '<self.dirname>/1.pile/2.pile/3.item'
  numberedDirectory(self, *path)
  numberedLink(self, *path)
Create an item with proper extensions at the given path.
  pilePath(self, *path)
pilePath('1','2','3') => '<self.dirname>/1.pile/2.pile/3.pile'

Method Details

__init__(self, dirname, loader=<type 'str'>, pilext='pile', itemext='item', cmpfunc=<built-in function cmp>)
(Constructor)

Create a FilePile.
Parameters:
loader - a factory function for whatever kind of objects you are storing here. The signature of this function is loader(filename) -> object.
pilext - The extension to use for subdirectories which represent collections, or 'subpiles'.
itemext - The extension to use for files or symlinks in this directory whose names will be passed to the 'loader' function, and returned from my iteration methods.
cmpfunc - a comparison function which compares filenames. This has a signature identical to cmp, and is passed to list.sort.

__iter__(self)

Return me. I will act as an iterator that goes forwards over my items. Iterating this will change my cursor, so watch out for concurrent uses!

backwards(self)

Return an iterator that goes backwards over me. This iterator will change my cursor, so watch out for concurrent uses!

insertLink(self, name, *path)

Create an item with proper extensions at the given itemPath.
Parameters:
name - the value of the symlink created.
path - a tuple of names passed to self.itemPath(*path).

itemPath(self, *path)

itemPath('1','2','3') => '<self.dirname>/1.pile/2.pile/3.item'

numberedLink(self, *path)

Create an item with proper extensions at the given path.

I use nextFileName; see its documentation for details.
Parameters:
path - a tuple of names passed to self.pilePath(*path).

pilePath(self, *path)

pilePath('1','2','3') => '<self.dirname>/1.pile/2.pile/3.pile'

Generated by Epydoc 1.1 on Fri Jun 27 03:45:38 2003 http://epydoc.sf.net