f8dZddlmZddlZddlZddlZddlmZmZm Z m Z ddl m Z ddl mZddlmZddlmZmZGd d Zdd ZGd d eeZy)z2Helpers for the 'hello' and legacy hello commands.) annotationsN)AnyGenericMappingOptional)ObjectId)common) SERVER_TYPE) ClusterTime _DocumentTypec eZdZdZdZdZdZdZy) HelloCompathelloismasterisWritablePrimaryz not masterN)__name__ __module__ __qualname__CMD LEGACY_CMDPRIMARYLEGACY_PRIMARY LEGACY_ERRORV/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/pymongo/hello.pyrrs CJ!GNLrrc|jdstjS|jdrtjS|jdrtjS|jdr|jdrtj S|jt jrtjS|jt jrtjS|jdrtjS|jdrtjStj S|jdd k(rtjStjS) z0Determine the server type from a hello response.ok serviceId isreplicasetsetNamehidden secondary arbiterOnlymsgisdbgrid)getr Unknown LoadBalancerRSGhostRSOtherrr RSPrimaryr RSSecondary RSArbiterMongos Standalone)docs r_get_server_typer2%s  774=""" ww{'''  """   778 && & WW[(( )(( ( WW[// 0(( ( WW[ !** * WW] #(( (&& & : %!!!%%%rceZdZdZdZd d!dZed"dZed#dZed$dZ ed%dZ ed&dZ ed'd Z ed#d Z ed#d Zed#d Zed#d Zed#dZed(dZed)dZed*dZed(dZed+dZed+dZed&dZed,dZed-dZed.dZed/dZed/dZed+dZed)dZed+dZ ed(dZ!y)0HellozHParse a hello response from the server. .. versionadded:: 3.12 )_doc _server_type _is_writable _is_readable _awaitablec>t||_||_|jtjtj tj tjfv|_|jtjk(xs |j|_ ||_ yN) r2r6r5r r,r0r/r)r7 server_typer-r8r9)selfr1 awaitables r__init__zHello.__init__Is,S1#&  --  ! !  " "     $ $ 2  !,, 0G0GG\4K\K\#rc@tj|jS)zUThe complete hello command response document. .. versionadded:: 3.4 )copyr5r=s rdocumentzHello.documentVs yy##rc|jSr;)r6rBs rr<zHello.server_type^   rc tttjt j |j jdg|j jdg|j jdgS)z;List of hosts, passives, and arbiters known to this server.hostspassivesarbiters)setmapr clean_node itertoolschainr5r'rBs r all_hostszHello.all_hostsbsd !!IIMM'2.IIMM*b1IIMM*b1   rc:|jjdiS)z&Replica set member tags or empty dict.tagsr5r'rBs rrQz Hello.tagspsyy}}VR((rc~|jjdr"tj|jdSy)z8This server's opinion about who the primary is, or None.primaryN)r5r'r partition_noderBs rrTz Hello.primaryus1 99== #((9)=> >rc8|jjdS)zReplica set name or None.r!rRrBs rreplica_set_namezHello.replica_set_name}syy}}Y''rcV|jjdtjS)NmaxBsonObjectSize)r5r'r MAX_BSON_SIZErBs r max_bson_sizezHello.max_bson_sizesyy}}0&2F2FGGrcT|jjdd|jzS)NmaxMessageSizeBytes)r5r'r[rBs rmax_message_sizezHello.max_message_sizes#yy}}2A8J8J4JKKrcV|jjdtjS)NmaxWriteBatchSize)r5r'r MAX_WRITE_BATCH_SIZErBs rmax_write_batch_sizezHello.max_write_batch_sizesyy}}0&2M2MNNrcV|jjdtjS)NminWireVersion)r5r'r MIN_WIRE_VERSIONrBs rmin_wire_versionzHello.min_wire_versionyy}}-v/F/FGGrcV|jjdtjS)NmaxWireVersion)r5r'r MAX_WIRE_VERSIONrBs rmax_wire_versionzHello.max_wire_versionrhrc8|jjdS)N setVersionrRrBs r set_versionzHello.set_versionyy}}\**rc8|jjdS)N electionIdrRrBs r election_idzHello.election_idrprc8|jjdS)Nz $clusterTimerRrBs r cluster_timezHello.cluster_timeyy}}^,,rc8|jjdS)NlogicalSessionTimeoutMinutesrRrBs rlogical_session_timeout_minutesz%Hello.logical_session_timeout_minutessyy}};<>> hello.sasl_supported_mechs ["SCRAM-SHA-1", "SCRAM-SHA-256"] saslSupportedMechsrRrBs rsasl_supported_mechszHello.sasl_supported_mechssyy}}1266rc8|jjdS)z"The speculativeAuthenticate field.speculativeAuthenticaterRrBs rspeculative_authenticatezHello.speculative_authenticatesyy}}677rc8|jjdS)NtopologyVersionrRrBs rtopology_versionzHello.topology_versionsyy}}.//rc|jSr;)r9rBs rr>zHello.awaitables rc8|jjdS)NrrRrBs r service_idzHello.service_idsyy}}[))rc:|jjddS)NhelloOkFrRrBs rhello_okzHello.hello_oksyy}}Y..rc8|jjdS)N connectionIdrRrBs r connection_idzHello.connection_idrvrN)F)r1r r>boolreturnNone)rr )rint)rzset[tuple[str, int]])rMapping[str, Any])rzOptional[tuple[str, int]])rz Optional[str])rz Optional[int])rzOptional[ObjectId])rzOptional[ClusterTime])rr)rzOptional[datetime.datetime])rzOptional[list[str]])rz list[str])rzOptional[Mapping[str, Any]])"rrr__doc__ __slots__r?propertyrCr<rOrQrTrWr[r_rcrgrlrorsruryr{r}rrrrrrr>rrrrrrr4r4As< WI $$$!!    ))((HHLLOOHHHH++++--==!!!! CC,, 7 78800**//--rr4)r1rrr)r __future__rrAdatetimerMtypingrrrr bson.objectidrpymongor pymongo.server_typer pymongo.typingsr r rr2r4rrrrsJ9" 22"+6  &8_-GM "_-r