FileSysDirectory

Wrapper for a file system directory: a persistance repository based on the file system.

This class allows you to treat a file system directory like a dictionary. All files in the directory are assumed to be pickled python objects.

Public Variables:

path

The fully qualified path to the directory.

fullKey

The full object key (basically the relative path to the object encoded as a unix filename). A string.

Base Classes

Methods

__delitem__(self, key)

   def __delitem__(self, key):

Attempts to delete the file or sub-directory indicated by key, which must be a string.

Raises an ObjectInUseError if the object is currently being used in a remote method invocation. Raises a KeyError if there is no such file.

Subdirectory removal is not implemented yet.

__getitem__(self, key)

   def __getitem__(self, key):

Gets an item from the directory. If there is a sub-directory named key, a FileSysDirectory object will be returned for it. If there is a file named key in the directory, an attempt will be made to load a single pickled instance from the file.

When called remotely, this returns a copy of the object. Clients should use the getRemote() method to obtain a remote object.

__init__(self, path, fullKey)

   def __init__(self, path, fullKey):

__makeKey(self, key)

   def __makeKey(self, key):

Private method to create a full key from the partial key of a child.

__setitem__(self, key, val)

   def __setitem__(self, key, val):

If val is a FileSysDirectory or None, tries to create a directory for it. If it is any other kind of object, tries to pickle it into a file named after the key.

key must be a string.

This method will raise an ObjectInUseError if the object can not be overwritten because it is currently in use.

getRemote(self, key, factory)

   def getRemote(self, key, factory = DynamicRemoteObjectFactory()):

Returns a remote object that can be used to reference an object in the storage system. If key does not correspond to a file in the directory, raises a KeyError.

A factory instance may be provided to create something other than a DynamicRemoteObject.

has_key(self, key)

   def has_key(self, key):

items(self)

   def items(self):

keys(self)

   def keys(self):

values(self)

   def values(self):