Beispiel #1
0
def decode_last_config_sequence_number(metadata_bytes):
    """Decodes last configuration and index for sequence number

    :param metadata_bytes: encoded content for sequence number
    :return: deserialized dictionary of config sequence number
    :type metadata_bytes: str
    """
    last_config = {'value': {'index': 0, 'signatures': []}}
    if metadata_bytes:
        proto_metadata = common_pb2.Metadata()
        proto_metadata.ParseFromString(metadata_bytes)
        proto_last_config = common_pb2.LastConfig()
        proto_last_config.ParseFromString(proto_metadata.value)
        last_config['value']['index'] = proto_last_config.index
        last_config['signatures'] = \
            decode_metadata_value_signatures(proto_metadata.signatures)
    return last_config
Beispiel #2
0
def decode_last_config_sequence_number(metadata_bytes):
    """Decodes last configuration and index for sequence number

    Args:
        metadata_bytes (str): encoded content for sequence number

    Returns: deserialized dictionary of config sequence number
    """
    last_config = {}
    last_config['value'] = {}
    if metadata_bytes:
        proto_metadata = common_pb2.Metadata()
        proto_metadata.ParseFromString(metadata_bytes)
        proto_last_config = common_pb2.LastConfig()
        proto_last_config.ParseFromString(proto_metadata.value)
        last_config['value']['index'] = proto_last_config.index
        last_config['signatures'] = \
            decode_metadata_value_signatures(proto_metadata.signatures)
    return last_config