def __init__(self, customer_idurl): """ Create customer_assistant() state machine for given customer. """ self.customer_idurl = customer_idurl self.donated_bytes = accounting.get_customer_quota(self.customer_idurl) name = "customer_%s_%s" % ( nameurl.GetName(self.customer_idurl), diskspace.MakeStringFromBytes(self.donated_bytes).replace(' ', ''), ) super(CustomerAssistant, self).__init__(name, 'AT_STARTUP', _DebugLevel, _Debug)
def __init__(self, customer_idurl): """ Create customer_assistant() state machine for given customer. """ self.customer_idurl = customer_idurl self.donated_bytes = accounting.get_customer_quota( self.customer_idurl) or 0 name = "customer_%s_%s" % ( nameurl.GetName(self.customer_idurl), diskspace.MakeStringFromBytes(self.donated_bytes).replace(' ', ''), ) super(CustomerAssistant, self).__init__( name=name, state='AT_STARTUP', debug_level=_DebugLevel, log_events=False, log_transitions=_Debug, )
def doRequestCustomerSignature(self, *args, **kwargs): """ Action method. """ bytes_allocated = accounting.get_customer_quota(self.customer_idurl) assert bytes_allocated is not None assert bytes_allocated > 0 coin_json = coins_io.storage_contract_open( self.customer_idurl, self.current_duration, bytes_allocated, ) coin_json_sined = coins_io.add_signature(coin_json, 'creator') p2p_service.SendCoin(self.customer_idurl, [ coin_json_sined, ], callbacks={ commands.Ack(): self._on_signature_ack, commands.Fail(): self._on_signature_fail, })