Exemplo n.º 1
0
 def translate_delegation_to_avro(*, delegation: ABCDelegation) -> DelegationAvro:
     avro_delegation = DelegationAvro()
     avro_delegation.delegation_id = delegation.get_delegation_id()
     avro_delegation.state = delegation.get_state().value
     avro_delegation.slice = Translate.translate_slice_to_avro(slice_obj=delegation.get_slice_object())
     if delegation.get_graph() is not None and not (delegation.is_reclaimed() or delegation.is_closed()):
         avro_delegation.graph = delegation.get_graph().serialize_graph()
     return avro_delegation
    def pass_delegation(*, delegation: ABCDelegation) -> ABCDelegation:
        slice_obj = delegation.get_slice_object().clone_request()

        delegation_new = DelegationFactory.create(
            did=delegation.get_delegation_id(),
            slice_id=delegation.get_slice_id())
        delegation_new.set_slice_object(slice_object=slice_obj)
        # TODO
        if not delegation.is_reclaimed():
            delegation_new.set_graph(delegation.get_graph())
        return delegation_new