def client_dispatcher_factory(context): def perform_push_client_msg(intent): context.queued_pushed_events.put_nowait(intent.payload) def perform_client_subscribe_event(intent): key = (intent.event, intent.sender) def on_event(sender): payload = ejson_dumps({'event': intent.event, 'sender': sender}) context.queued_pushed_events.put_nowait(payload) # Attach the callbacks to the client context to make them have the same # lifetime given event registration expires when callback is destroyed # TODO: allow a subset of the possible events context.subscribed_events[key] = on_event signal(intent.event).connect(on_event, sender=intent.sender) def perform_client_unsubscribe_event(intent): key = (intent.event, intent.sender) try: del context.subscribed_events[key] except KeyError: pass return TypeDispatcher({ EPushClientMsg: perform_push_client_msg, EClientSubscribeEvent: perform_client_subscribe_event, EClientUnsubscribeEvent: perform_client_unsubscribe_event })
def get_dispatcher(self): return TypeDispatcher({ EGroupCreate: self.perform_group_create, EGroupRead: self.perform_group_read, EGroupAddIdentities: self.perform_group_add_identities, EGroupRemoveIdentities: self.perform_group_remove_identities, })
def get_dispatcher(self): return TypeDispatcher({ EIdentityLoad: self.perform_identity_load, EIdentityUnload: self.perform_identity_unload, EIdentityGet: self.perform_identity_get, EIdentityLogin: self.perform_identity_login, EIdentitySignup: self.perform_identity_signup })
def get_dispatcher(self): return TypeDispatcher({ EBlockReset: self.perform_block_reset, EBlockCreate: self.performer_with_connection_factory( self.perform_block_create), EBlockRead: self.performer_with_connection_factory( self.perform_block_read) })
def handshake_io_dispatcher_factory(context): async def perform_handshake_send(intent): return await context.send(intent.payload) async def perform_handshake_recv(intent): return await context.recv() return TypeDispatcher({ EHandshakeSend: perform_handshake_send, EHandshakeRecv: perform_handshake_recv })
def get_dispatcher(self): return TypeDispatcher({ ESynchronize: self.perform_synchronize, EGroupCreate: self.perform_group_create, EDustbinShow: self.perform_dustbin_show, EManifestHistory: self.perform_manifest_history, EManifestRestore: self.perform_manifest_restore, EFileCreate: self.perform_file_create, EFileRead: self.perform_file_read, EFileWrite: self.perform_file_write, EFileTruncate: self.perform_file_truncate, EFileHistory: self.perform_file_history, EFileRestore: self.perform_file_restore, EFolderCreate: self.perform_folder_create, EStat: self.perform_stat, EMove: self.perform_move, EDelete: self.perform_delete, EUndelete: self.perform_undelete })
def get_dispatcher(self): from parsec.core import (backend_group, backend_message, backend_user_vlob, backend_vlob, backend_start_api) return TypeDispatcher({ BackendCmd: self.performer_with_connection_factory(self.perform_backend_cmd), EBackendReset: self.perform_backend_reset, EBackendStatus: self.performer_with_connection_factory( self.perform_backend_status), EBackendBlockStoreGetURL: self.perform_blockstore_get_url, backend_vlob.EBackendVlobCreate: backend_vlob.perform_vlob_create, backend_vlob.EBackendVlobUpdate: backend_vlob.perform_vlob_update, backend_vlob.EBackendVlobRead: backend_vlob.perform_vlob_read, backend_user_vlob.EBackendUserVlobUpdate: backend_user_vlob.perform_user_vlob_update, backend_user_vlob.EBackendUserVlobRead: backend_user_vlob.perform_user_vlob_read, backend_message.EBackendMessageGet: backend_message.perform_message_get, backend_message.EBackendMessageNew: backend_message.perform_message_new, backend_group.EBackendGroupRead: backend_group.perform_group_read, backend_group.EBackendGroupCreate: backend_group.perform_group_create, backend_group.EBackendGroupAddIdentities: backend_group.perform_group_add_identities, backend_group.EBackendGroupRemoveIdentities: backend_group.perform_group_remove_identities, backend_start_api.EBackendCipherKeyAdd: self._start_api_component.perform_cipherkey_add, backend_start_api.EBackendCipherKeyGet: self._start_api_component.perform_cipherkey_get, backend_start_api.EBackendIdentityRegister: self._start_api_component.perform_identity_register })
def get_dispatcher(self): return TypeDispatcher({ EBlockCreate: self.perform_block_create, EBlockRead: self.perform_block_read, EBlockDelete: self.perform_block_delete, EBlockList: self.perform_block_list, EBlockSynchronize: self.perform_block_synchronize, EUserVlobRead: self.perform_user_vlob_read, EUserVlobUpdate: self.perform_user_vlob_update, EUserVlobDelete: self.perform_user_vlob_delete, EUserVlobExist: self.perform_user_vlob_exist, EUserVlobSynchronize: self.perform_user_vlob_synchronize, EVlobCreate: self.perform_vlob_create, EVlobRead: self.perform_vlob_read, EVlobUpdate: self.perform_vlob_update, EVlobDelete: self.perform_vlob_delete, EVlobList: self.perform_vlob_list, EVlobSynchronize: self.perform_vlob_synchronize, ESynchronize: self.perform_synchronize })
def get_dispatcher(self): return TypeDispatcher({ EPubKeyGet: self.perform_pubkey_get, EPubKeyAdd: self.perform_pubkey_add })
def get_dispatcher(self): return TypeDispatcher( {BlockStoreGetURL: self.perform_blockstore_get_url})
def get_dispatcher(self): return TypeDispatcher({ EGetAuthenticatedUser: self.perform_get_authenticated_user, })
def get_dispatcher(self): return TypeDispatcher({ EPrivKeyAdd: self.perform_privkey_add, EPrivKeyGet: self.perform_privkey_get })
def get_dispatcher(self): return TypeDispatcher({ EUserVlobRead: self.perform_user_vlob_read, EUserVlobUpdate: self.perform_user_vlob_update })
def get_dispatcher(self): return TypeDispatcher({ EVlobRead: self.perform_vlob_read, EVlobCreate: self.perform_vlob_create, EVlobUpdate: self.perform_vlob_update })
def get_dispatcher(self): return TypeDispatcher({ EMessageNew: self.perform_message_new, EMessageGet: self.perform_message_get, })
def get_dispatcher(self): return TypeDispatcher({ EEvent: self.perform_trigger_event, ERegisterEvent: self.perform_register_event, EUnregisterEvent: self.perform_unregister_event })