Module jumpscale.clients.zdb

Expand source code
from jumpscale.core.base import StoredFactory
from .client import ZDBClient, ZDBAdminClient


class ZDBFactory(StoredFactory):
    def new(self, name, *args, **kwargs):
        if kwargs.get("admin"):
            self.type = ZDBAdminClient
        return super().new(name, *args, **kwargs)


def export_module_as():

    return ZDBFactory(ZDBClient)

Sub-modules

jumpscale.clients.zdb.client

To get a new ZDB instance …

Functions

def export_module_as()
Expand source code
def export_module_as():

    return ZDBFactory(ZDBClient)

Classes

class ZDBFactory (type_, name_=None, parent_instance_=None, parent_factory_=None)

Stored factories are a custom type of Factory, which uses current configured store backend to store all instance configurations.

get a new stored factory given the type to create and store instances for.

Any factory can have a name, parent Base instance and a parent factory.

Once a stored factory is created, it tries to lazy-load all current configuration for given type_.

Args

type_ : Base
Base class type
name_ : str, optional
factory name. Defaults to None.
parent_instance_ : Base, optional
a parent Base instance. Defaults to None.
parent_factory_ : Factory, optional
a parent Factory. Defaults to None.
Expand source code
class ZDBFactory(StoredFactory):
    def new(self, name, *args, **kwargs):
        if kwargs.get("admin"):
            self.type = ZDBAdminClient
        return super().new(name, *args, **kwargs)

Ancestors

Inherited members