Endian banner

endian.data package

Submodules

endian.data.constants module

setConstant(key, value)

Sets the constant ‘key’ to ‘value’

@param key: the key to be set @type key: string

@param value: the value @type value: string

endian.data.driver module

class Driver

Bases: object

checkFormat()
isDirty()
load()
save()
class FileExpirator(filename)

Bases: object

update()

endian.data.ds module

class DataSource(path='', root=None, base=None)

Bases: dict

copy()
get(key, default=None)
items()
iteritems()
itervalues()
keys()
values()

endian.data.exceptions module

exception InvalidGetMethod

Bases: exceptions.Exception

archiveException(res, e)

Archives an exception to the datasource ‘res’ for later examination.

@type res: dict @param res: ressource dictionary which stores the exceptions in key ‘exceptions’

@type e: Exception @param e: exception to be archived

resetExceptions(res)

resets the exception archive”

@returns a pointer to the new empty archive

endian.data.interfaces module

class ContainerInterface(filename)

Bases: object

read()
registerOnRead(method)
registerOnWrite(method)
write(filename=None)
class ExpireableFile(filename)
class ExpireablePaths(paths)

endian.data.methods module

register_lookup(prio, method, cb, typefilter='*', keyfilter='*', backend=None)
registerLookup()

Registers a lookup callback for method ‘method’ with priority ‘prio’ to the datasource lookup registry.

Parameters:
  • prio (number) – specifies a priority in which order of precedence the lookup callback should be called. Lesser has more precedence. If prio is None, don’t register the callback in the lookup registry but, only if the backend argument is present, in the backends lookup registry.
  • method (string) – Specifies for which lookup method the callback should be registered. Valid values are: ‘I{get}’, ‘I{iter}’, ‘I{in}’, ‘I{nodeType}’, ‘I{init}’ The respective method’s will be triggered by the respective real DataSource methods L{<DataSource.get>}, L{DataSource.__iter__} and L{DataSource.__contains__}.
  • cb (function) –

    Specifies the callback function to be called when this method triggers. The function needs to have the following format:

    C{method(key, obj, res)}

    where I{key} will be the value of the key called by the lookup method (where it makes sense) and I{obj} points to the L{<DataSource>} object from where the method has been called. This way the lookup methods have access to the entire DataSource tree. I{res} specifies a dict resource to which the callback may access in order to store data forth for following lookup iterations

  • typefilter (string) – if supplied, causes the callback to trigger only if the key for which the lookup callback should be triggered is of the specified node-type. Valid values are ‘I{node}’, ‘I{leaf}’ and ‘I{*}’ Default is ‘I{*}’, which means apply to any type.
  • keyfilter (string) – if supplied, causes the callback to trigger only if the key for which the lookup callback should be triggered is same as the value of keyfilter. A value of ‘I{*}’ means, apply to any key. ‘I{*}’ is the default.
  • backend (string) – backend name, if supplied register the callback for the given backend/method
unregister_lookup(prio, method, cb, typefilter='*', keyfilter='*')
lookup(method, key=None, t=None, backend=None)
get_backends()
get_backends()

Return the list of all the defined backends

registerLookup(prio, method, cb, typefilter='*', keyfilter='*', backend=None)
registerLookup()

Registers a lookup callback for method ‘method’ with priority ‘prio’ to the datasource lookup registry.

Parameters:
  • prio (number) – specifies a priority in which order of precedence the lookup callback should be called. Lesser has more precedence. If prio is None, don’t register the callback in the lookup registry but, only if the backend argument is present, in the backends lookup registry.
  • method (string) – Specifies for which lookup method the callback should be registered. Valid values are: ‘I{get}’, ‘I{iter}’, ‘I{in}’, ‘I{nodeType}’, ‘I{init}’ The respective method’s will be triggered by the respective real DataSource methods L{<DataSource.get>}, L{DataSource.__iter__} and L{DataSource.__contains__}.
  • cb (function) –

    Specifies the callback function to be called when this method triggers. The function needs to have the following format:

    C{method(key, obj, res)}

    where I{key} will be the value of the key called by the lookup method (where it makes sense) and I{obj} points to the L{<DataSource>} object from where the method has been called. This way the lookup methods have access to the entire DataSource tree. I{res} specifies a dict resource to which the callback may access in order to store data forth for following lookup iterations

  • typefilter (string) – if supplied, causes the callback to trigger only if the key for which the lookup callback should be triggered is of the specified node-type. Valid values are ‘I{node}’, ‘I{leaf}’ and ‘I{*}’ Default is ‘I{*}’, which means apply to any type.
  • keyfilter (string) – if supplied, causes the callback to trigger only if the key for which the lookup callback should be triggered is same as the value of keyfilter. A value of ‘I{*}’ means, apply to any key. ‘I{*}’ is the default.
  • backend (string) – backend name, if supplied register the callback for the given backend/method
unregisterLookup(prio, method, cb, typefilter='*', keyfilter='*')