def do_reclaim_delegation(self, *, actor: ABCActorMixin, proxy: ABCBrokerProxy, delegation: ABCDelegation, callback: ABCClientCallbackProxy, caller: AuthToken, id_token: str = None): proxy.get_logger().info( "Outbound reclaim delegation request from <{}>: {}".format( caller.get_name(), delegation)) state = proxy.prepare_reclaim_delegation(delegation=delegation, callback=callback, caller=caller, id_token=id_token) state.set_caller(caller=caller) state.set_type(rtype=RPCRequestType.ReclaimDelegation) rpc = RPCRequest(request=state, actor=actor, proxy=proxy, delegation=delegation, sequence=delegation.get_sequence_out()) # Schedule a timeout rpc.timer = KernelTimer.schedule(queue=actor, task=ReclaimTimeout(req=rpc), delay=self.CLAIM_TIMEOUT_SECONDS) proxy.get_logger().info("Timer started: {} for Reclaim".format( rpc.timer)) self.enqueue(rpc=rpc)
def pass_delegation(self, *, delegation: ABCDelegation, auth: AuthToken) -> ABCDelegation: slice_obj = delegation.get_slice_object().clone_request() broker_delegation = BrokerDelegationFactory.create( did=str(delegation.get_delegation_id()), slice_id=slice_obj.get_slice_id(), broker=self) broker_delegation.set_sequence_in( sequence=delegation.get_sequence_out()) broker_delegation.set_owner(owner=self.get_identity()) return broker_delegation
def do_update_delegation(self, *, actor: ABCActorMixin, proxy: ABCClientCallbackProxy, delegation: ABCDelegation, update_data: UpdateData, callback: ABCCallbackProxy, caller: AuthToken): proxy.get_logger().info( "Outbound update delegation request from <{}>: {}".format( caller.get_name(), delegation)) state = proxy.prepare_update_delegation(delegation=delegation, update_data=update_data, callback=callback, caller=caller) state.set_caller(caller=caller) state.set_type(rtype=RPCRequestType.UpdateDelegation) rpc = RPCRequest(request=state, actor=actor, proxy=proxy, delegation=delegation, sequence=delegation.get_sequence_out()) self.enqueue(rpc=rpc)
def pass_delegation(delegation: ABCDelegation, auth: AuthToken) -> DelegationAvro: avro_delegation = Translate.translate_delegation_to_avro( delegation=delegation) avro_delegation.sequence = delegation.get_sequence_out() return avro_delegation