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    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / oslo_db / sqlalchemy / enginefacade.pyc
Size: Mime:
ó
x“EYc@sÖddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlm
Z
defd„ƒYZed	ƒZed
ƒZedƒZdefd
„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdejfd„ƒYZdefd„ƒYZed„Zd„Zd„Zd„ZedeƒZ d„Z!d„Z"d„Z#e j$Z$e j%Z%d efd!„ƒYZ&dS("iÿÿÿÿN(tcfg(t	exception(toptions(tengines(tormt_symbolcBs&eZdZdZd„Zd„ZRS(srepresent a fixed symbol.tnamecCs
||_dS(N(R(tselfR((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt__init__"scCsd|jS(Ns
symbol(%r)(R(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt__repr__%s(sname(t__name__t
__module__t__doc__t	__slots__RR	(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRs	tASYNC_READERtREADERtWRITERt_DefaultcBsheZdZdZedƒZed„Zed„ƒZed„ƒZ	ed„ƒZ
ed„ƒZRS(	sMark a value as a default value.

    A value in the local configuration dictionary wrapped with
    _Default() will not take precedence over a value that is specified
    in cfg.CONF.   Values that are set after the fact using configure()
    will supersede those in cfg.CONF.

    tvaluetNOTSETcCs
||_dS(N(R(RR((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRRscCs:t|tƒr2|j}||jkr+dS|Sn|SdS(N(t
isinstanceRRt_notsettNone(tclsRtv((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytresolveUs	cCsFt|tƒr>t|||jƒ}||jkr7dS|Sn|SdS(N(RRtgetattrRRR(RRtconf_namespacetkeyR((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytresolve_w_conf`scCs t|tƒp|j|jk	S(N(RRRR(RR((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytis_setkscCs/t|tƒp.|j|jk	p.t||ƒS(N(RRRRthasattr(RRRR((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt
is_set_w_confps(svalue(R
RRR
RRRtclassmethodRRRR (((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRDst_TransactionFactorycBs¡eZdZd„Zd„Zd„Zd„Zd„Zd„Zdd„Z
d„Zd	„Zd
„Z
d„Zd„Zd
„Zeddd„Zd„ZRS(s6A factory for :class:`._TransactionContext` objects.

    By default, there is just one of these, set up
    based on CONF, however instance-level :class:`._TransactionFactory`
    objects can be made, as is the case with the
    :class:`._TestTransactionFactory` subclass used by the oslo.db test suite.

    c
Cszitƒd6tƒd6|_ittƒd6tdƒd6tdƒd6tdƒd	6tƒd
6tƒd6tƒd6ttƒd
6ttƒd6tdƒd6tdƒd6ttƒd6tdƒd6tdƒd6tdƒd6|_ittƒd6td6|_itd6|_itd6gd6|_t	d„ddddd d!d"d#gDƒƒ|_
t|_d|_t
jƒ|_dS($Nt
connectiontslave_connectiont	sqlite_fktTRADITIONALtmysql_sql_modeitidle_timeoutitconnection_debugt
max_pool_sizetmax_overflowtpool_timeouttsqlite_synchronoustconnection_tracei
tmax_retriestretry_intervaltthread_checkintjson_serializertjson_deserializertlogging_nametexpire_on_committ__autocommittrollback_reader_sessionstsynchronous_readerton_engine_createcss!|]}|tdƒfVqdS(N(RR(t.0tk((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pys	<genexpr>¦stdb_max_retriestdb_inc_retry_intervaltuse_db_reconnecttdb_retry_intervalt
min_pool_sizetdb_max_retry_intervalt	sqlite_dbtbackend(Rt_url_cfgtFalsetTrueRt_engine_cfgt
_maker_cfgt_transaction_ctx_cfgt_facade_cfgtdictt_ignored_cfgt_startedt_legacy_facadet	threadingtLockt_start_lock(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR€sJ


















		cKs|jt|ƒdS(szApply default configurational options.

        This method can only be called before any specific
        transaction-beginning methods have been called.

        Configurational options are within a fixed set of keys, and fall
        under three categories: URL configuration, engine configuration,
        and session configuration.  Each key given will be tested against
        these three configuration sets to see which one is applicable; if
        it is not applicable to any set, an exception is raised.

        The configurational options given here act as **defaults**
        when the :class:`._TransactionFactory` is configured using
        a :class:`oslo_config.cfg.ConfigOpts` object; the options
        present within the :class:`oslo_config.cfg.ConfigOpts` **take
        precedence** versus the arguments passed here.  By default,
        the :class:`._TransactionFactory` loads in the configuration from
        :data:`oslo_config.cfg.CONF`, after applying the
        :data:`oslo_db.options.database_opts` configurational defaults to it.

        .. seealso::

            :meth:`._TransactionFactory.configure`

        N(t
_configureRF(Rtkw((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytconfigure_defaults±scKs|jt|ƒdS(sçApply configurational options.

        This method can only be called before any specific
        transaction-beginning methods have been called.

        Behavior here is the same as that of
        :meth:`._TransactionFactory.configure_defaults`,
        with the exception that values specified here will **supersede** those
        setup in the :class:`oslo_config.cfg.ConfigOpts` options.

        .. seealso::

            :meth:`._TransactionFactory.configure_defaults`

        N(RRRE(RRS((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt	configureÍscCsÓ|jrtdƒ‚ng}xˆ|jƒD]z\}}xk|j|j|j|j|j|jfD]2}||krb|r†t	|ƒn|||<PqbqbW|j
|ƒq+W|rÏtjdt
|ƒtjƒndS(Ns*this TransactionFactory is already starteds(Configuration option(s) %r not supported(RMt	TypeErrortitemsRDRGRHRLRJRIRtappendtwarningstwarntsortedRtNotSupportedWarning(Rtas_defaultsRSt
not_supportedR;Rtdict_((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRRßs"	
cCs>|js7tdd|ƒ|_|js7|jƒq7n|jS(sTReturn a :class:`.LegacyEngineFacade` for this factory.

        This facade will make use of the same engine and sessionmaker
        as this factory, however will not share the same transaction context;
        the legacy facade continues to work the old way of returning
        a new Session each time get_session() is called.

        t_factoryN(RNtLegacyEngineFacadeRRMt_start(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytget_legacy_facadeùs
			cCsb|js|jƒn|tkr/|jjƒS|jsD|tkrQ|jjƒS|jjƒSdS(N(RMRbt_WRITERt_writer_enginetconnectR8t
_ASYNC_READERt_reader_engine(Rtmode((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_create_connection	s	


cCs{|js|jƒni}|r/||d<n|tkrH|j|S|js]|tkrj|j|S|j|SdS(Ntbind(RMRbRdt
_writer_makerR8Rgt
_reader_maker(RRiRkRS((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_create_sessions	



cCsltƒ}|jj|jƒ|jj|jƒ|jj|jƒ|jj|jƒ|jj|jƒ|S(N(R"RDtupdateRGRHRIRJ(Rtfactory((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_create_factory_copy"s	csJˆdkr&td„|jƒDƒƒSt‡fd†|jƒDƒƒSdS(Ncss9|]/\}}tj|ƒr|tj|ƒfVqdS(N(RRR(R:RR((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pys	<genexpr>.s	c3sK|]A\}}tj|ˆj|ƒr|tj|ˆj|ƒfVqdS(N(RR tdatabaseR(R:RR(tconf(sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pys	<genexpr>4s	(RRKRW(Rtdefault_cfgRs((RssT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_args_for_conf+scCs|j|j|ƒS(N(RuRD(RRs((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_url_args_for_conf9scCs|j|j|ƒS(N(RuRG(RRs((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_engine_args_for_conf<scCs,|j|j|ƒ}|jdƒ|d<|S(NR6t
autocommit(RuRHtpop(RRst
maker_args((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_maker_args_for_conf?scCsV|jG|jsdS|jjjƒ|j|jk	rL|jjjƒnWdQXdS(s8Call engine.pool.dispose() on underlying Engine objects.N(RQRMRetpooltdisposeRh(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytdispose_poolDs
	cCs<|j-|jrdS|tkr/tj}n|dk	rQ|jtjdƒn|j	|ƒ}|rs||d<n|r†||d<n|j
|ƒ}|j|ƒ}|j|d||ƒ\|_
|_|jdƒr|j|d||ƒ\|_|_n|j
|j|_|_|jd|_t|_WdQXdS(NRrR#R$R8(RQRMRERtCONFRt
register_optsRt
database_optsRvRwR{t_setup_for_connectionReRltgetRhRmRJR8RF(RRsR#R$turl_argstengine_argsRz((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRbNs0
	

cCst|dkrtjdƒ‚ntjd||}x|jdD]}||ƒqAWtjd||}||fS(Ns*No sql_connection parameter is establishedtsql_connectionR9tengine(RRtCantStartEngineErrorRt
create_engineRJRt	get_maker(RR†t
engine_kwargstmaker_kwargsR‡thooktsessionmaker((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR‚}s	N(R
RRRRTRURRRcRjRRnRqRuRvRwR{R~RERbR‚(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR"ws 	1					
							
/t_TestTransactionFactorycBs eZdZd„Zd„ZRS(sUA :class:`._TransactionFactory` used by test suites.

    This is a :class:`._TransactionFactory` that can be directly injected
    with an existing engine and sessionmaker.

    Note that while this is used by oslo.db's own tests of
    the enginefacade system, it is also exported for use by
    the test suites of other projects, first as an element of the
    oslo_db.sqlalchemy.test_base module, and secondly may be used by
    external test suites directly.

    Includes a feature to inject itself temporarily as the factory
    within the global :class:`._TransactionContextManager`.

    cCs{||_|_||_|_t|_d|_||_t	j
j|_t	j
j|_|rwt	j
|_
|t	_ndS(N(RhReRmRlRFRMRRNR8t_context_managerR`RJRItexisting_factoryt
_root_factory(RR‡tmakertapply_globalR8((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRšs			cCs|jt_dS(N(R‘RR’(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytdispose_global¨s(R
RRRR•(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRŠs	t_TransactionContextcBsƒeZdZd
ed„Zejed„ƒZejed„ƒZ	d„Z
d„Zed„Zd„Z
ed„Zd	„ZRS(s4Represent a single database transaction in progress.cCsS||_||_d|_d|_d|_d|_|jj}|d|_dS(söConstruct a new :class:`.TransactionContext`.

        :param factory: the :class:`.TransactionFactory` which will
         serve as a source of connectivity.

        :param global_factory: the "global" factory which will be used
         by the global ``_context_manager`` for new ``_TransactionContext``
         objects created under this one.  When left as None the actual
         "global" factory is used.

        :param rollback_reader_sessions: if True, a :class:`.Session` object
         will have its :meth:`.Session.rollback` method invoked at the end
         of a ``@reader`` block, actively rolling back the transaction and
         expiring the objects within, before the :class:`.Session` moves
         on to be closed, which has the effect of releasing connection
         resources back to the connection pool and detaching all objects.
         If False, the :class:`.Session` is
         not affected at the end of a ``@reader`` block; the underlying
         connection referred to by this :class:`.Session` will still
         be released in the enclosing context via the :meth:`.Session.close`
         method, which still ensures that the DBAPI connection is rolled
         back, however the objects associated with the :class:`.Session`
         retain their database-persisted contents after they are detached.

         .. seealso::

            http://docs.sqlalchemy.org/en/rel_0_9/glossary.html#term-released            SQLAlchemy documentation on what "releasing resources" means.

        R7N(	Rptglobal_factoryRRitsessionR#ttransactionRIR7(RRpR—R7RS((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR¯s!						ccs4|jdkrzâ|jdk	re|jjƒ|_|rZ|jjƒ
|jVWdQXqð|jVn‹|jjd|jƒ|_|jjƒ|_zDy|jV|j	|jƒWn!t
k
rÔ|jjƒ‚nXWdd|_|jjƒXWdd|_Xn/|r(|jjƒ
|jVWdQXn|jVdS(NRi(
R#RR˜tbegin_nestedRpRjRitbeginR™t_end_connection_transactiont	Exceptiontrollbacktclose(Rt	savepoint((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_connectionÙs2

	
ccsÔ|jdkr¡|jjd|jd|jƒ|_zQy)|jjƒ|jV|j|jƒWn!tk
r‚|jj	ƒ‚nXWd|jj
ƒd|_Xn/|rÈ|jjƒ
|jVWdQXn|jVdS(NRkRi(R˜RRpRnR#RiR›t_end_session_transactionRRžRŸRš(RR ((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_sessions"




cCs6|jtkr|jƒn|jr2|jƒndS(N(RiRdtcommitR7Rž(RR˜((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR¢s
	cCs*|jtkr|jƒn
|jƒdS(N(RiRdR¤Rž(RR™((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRœ(s
cCsc|tkr|jƒn&|tkr2|jƒn
|j|ƒ|rR|j|ƒS|j|ƒSdS(N(Rdt_writerRgt
_async_readert_readerR¡R£(RRiR#R tallow_async((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_produce_block.s



cCs[|jdkrt|_n<|jtkr9tdƒ‚n|jtkrWtdƒ‚ndS(Ns>Can't upgrade a READER transaction to a WRITER mid-transactionsECan't upgrade an ASYNC_READER transaction to a WRITER mid-transaction(RiRRdt_READERRVRg(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR¥:scCsD|jdkrt|_n%|jtkr@|r@tdƒ‚ndS(NsECan't upgrade an ASYNC_READER transaction to a READER mid-transaction(RiRRªRgRV(RR¨((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR§Fs
cCs|jdkrt|_ndS(N(RiRRg(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR¦NsN(R
RRRRERt
contextlibtcontextmanagerR¡R£R¢RœR©R¥R§R¦(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR–¬s((			t_TransactionContextTLocalcBseZd„Zd„ZRS(cCs|S(N((Rtmemo((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt__deepcopy__TscCs
tdfS(N((R­(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt
__reduce__Ws(R
RR¯R°(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR­Ss	t_TransactionContextManagerc	Bs"eZdZddeeedeed„Zed„ƒZd„Zd„Z	d„Z
d„Zd„Zd„Z
d	„Zed
„ƒZed„ƒZed„ƒZed
„ƒZed„ƒZed„ƒZed„ƒZed„ƒZd„Zd„Zd„Zejd„ƒZRS(sòProvide context-management and decorator patterns for transactions.

    This object integrates user-defined "context" objects with the
    :class:`._TransactionContext` class, on behalf of a
    contained :class:`._TransactionFactory`.

    c		Cs‘|dkr$||_tƒ|_n	||_||_||_||_||_||_|jr{|jr{t	dƒ‚n||_
||_dS(Ns1setting savepoint and independent makes no sense.(Rt_rootR"R’t_replace_global_factoryt_is_global_managert_modet_independentt
_savepointRVR¡t_allow_async(	RtrootRitindependentR R#treplace_global_factoryR´R¨((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRds
								cCs
|jjS(s?The :class:`._TransactionFactory` associated with this context.(R²R’(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR`scKs|jj|dS(s¬Apply configurational options to the factory.

        This method can only be called before any specific
        transaction-beginning methods have been called.


        N(R`RU(RRS((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRU„scCs|jjdj|ƒdS(s=Append a listener function to _facade_cfg["on_engine_create"]R9N(R`RJRX(Rtfn((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytappend_on_engine_createŽscCs
|jjƒS(s`Return a :class:`.LegacyEngineFacade` for factory from this context.

        This facade will make use of the same engine and sessionmaker
        as this factory, however will not share the same transaction context;
        the legacy facade continues to work the old way of returning
        a new Session each time get_session() is called.
        (R`Rc(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRc’s	cCs|jjƒdS(s8Call engine.pool.dispose() on underlying Engine objects.N(R`R~(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR~scCs>|jƒ}||_|jjƒ|_|jjs:t‚|S(siCreate a new, independent _TransactionContextManager from this one.

        Copies the underlying _TransactionFactory to a new one, so that
        it can be further configured with new options.

        Used for test environments where the application-wide
        _TransactionContextManager may be used as a factory for test-local
        managers.

        (t_cloneR²R’RqR`RMtAssertionError(Rtnew((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytmake_new_manager¡s
	cs|t|tƒr|j}n$t|tƒr3|}ntdƒ‚ˆjˆksTt‚ˆj‰|ˆ_‡‡fd†}|S(s¾Patch a _TransactionFactory into this manager.

        Replaces this manager's factory with the given one, and returns
        a callable that will reset the factory back to what we
        started with.

        Only works for root factories.  Is intended for test suites
        that need to patch in alternate database configurations.

        The given argument may be a _TransactionContextManager or a
        _TransactionFactory.

        s;_TransactionContextManager or _TransactionFactory expected.cs
ˆˆ_dS(N(R’((R‘R(sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytresetÍs(RR±R`R"t
ValueErrorR²R¿R’(Rtfactory_or_managerRpRÂ((R‘RsT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt
patch_factory²s				cCsh|j}|j}|jtjƒ}tjd||}t||dtd|j	dƒ}|j
|ƒS(sƒPatch an Engine into this manager.

        Replaces this manager's factory with a _TestTransactionFactory
        that will use the given Engine, and returns
        a callable that will reset the factory back to what we
        started with.

        Only works for root factories.  Is intended for test suites
        that need to patch in alternate database configurations.

        R‡R”R8(R`RlR{RRRRŠRRERJRÅ(RR‡R‘R“RŒRp((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytpatch_engineÒs
			
cCs|jd|jƒS(sAModifier to replace the global transaction factory with this one.R»(R¾R`(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytreplaceìscCs|jdtƒS(s*Modifier to set the transaction to WRITER.Ri(R¾Rd(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytwriterñscCs|jdtƒS(s*Modifier to set the transaction to READER.Ri(R¾Rª(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytreaderöscCs.|jtkrtdƒ‚n|jdtƒS(sÜModifier to allow async operations

        Allows async operations if asynchronous session is already
        started in this context. Marking DB API methods with READER would make
        it impossible to use them in ASYNC_READER transactions, and marking
        them with ASYNC_READER would require a modification of all the places
        these DB API methods are called to force READER mode, where the latest
        DB state is required.

        In Nova DB API methods should have a 'safe' default (i.e. READER),
        so that they can start sessions on their own, but it would also be
        useful for them to be able to participate in an existing ASYNC_READER
        session, if one was started up the stack.
        s(Setting async on a WRITER makes no senseR¨(RµRdRVR¾RF(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR¨ûscCs|jdtƒS(s?Modifier to start a transaction independent from any enclosing.Rº(R¾RF(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRºscCs|jdtƒS(s>Modifier to start a SAVEPOINT if a transaction already exists.R (R¾RF(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR scCs|jdtƒS(s?Modifier to return a core Connection object instead of Session.R#(R¾RF(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR#scCs.|jtkrtdƒ‚n|jdtƒS(s3Modifier to set a READER operation to ASYNC_READER.s(Setting async on a WRITER makes no senseRi(RµRdRVR¾Rg(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytasyncscCs
|j|ƒS(s@Provide a context manager block that will use the given context.(t_transaction_scope(Rtcontext((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytusing'scsltjˆƒ}|jddks5|jddkr>d‰nd‰tjˆƒ‡‡‡fd†ƒ}|S(sDecorate a function.iRRics1|ˆ}ˆj|ƒˆ||ŽSWdQXdS(N(RË(targstkwargsRÌ(t
context_indexR¼R(sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytwrapper3s
(tinspectt
getargspecRÎt	functoolstwraps(RR¼targspecRÑ((RÐR¼RsT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt__call__+s&	$cKsDi|jd6|jd6|jd6}|j|ƒtd|j|S(NRºRiR#R¹(R¶RµR¡RoR±R²(RRSt
default_kw((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR¾<s



c	cso|j}t|ƒ}t|ddƒ}}|j}d}|jrS|j}}n6|dk	r‰|jr‰|j}|jjr‰|}q‰n|dk	r³|sª|j	|k	r³d}n|dkrát
|d||j}|_nzY|j
dk	r4|jd|j
d|jd|jd|jƒ}|VWdQXndVWd|dkrR|`n||k	rj||_nXdS(NtcurrentR—RiR#R R¨(R¶t_transaction_contexts_by_threadRRR`R³R—R²R´RpR–RIRÙRµR©R¡R·R¸(	RRÌtnew_transactionttransaction_contexts_by_threadRÙtrestoretuse_factoryR—tresource((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRËEs@												N(R
RRRRERtpropertyR`RUR½RcR~RÁRÅRÆRÇRÈRÉR¨RºR R#RÊRÍR×R¾R«R¬RË(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR±[s:	
					 					cs+tjˆƒ‰‡‡fd†}t|ƒS(Ncssy
|j}Wn-tjk
r<tjd|ˆfƒ‚n3Xˆ|ƒ}|dkrktjdˆƒ‚n|SdS(NssNo TransactionContext is established for this %s object within the current thread; the %r attribute is unavailable.sZThe '%s' context attribute was requested but it has not been established for this context.(ttransaction_ctxRtNoEngineContextEstablishedRtContextNotRequestedError(RÌttransaction_contexttresult(tattrtgetter(sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_property_for_contextxs

(toperatort
attrgetterRà(RæRè((RæRçsT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_context_descriptoruscCsBt|ƒ}y|jSWn$tk
r=tjd|ƒ‚nXdS(NsSNo TransactionContext is established for this %s object within the current thread. (RÚRÙtAttributeErrorRRâ(RÌt	by_thread((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_transaction_ctx_for_contexts
cCs5t|ddƒ}|dkr1tƒ}|_n|S(Nt_enginefacade_context(RRR­Rï(RÌRÜ((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRڙs
cCsAt|dttƒƒx$dD]}t||t|ƒƒqW|S(s@Decorate a class with ``session`` and ``connection`` attributes.RáR˜R#R™(ssessions
connectionstransaction(tsetattrRàRîRë(tklassRæ((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyttransaction_context_provider£s

R´cCstƒS(s,Construct a local transaction context.

    (R±(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRä¶scKstjj|dS(sèApply configurational options to the global factory.

    This method can only be called before any specific transaction-beginning
    methods have been called.

    .. seealso::

        :meth:`._TransactionFactory.configure`

    N(RR`RU(RS((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRU½scCs
tjƒS(sFReturn a :class:`.LegacyEngineFacade` for the global factory.

    This facade will make use of the same engine and sessionmaker
    as this factory, however will not share the same transaction context;
    the legacy facade continues to work the old way of returning
    a new Session each time get_session() is called.

    (RRc(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRcËs	RacBsneZdZdeeeddd„Zd„Zed„Zed„Z	ed„Z
eeeed„ƒZRS(s½A helper class for removing of global engine instances from oslo.db.

    .. deprecated:: 1.12.0
        Please use :mod:`oslo_db.sqlalchemy.enginefacade` for new development.

    As a library, oslo.db can't decide where to store/when to create engine
    and sessionmaker instances, so this must be left for a target application.

    On the other hand, in order to simplify the adoption of oslo.db changes,
    we'll provide a helper class, which creates engine and sessionmaker
    on its instantiation and provides get_engine()/get_session() methods
    that are compatible with corresponding utility functions that currently
    exist in target projects, e.g. in Nova.

    engine/sessionmaker instances will still be global (and they are meant to
    be global), but they will be stored in the app context, rather that in the
    oslo.db context.

    Two important things to remember:

    1. An Engine instance is effectively a pool of DB connections, so it's
       meant to be shared (and it's thread-safe).
    2. A Session instance is not meant to be shared and represents a DB
       transactional context (i.e. it's not thread-safe). sessionmaker is
       a factory of sessions.

    :param sql_connection: the connection string for the database to use
    :type sql_connection: string

    :param slave_connection: the connection string for the 'slave' database
                             to use. If not provided, the master database
                             will be used for all operations. Note: this
                             is meant to be used for offloading of read
                             operations to asynchronously replicated slaves
                             to reduce the load on the master database.
    :type slave_connection: string

    :param sqlite_fk: enable foreign keys in SQLite
    :type sqlite_fk: bool

    :param autocommit: use autocommit mode for created Session instances
    :type autocommit: bool

    :param expire_on_commit: expire session objects on commit
    :type expire_on_commit: bool

    Keyword arguments:

    :keyword mysql_sql_mode: the SQL mode to be used for MySQL sessions.
                             (defaults to TRADITIONAL)
    :keyword idle_timeout: timeout before idle sql connections are reaped
                           (defaults to 3600)
    :keyword connection_debug: verbosity of SQL debugging information.
                               -1=Off, 0=None, 100=Everything (defaults
                               to 0)
    :keyword max_pool_size: maximum number of SQL connections to keep open
                            in a pool (defaults to SQLAlchemy settings)
    :keyword max_overflow: if set, use this value for max_overflow with
                           sqlalchemy (defaults to SQLAlchemy settings)
    :keyword pool_timeout: if set, use this value for pool_timeout with
                           sqlalchemy (defaults to SQLAlchemy settings)
    :keyword sqlite_synchronous: if True, SQLite uses synchronous mode
                                 (defaults to True)
    :keyword connection_trace: add python stack traces to SQL as comment
                               strings (defaults to False)
    :keyword max_retries: maximum db connection retries during startup.
                          (setting -1 implies an infinite retry count)
                          (defaults to 10)
    :keyword retry_interval: interval between retries of opening a sql
                             connection (defaults to 10)
    :keyword thread_checkin: boolean that indicates that between each
                             engine checkin event a sleep(0) will occur to
                             allow other greenthreads to run (defaults to
                             True)

    c	Ksytjdtjddƒ|r+||_nJtƒ|_|jjd|d|d|||jj|d|d|ƒdS(	NsFEngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacadet
stackleveliR%R6R5R#R$(RYRZRtOsloDBDeprecationWarningR`R"RURb(	RR†R$R%RxR5t_confR`RÏ((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyR,s		cCs |jjs|jjƒndS(N(R`RMRb(R((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt_check_factory_startedFscCs(|jƒ|r|jjS|jjSdS(slGet the engine instance (note, that it's shared).

        :param use_slave: if possible, use 'slave' database for this engine.
                          If the connection string for the slave database
                          wasn't provided, 'master' engine will be returned.
                          (defaults to False)
        :type use_slave: bool

        N(RöR`RhRe(Rt	use_slave((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt
get_engineJs


cKs4|jƒ|r |jj|S|jj|SdS(smGet a Session instance.

        :param use_slave: if possible, use 'slave' database connection for
                          this session. If the connection string for the
                          slave database wasn't provided, a session bound
                          to the 'master' engine will be returned.
                          (defaults to False)
        :type use_slave: bool

        Keyword arguments will be passed to a sessionmaker instance as is (if
        passed, they will override the ones used when the sessionmaker instance
        was created). See SQLAlchemy Session docs for details.

        N(RöR`RmRl(RR÷RÏ((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytget_sessionZs
cCs(|jƒ|r|jjS|jjSdS(sÛGet the sessionmaker instance used to create a Session.

        This can be called for those cases where the sessionmaker() is to
        be temporarily injected with some state such as a specific connection.

        N(RöR`RmRl(RR÷((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytget_sessionmakeros

c
Cs"|dd|d|d|d|ƒS(sÙInitialize EngineFacade using oslo.config config instance options.

        :param conf: oslo.config config instance
        :type conf: oslo_config.cfg.ConfigOpts

        :param sqlite_fk: enable foreign keys in SQLite
        :type sqlite_fk: bool

        :param autocommit: use autocommit mode for created Session instances
        :type autocommit: bool

        :param expire_on_commit: expire session objects on commit
        :type expire_on_commit: bool

        R%RxR5RõN(R(RRsR%RxR5((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pytfrom_config|s
N(
R
RRRRERFRRöRøRùRúR!Rû(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyRaßsL	
('R«RÔRÒRéRORYtoslo_configRtoslo_dbRRtoslo_db.sqlalchemyRRtobjectRRgRªRdRR"RR–tlocalR­R±RRëRîRÚRòRFRRäRURcRÉRÈRa(((sT/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.pyt<module>sB
	3ÿ"§ÿ