def list_accounts(self):
     """
     Get the list of all accounts.
     """
     conn = self.conn_slave
     accounts = conn.hkeys('accounts:')
     return debinarize(accounts)
Exemple #2
0
 def list_accounts(self, **kwargs):
     """
     Get the list of all accounts.
     """
     conn = self.get_slave_conn(**kwargs)
     accounts = conn.hkeys('accounts:')
     return debinarize(accounts)
Exemple #3
0
def read_user_xattr(fd):
    it = {}
    try:
        it = xattr.get_all(fd)
    except IOError as err:
        for code in ('ENOTSUP', 'EOPNOTSUPP', 'ENOENT'):
            if hasattr(errno, code) and err.errno == getattr(errno, code):
                raise err

    meta = debinarize({k[5:]: v for k, v in it if k.startswith(b'user.')})
    return meta
    def get_account_metadata(self, req_account_id):
        conn = self.conn_slave
        if not req_account_id:
            return None
        account_id = conn.hget(self.akey(req_account_id), 'id')

        if not account_id:
            return None

        meta = conn.hgetall('metadata:%s' % account_id.decode('utf-8'))
        return debinarize(meta)
Exemple #5
0
    def get_account_metadata(self, req_account_id, **kwargs):
        if not req_account_id:
            return None

        conn = self.get_slave_conn(**kwargs)
        account_id = conn.hget(self.akey(req_account_id), 'id')

        if not account_id:
            return None

        meta = conn.hgetall('metadata:%s' % account_id.decode('utf-8'))
        return debinarize(meta)
    def info_account(self, req_account_id):
        conn = self.conn_slave
        if not req_account_id:
            return None
        account_id = conn.hget(self.akey(req_account_id), 'id')

        if not account_id:
            return None

        account_id = account_id.decode('utf-8')
        pipeline = conn.pipeline(False)
        pipeline.hgetall(self.akey(account_id))
        pipeline.zcard(self.blistkey(account_id))
        pipeline.zcard(self.clistkey(account_id))
        pipeline.hgetall('metadata:%s' % account_id)
        data = pipeline.execute()
        info = data[0]
        self.cast_fields(info)
        info[b'buckets'] = data[1]
        info[b'containers'] = data[2]
        info[b'metadata'] = data[3]
        return debinarize(info)
Exemple #7
0
    def info_account(self, req_account_id):
        conn = self.conn_slave
        if not req_account_id:
            return None
        account_id = conn.hget('account:%s' % req_account_id, 'id')

        if not account_id:
            return None

        account_id = account_id.decode('utf-8')
        pipeline = conn.pipeline(False)
        pipeline.hgetall('account:%s' % account_id)
        pipeline.zcard('containers:%s' % account_id)
        pipeline.hgetall('metadata:%s' % account_id)
        data = pipeline.execute()
        info = data[0]
        for field in (b'bytes', b'objects',
                      b'damaged_objects', b'missing_chunks'):
            info[field] = int_value(info.get(field), 0)
        info[b'containers'] = data[1]
        info[b'metadata'] = data[2]
        return debinarize(info)
Exemple #8
0
 def list_account(self):
     conn = self.conn_slave
     accounts = conn.hkeys('accounts:')
     return debinarize(accounts)