
    -iV                     *    d dl mZ d Zd Zd Zd ZdS )    )NONEc                     t                      }t          | ||          }||ur&||k    rt          d          t          | ||           d S )Nz+Shouldn't happen, new and orig are the same)r   getattr	Exceptionsetattr)objnamenewnorigs        P/var/www/html/speakWrite/venv/lib/python3.11/site-packages/codernitydb3/patch.py__patchr      sT    A3a  D1}}3;;IJJJT3
F    c                     ddl m} ddl m} |                    |           }|                    |           }t          |d|           t          |d|           dS )z
    Patnches cache mechanizm to be thread safe (gevent ones also)

    .. note::

       It's internal codernitydb3 mechanizm, it will be called when needed

    r   )	lfu_cache)lfu_cache_with_lock	cache1lvl	cache2lvlN)codernitydb3r   r   create_cache1lvlcreate_cache2lvlr   )lock_objr   r   lfu_lock1lvllfu_lock2lvls        r   patch_cache_lfur       sx     '&&&&&000000&77AAL&77AALI{L111I{L11111r   c                     ddl m} ddl m} |                    |           }|                    |           }t          |d|           t          |d|           dS )z
    Patches cache mechanizm to be thread safe (gevent ones also)

    .. note::

       It's internal codernitydb3 mechanizm, it will be called when needed

    r   )rr_cache)rr_cache_with_lockr   r   N)r   r   r   r   r   r   )r   r   r   rr_lock1lvlrr_lock2lvls        r   patch_cache_rrr!   1   sx     &%%%%%//////$55h??K$55h??KHk;///Hk;/////r   c                     d }| j         D ]2}t          |d|j                   t          |d ||                     3t          | d| j                   t          | d ||                      dS )a  
    Will always execute index.fsync after index.flush.

    .. note::

       It's for advanced users, use when you understand difference between `flush` and `fsync`, and when you definitely need that.

    It's important to call it **AFTER** database has all indexes etc (after db.create or db.open)

    Example usage::

        ...
        db = Database('/tmp/patch_demo')
        db.create()
        patch_flush_fsync(db)
        ...

    c                       fd}|S )Nc                  X                                                                         d S )N)
orig_flushfsync)ind_objs   r   _innerz7patch_flush_fsync.<locals>.always_fsync.<locals>._innerV   s&       MMOOOOOr    )r'   r(   s   ` r   always_fsyncz'patch_flush_fsync.<locals>.always_fsyncU   s#    	 	 	 	 	 r   r%   flushN)indexesr   r+   )db_objr*   indexs      r   patch_flush_fsyncr/   B   s    &    5 5|U[111wU 3 34444FL&,///FG\\&11222
Fr   N)codernitydb3.miscr   r   r   r!   r/   r)   r   r   <module>r1      s_   & # " " " " "  2 2 2"0 0 0"! ! ! ! !r   