-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/transactions.pyc

ó
î:ïNc@@sdZddlmZddlZddljZddlmZmZddl	m
Z
defd„ƒYZdefd	„ƒYZ
d
efd„ƒYZdS(sªThis module provides a transactional facility.

Transactions provide hooks to allow data objects (i.e. inventory weaves or
the revision-history file) to be placed in a registry and retrieved later
during the same transaction. Transactions in bzr are not atomic - they
depend on data ordering of writes, so we do not have commit or rollback
facilities at the transaction level.

Read only transactions raise an assert when objects are listed as dirty
against them - preventing unintended writes.

Write transactions preserve dirty objects in the cache, though due to the
write ordering approach we use for consistency 'dirty' is a misleading term.
A dirty object is one we have modified.

Both read and write transactions *may* flush unchanged objects out of
memory, unless they are marked as 'precious' which indicates that
repeated reads cannot be obtained if the object is ejected, or that
the object is an expensive one for obtaining.
i(tabsolute_importN(tIdentityMaptNullIdentityMap(tmuttertReadOnlyTransactioncB@sYeZdZd„Zd„Zd„Zed„Zd„Zd„Z	d„Z
d„ZRS(	s*A read only unit of work for data objects.cC@sdS(sClean up this transaction.N((tself((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pytfinish3scC@sMtt|ƒjƒtƒ|_tƒ|_g|_d|_tƒ|_	dS(Niÿÿÿÿ(
tsuperRt__init__Rtmaptsett_clean_objectst_clean_queuet_limitt_precious_objects(R((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR6s		cC@s
||jkS(s"Return True if an_object is clean.(R(Rt	an_object((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pytis_clean>scC@sG|jj|ƒ|jj|ƒ|r9|jj|ƒn|jƒdS(sœRegister an_object as being clean.

        If the precious hint is True, the object will not
        be ejected from the object identity map ever.
        N(RtaddRtappendRt_trim(RRtprecious((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pytregister_cleanBs
cC@stj|ƒ‚dS(s"Register an_object as being dirty.N(terrorstReadOnlyObjectDirtiedError(RR((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pytregister_dirtyNscC@s2|dkrt|ƒ‚n||_|jƒdS(sSet a new cache size.iÿÿÿÿN(t
ValueErrorR
R(Rtsize((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pytset_cache_sizeRs	cC@sþ|jdks+|jt|jƒdkr/dSt|jƒ|j}d}x¬|rù|t|jƒkrùtj|j|ƒdkrì|j||jkrì|j|}|jj|ƒ|j|=|jj	|ƒt
d|ƒ|d8}qN|d7}qNWdS(sTrim the cache back if needed.iNisremoved object %ri(R
tlenRtsystgetrefcountRRtremoveR	t
remove_objectR(Rtneededtoffsettremoved((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyRYs+	



cC@sdS(s+Read only transactions do not allow writes.N((R((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyt	writeabless(t__name__t
__module__t__doc__RRRtFalseRRRRR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR0s						tWriteTransactioncB@s;eZdZd„Zd„Zd„Zd„Zd„ZRS(s‰A write transaction

    - caches domain objects
    - clean objects can be removed from the cache
    - dirty objects are retained.
    cC@s@x9|jD].}t|ddƒ}|dk	r
|ƒq
q
WdS(sClean up this transaction.ttransaction_finishedN(t_dirty_objectstgetattrtNone(Rtthingtcallback((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyRscC@s#tt|ƒjƒtƒ|_dS(N(RR)RR
R+(R((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR†scC@s
||jkS(s"Return True if an_object is dirty.(R+(RR((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pytis_dirtyŠscC@sV|jj|ƒ|j|ƒrH|jj|ƒ|j|jj|ƒ=n|jƒdS(sÇRegister an_object as being dirty.

        Dirty objects are not ejected from the identity map
        until the transaction finishes and get informed
        when the transaction finishes.
        N(R+RRRRRtindexR(RR((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyRŽs
cC@stS(s Write transactions allow writes.(tTrue(R((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR$›s(R%R&R'RRR0RR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR)ws				
tPassThroughTransactioncB@sGeZdZd„Zd„Zed„Zd„Zd„Zd„Z	RS(shA pass through transaction

    - nothing is cached.
    - nothing ever gets into the identity map.
    cC@s@x9|jD].}t|ddƒ}|dk	r
|ƒq
q
WdS(sClean up this transaction.R*N(R+R,R-(RR.R/((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR§scC@s/tt|ƒjƒtƒ|_tƒ|_dS(N(RR3RRR	R
R+(R((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR®scC@sdS(s†Register an_object as being clean.

        Note that precious is only a hint, and PassThroughTransaction
        ignores it.
        N((RRR((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR³scC@s|jj|ƒdS(svRegister an_object as being dirty.

        Dirty objects get informed
        when the transaction finishes.
        N(R+R(RR((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyRºscC@sdS(s#Do nothing, we are passing through.N((Rtignored((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyRÂscC@stS(s'Pass through transactions allow writes.(R2(R((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR$Ås(
R%R&R'RRR(RRRR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyR3 s				(R't
__future__RRt
bzrlib.errorsRtbzrlib.identitymapRRtbzrlib.traceRtobjectRR)R3(((s7/usr/lib/python2.7/dist-packages/bzrlib/transactions.pyt<module>%sG)

Copyright © 2017 || Recoded By Mr.Bumblebee