[docs]asyncdefupdate_node(self,host:str,port:int,password:str,unique_identifier:int,resume_timeout:int=60,name:str=None,reconnect_attempts:int=-1,ssl:bool=False,search_only:bool=False,managed:bool=False,extras:dict=None,yaml:dict=None,disabled_sources:list[str]=None,)->Node:""" Add a new node to the database. Parameters ---------- host: str The host of the node. port: int The port of the node. password: str The password of the node. unique_identifier: int The unique identifier of the node. name: str The name of the node. resume_timeout: int The resume timeout of the node. reconnect_attempts: int The reconnect attempts of the node. ssl: bool Whether the node is using ssl. search_only: bool Whether the node is search only. managed: bool Whether the node is managed. extras: dict The extras of the node. disabled_sources: list[str] The disabled sources of the node. yaml: dict The yaml of the node. """node=Node(id=unique_identifier)self.currently_in_db.add(node.id)awaitnode.bulk_update(host=host,port=port,password=password,name=name,resume_timeout=resume_timeout,reconnect_attempts=reconnect_attempts,ssl=ssl,search_only=search_only,managed=managed,extras=extras,disabled_sources=disabled_sources,yaml=yaml,)returnnode
[docs]@staticmethodasyncdefcount()->int:"""Return the number of unbundled nodes in the database."""returnawaitNodeRow.count().where(NodeRow.id.not_in(set(BUNDLED_NODES_IDS_HOST_MAPPING.keys())))