Database client for accessing storage.

           :returns: :class:`livebridge.storages.base.BaseStorage`
169790
def _db(self):
        
        if not hasattr(self, "_db_client") or getattr(self, "_db_client") is None:
            self._db_client = get_db_client()
        return self._db_client
397792
def connect_db(database_name=":memory:"):
    
    db = repo.Repo.connect_db(database_name)
    base.Repo.db = db
    query.Repo.db = db
1320074
def file_client(self):
        '''
        
        '''
        if not self._file_client:
            self._file_client = salt.fileclient.get_file_client(
                self.opts, self.pillar_rend)
        return self._file_client
779434
def db(self):
        

        # Initialize the database handle; we're running in a separate
        # process, so we need to get_database() ourself
        if not self._db:
            self._db = self.config.get_database()

        return self._db
160130
def get_storage(self):
        '''
        '''

        if self.storage:
            return self.storage
        self.storage = self.reconnect_redis()

        return self.storage
81526
def get(self):
        
        request = self._call(GetSharedStorages)
        response = request.commit()
        return response['Value']
48537
def retrieve(self):
        

        data = self.resource(self.id).get()
        self.data = data

        return data
895440
def client
      @client ||= (client = Clients.with_name(client_name)
                    client = client.use(database_name) if database_name_option
                    client.with(client_options))
    end
728890
def getdb(backend=None, **kwargs):
    ''''''
    if isinstance(backend, BackendDataServer):
        return backend
    backend = backend or settings.DEFAULT_BACKEND
    if not backend:
        return None
    scheme, address, params = parse_backend(backend)
    params.update(kwargs)
    if 'timeout' in params:
        params['timeout'] = int(params['timeout'])
    return _getdb(scheme, address, params)
76969
def get_storages(self, storage_type='normal'):
        
        res = self.get_request('/storage/' + storage_type)
        return Storage._create_storage_objs(res['storages'], cloud_manager=self)
1307316
def external_table(self):
        
        if self._external is None:
            self._external = ExternalTable(self.connection, self.database)
        return self._external
34381
def get(self, blob):
        
        return self._send(
            url=self._base_url + blob.parent.server_id + '/' + blob.server_id + '?s=0',
            method='GET',
            allow_redirects=False
        ).headers.get('Location')
235829
def storage_class(self):
        
        if not hasattr(self, '_storage_class'):
            self._storage_class = conf.lib.clang_Cursor_getStorageClass(self)

        return StorageClass.from_id(self._storage_class)
917757
def get(self, item):
        
        resource = super(CloudDatabaseManager, self).get(item)
        resource.volume = CloudDatabaseVolume(resource, resource.volume)
        return resource
879768
def show_storage(kwargs=None, conn=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The show_storage function must be called with -f or --function.'
        )

    if not conn:
        conn = get_conn()

    if kwargs is None:
        kwargs = {}

    if 'name' not in kwargs:
        raise SaltCloudSystemExit('A name must be specified as "name"')

    data = conn.get_storage_account_properties(
        kwargs['name'],
    )
    return object_to_dict(data)
35774
def storage_systems(self):
        
        if not self.__storage_systems:
            self.__storage_systems = StorageSystems(self.__connection)
        return self.__storage_systems
805460
def get_connection(self):
        
        if not self.open:
            raise exc.ResourceClosedError('Database closed.')

        return Connection(self._engine.connect())