Table of Contents

Class: DirDBM | Twisted-0.17.4/twisted/persisted/dirdbm.py
--- | ---

### A directory with a DBM interface.

This class presents a hash-like interface to a directory of small, flat files. It can only use strings as keys or values.

Methods |
--- | ---

__delitem__ __getitem__ __init__ __setitem__ _decode _encode _readFile | _writeFile close has_key items keys update values

| __delitem__

    __delitem__ ( self,  k )

del dirdbm[foo]; delete a file in this directory

Exceptions |
--- | ---
KeyError(self._decode( k ) )

| __getitem__

    __getitem__ ( self,  k )

dirdbm[foo]; get the contents of a file in this directory as a string

Exceptions |
--- | ---
KeyError, k

| __init__

    __init__ ( self,  name )

Initialize.

| __setitem__

    __setitem__ (
            self,
            k,
            v,
            )

dirdbm[foo] = bar; create or modify a textfile in this directory

| _decode

    _decode ( self,  k )

Decode a filename to get the key.

| _encode

    _encode ( self,  k )

Encode a key so it can be used as a filename.

| _readFile

    _readFile ( self,  path )

### Read in the contents of a file.

Override in subclasses to e.g. provide transparently encrypted dirdbm.

| _writeFile

    _writeFile (
            self,
            path,
            data,
            )

### Write data to a file.

Override in subclasses to e.g. provide transparently encrypted dirdbm.

| close

    close ( self )

close this dbm: no-op, for dbm-style interface compliance

| has_key

    has_key ( self,  key )

dirdbm.has_key(key); return whether the file `key' exists.

| items

    items ( self )

dirdbm.items(); return an interspersed list of tuples of keys() and values()

| keys

    keys ( self )

dirdbm.keys(); return a list of filenames

| update

    update ( self,  dict )

dirdbm.update(dict); update me from another dict-style interface

| values

    values ( self )

dirdbm.values(); return a list of file-contents

Table of Contents

This document was automatically generated on Sat Apr 20 01:31:01 2002 by HappyDoc version 2.0