Пример #1
0
def _basic_message(msg, now):
    oid = msg['_id']
    age = now - utils.oid_ts(oid)
    res = {'id': str(oid), 'age': int(age), 'ttl': msg['t'], 'body': msg['b']}
    if msg.get('cs'):
        res['checksum'] = msg.get('cs')

    return res
Пример #2
0
def _basic_message(msg, now):
    oid = msg['_id']
    age = now - utils.oid_ts(oid)

    return {
        'id': str(oid),
        'age': int(age),
        'ttl': msg['t'],
        'body': msg['b'],
        'claim_id': str(msg['c']['id']) if msg['c']['id'] else None
    }
Пример #3
0
def _basic_message(msg, now):
    oid = msg['_id']
    age = now - utils.oid_ts(oid)

    return {
        'id': str(oid),
        'age': int(age),
        'ttl': msg['t'],
        'body': msg['b'],
        'claim_id': str(msg['c']['id']) if msg['c']['id'] else None
    }
Пример #4
0
def _basic_message(msg, now):
    oid = msg['_id']
    age = now - utils.oid_ts(oid)
    res = {
        'id': str(oid),
        'age': int(age),
        'ttl': msg['t'],
        'body': msg['b']
        }
    if msg.get('cs'):
        res['checksum'] = msg.get('cs')

    return res
Пример #5
0
def _basic_message(msg, now):
    oid = msg['_id']
    age = now - utils.oid_ts(oid)
    res = {
        'id': str(oid),
        'age': int(age),
        'ttl': msg['t'],
        'claim_count': msg['c'].get('c', 0),
        'body': msg['b'],
        'claim_id': str(msg['c']['id']) if msg['c']['id'] else None
        }
    if msg.get('cs'):
        res['checksum'] = msg.get('cs')

    return res
Пример #6
0
def _basic_message(msg, now):
    oid = msg['_id']
    age = now - utils.oid_ts(oid)
    res = {
        'id': str(oid),
        'age': int(age),
        'ttl': msg['t'],
        'claim_count': msg['c'].get('c', 0),
        'body': msg['b'],
        'claim_id': str(msg['c']['id']) if msg['c']['id'] else None
    }
    if msg.get('cs'):
        res['checksum'] = msg.get('cs')

    return res
Пример #7
0
def _basic_subscription(record, now):
    # NOTE(Eva-i): unused here record's field 'e' (expires) has changed it's
    # format from int (timestamp) to datetime since patch
    # 1d122b1671792aff0055ed5396111cd441fb8269. Any future change about
    # starting using 'e' field should make sure support both of the formats.
    oid = record['_id']
    age = now - utils.oid_ts(oid)
    confirmed = record.get('c', True)
    return {
        'id': str(oid),
        'source': record['s'],
        'subscriber': record['u'],
        'ttl': record['t'],
        'age': int(age),
        'options': record['o'],
        'confirmed': confirmed,
    }
Пример #8
0
def _basic_subscription(record, now):
    # NOTE(Eva-i): unused here record's field 'e' (expires) has changed it's
    # format from int (timestamp) to datetime since patch
    # 1d122b1671792aff0055ed5396111cd441fb8269. Any future change about
    # starting using 'e' field should make sure support both of the formats.
    oid = record['_id']
    age = now - utils.oid_ts(oid)
    confirmed = record.get('c', True)
    return {
        'id': str(oid),
        'source': record['s'],
        'subscriber': record['u'],
        'ttl': record['t'],
        'age': int(age),
        'options': record['o'],
        'confirmed': confirmed,
    }