lglass.database.base

class lglass.database.base.Database

Database is an abstract class which defines some constants and setter/getter for subscripts. You have to extend from it by creating a new class and overriding __init__, get, list, find, save and delete to conform to the database protocol.

delete(type, primary_key)

Delete object in database.

find(key, types=None, limit=None)

Finds an object by searching the whole database for key. It’s possible to supply a list of acceptable object types and to provide a limit of objects. This method returns a list of lglass.rpsl.Object.

flush()

Flush database cache.

get(type, primary_key)

Get specific object addressed by type and primary_key from database. Returns lglass.rpsl.Object. This method shall raise a KeyError if the object was not found.

list(filter=None, limit=None)

Return list of matching RPSL object specs, filter can be a callable taking two arguments (type, primary_key), and limit can be a int. RPSL object specs are tuples consisting of two str instances.

save(obj)

Save object in database.

schema(type)

Return schema for type. Raises a KeyError if schema was not found.

class lglass.database.base.DictDatabase

This database backend operates completely in memory by using a Python dictionary to organize the information. It uses only builtin Python data types like list, tuple, and dict.

lglass.database.base.from_url(url)

Create database from URL. This function accepts a str or an URL tuple. The URL schema may have multiple formats:

  1. {db_name}
  2. whois+{db_name}
  3. whois+{module}+{db_name}
lglass.database.base.register(scheme_or_cls)

This decorator adds the supplied class to the url_schemes dict with the schema specified in name

Read the Docs v: latest
Versions
latest
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.