Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
python3-tvault-contego / usr / lib / python3.6 / site-packages / contego / __pycache__ / rpc.cpython-36.opt-1.pyc
Size: Mime:
3

h§`m*ã@sdddddddddd	d
gZddlZdd
lmZddlZddlmZddl	m
Z
ddlmZddl
ZddlZddlmZejjZejeƒZdadadadaejjgZgZddddœZdd„Zddl m!Z!dd„Z"dd„Z#dd„Z$dd„Z%dd„Z&dd„Z'Gdd „d ej(ƒZ)Gd!d„dej*ƒZ+d3d"d#„Z,d4d$d„Z-d5d%d„Z.d6d&d	„Z/d'd(„Z0d)d*„Z1Gd+d,„d,e2ƒZ3Gd-d.„d.e2ƒZ4Gd/d0„d0e
j5ƒZ6d1d2„Z7dS)7ÚinitÚcleanupÚset_defaultsÚadd_extra_exmodsÚclear_extra_exmodsÚget_allowed_exmodsÚRequestContextSerializerÚ
get_clientÚ
get_serverÚget_notifierÚTRANSPORT_ALIASESéN)Úlog)Ú	jsonutils)Ú
periodic_task)Ú	timeutils)Ú_ZrabbitZqpidZzmq)zcontego.rpc.impl_kombuzcontego.rpc.impl_qpidzcontego.rpc.impl_zmqcCstj|ƒdS)N)Ú	messagingZset_transport_defaults)Zcontrol_exchange©rú/usr/lib/python3.6/rpc.pyr2s)ÚcfgcCs.tjddddgddddg}|}|j|ƒdS)NÚnotification_formatÚunversionedÚ	versionedÚbothZDEFAULTÚ)ÚchoicesÚdefaultZdeprecated_groupÚhelp)rZStrOptÚ
register_opts)ÚconfZnotification_optsZALL_OPTSrrrr6s
rcCs°t|ƒtƒ}tj||datj||dattƒƒ}|j	dkr^tj
t|datj
t|ddanN|j	dkrŠtj
t|datj
t|dgdan"tj
t|ddatj
t|dgdadS)	N)Úallowed_remote_exmodsr)Ú
serializerZnoop)r!ZdriverrZversioned_notifications)r!Ztopics)
rrrÚ
get_transportÚ	TRANSPORTZget_notification_transportÚNOTIFICATION_TRANSPORTrÚJsonPayloadSerializerrZNotifierÚLEGACY_NOTIFIERÚNOTIFIER)rÚexmodsr!rrrrEs.



cCs$tjƒtjƒdaaaadS)N)r#rr$r&r'rrrrrbscGstj|ƒdS)N)ÚEXTRA_EXMODSÚextend)ÚargsrrrrpscCstdd…=dS)N)r)rrrrrtscCsttS)N)ÚALLOWED_EXMODSr)rrrrrxsc@seZdZedd„ƒZdS)r%cCstj|ddS)NT)Zconvert_instances)rZto_primitive)ÚcontextÚentityrrrÚserialize_entity}sz&JsonPayloadSerializer.serialize_entityN)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr/rrrrr%|sr%c@s4eZdZdd„Zdd„Zdd„Zdd„Zd	d
„ZdS)rcCs
||_dS)N)Ú_base)ÚselfÚbaserrrÚ__init__„sz!RequestContextSerializer.__init__cCs|js
|S|jj||ƒS)N)r4r/)r5r-r.rrrr/‡sz)RequestContextSerializer.serialize_entitycCs|js
|S|jj||ƒS)N)r4Údeserialize_entity)r5r-r.rrrr8Œsz+RequestContextSerializer.deserialize_entitycCs|jƒS)N)Zto_dict)r5r-rrrÚserialize_context‘sz*RequestContextSerializer.serialize_contextcCstjjj|ƒS)N)Úcontegor-ÚRequestContextZ	from_dict)r5r-rrrÚdeserialize_context”sz,RequestContextSerializer.deserialize_contextN)r0r1r2r7r/r8r9r<rrrrr‚s
cCstjjt|tƒS)N)rZTransportURLÚparseÚCONFr)Zurl_strrrrÚget_transport_url˜sr?cCs>tjj}tjjgg}tj||d}t|ƒ}tj||||dS)N)r )Úversion_capr!)	r:rr>Ú	exceptionr0rr"rÚ	RPCClient)Útargetr@r!rr(r#rrrrœscCst|ƒ}tjt||d|dS)NZeventlet)Úexecutorr!)rrZget_rpc_serverr#)rCZ	endpointsr!rrrr	©scCs&|sd||ptjf}ttj|dƒS)Nz%s.%s)Úpublisher_id)r>ÚhostÚLegacyValidatingNotifierr&Úprepare)ZservicerFrErrrr
³scCstj|dS)N)rE)r'rH)rErrrÚget_versioned_notifier»srIcCstƒ}tjt||dS)N)Úurlr )rrr"r>)rJr(rrrÚcreate_transportÀsrKc@s:eZdZdZdZdgZedƒZdd„Zdd„Z	d	d
„Z
dS)rGzDWraps an oslo.messaging Notifier and checks for allowed event_types.Fzaggregate.addhost.endze%(event_type)s is not a versioned notification and not whitelisted. See ./doc/source/notification.rstcCs.||_x"dD]}t||tj|j|ƒƒqWdS)NÚdebugÚinfoÚwarnÚerrorÚcritical)rLrMrNrOrP)ÚnotifierÚsetattrÚ	functoolsÚpartialÚ_notify)r5rQÚpriorityrrrr7Ûs
z!LegacyValidatingNotifier.__init__cCsddht|jƒƒkS)NrAr+)ÚsetÚkeys)r5ÚpayloadrrrÚ_is_wrap_exception_notificationász8LegacyValidatingNotifier._is_wrap_exception_notificationcCsZ||jkrB|j|ƒrB|jr0t|jd|iƒ‚ntj|jd|iƒt|j|ƒ|||ƒdS)NÚ
event_type)	Ú'allowed_legacy_notification_event_typesrZÚfatalÚAssertionErrorÚmessageÚLOGZwarningÚgetattrrQ)r5rVZctxtr[rYrrrrUês
z LegacyValidatingNotifier._notifyN)r0r1r2Ú__doc__r]r\rr_r7rZrUrrrrrGÇs	rGc@s eZdZdd„Zedd„ƒZdS)Ú
ClientWrappercCs||_tjƒ|_dS)N)Ú_clientrÚutcnowÚlast_access_time)r5Úclientrrrr7öszClientWrapper.__init__cCstjƒ|_|jS)N)rrerfrd)r5rrrrgús
zClientWrapper.clientN)r0r1r2r7Úpropertyrgrrrrrcõsrccs8eZdZdZ‡fdd„Zd	dd„Zejdd„ƒZ‡ZS)
ÚClientRouterzËCreates and caches RPC clients that route to cells or the default.

    The default client connects to the API cell message queue. The rest of the
    clients connect to compute cell message queues.
    csZtt|ƒjtƒi|_t|ƒ|jd<|j|_|j|_t|ddƒ|_	|j
tjj
ddƒdS)Nrr!F)Z	overwrite)Úsuperrir7r>ÚclientsrcrCr@rar!Zrun_periodic_tasksr:r-r;)r5Zdefault_client)Ú	__class__rrr7szClientRouter.__init__NcCsj|r|j}nd}y|j|j}WnDtk
rdt|jƒ}tj||j|j	|j
d}t|ƒ|j|<YnX|S)Nr)r@r!)ZuuidrkrgÚKeyErrorrKZ
transport_urlrrBrCr@r!rc)r5r-Zcell_mappingÚ	client_idrgZ	transportrrrrds


zClientRouter._clientcsPd‰‡fdd„}t|jjƒƒ}x,|D]$\}}|dkr$|||jƒr$|j|=q$WdS)Né<cs"tj|ˆƒrtjd||ƒdSdS)Nz;Removing stale RPC client: %s as it was last accessed at %sTF)rZ
is_older_thanr`rL)rnrf)ÚtimeoutrrÚstale&s
z1ClientRouter._remove_stale_clients.<locals>.staler)ÚlistrkÚitemsrf)r5r-rqZ
items_copyrnZclient_wrapperr)rprÚ_remove_stale_clients"sz"ClientRouter._remove_stale_clients)N)	r0r1r2rbr7rdrrtÚ
__classcell__rr)rlrris
ricstjˆƒ‡fdd„ƒ}|S)zCCalls decorated method only if versioned notifications are enabled.cs&tjƒrtjjdkrˆ||ŽSdSdS)Nrr)rr)r'Z
is_enabledr>Z
notificationsr)r+Úkwargs)ÚfrrÚwrapped7s

z)if_notifications_enabled.<locals>.wrapped)rSÚwraps)rwrxr)rwrÚif_notifications_enabled5srz)N)NN)N)NN)8Ú__all__rSZoslo_logr
ZloggingZoslo_messagingrZoslo_serializationrZoslo_servicerZ
oslo_utilsrZcontego.confr:Zcontego.exceptionZcontego.i18nrrr>Z	getLoggerr0r`r#r&r$r'rAr,r)rrZoslo_configrrrrrrrZNoOpSerializerr%Z
Serializerrr?rr	r
rIrKÚobjectrGrcZ
PeriodicTasksrirzrrrrÚ<module>sd






.5