Source

graphalchemy / graphalchemy / managers / core.py

# -*- coding: utf-8 -*-
'''graph managers'''

from graphalchemy.core import octopus, app, factory
from graphalchemy.managers.readers import (
    Nodes as NodesRead, Links as LinksRead)
from graphalchemy.managers.writers import (
    Nodes as NodesWrite, Links as LinksWrite)

__all__ = ('Links', 'Nodes')
# settings
conf = octopus.G
backends = conf.backends
db = conf.key.db


class Links(LinksRead, LinksWrite):

    # graph source
    _db = app(conf.key.backend, conf.userspace)
    _model = app(conf.manager.generic.element.link, conf.managers)
    # direct link reader
    r = factory(conf.read.link, backends, db)
    # direct link writer
    w = factory(conf.write.link, backends, db)


class Nodes(NodesRead, NodesWrite):

    _model = app(conf.manager.element.node, conf.managers)

    # direct node reader
    r = factory(conf.read.node, backends, db)
    # direct node writer
    w = factory(conf.write.node, backends, db)