+
    „WÝj(  ã                  óÔ   € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
Ht ]P                  ! ]4      t^xR^yR^zR^€R/tR	t]R
]^,           R/tR R ltR R ltR R ltR R ltR# )að  Who holds the SQLite write lock on state.db right now (Linux ``/proc/locks``).

The "database is locked for over Ns" failure names the victim but not the holder, and the
open-descriptor scan (``hermes_state_holders``) cannot tell a reader from the one writer: every
Hermes process has the DB open. SQLite's unix VFS takes ``fcntl`` byte-range locks whose offsets
encode the lock kind, and the kernel exports them with the owning pid, so the holder can be named
at the moment the deadline passes.
)ÚannotationsN)ÚPath)ÚDictÚListÚTuplez	WAL writezWAL checkpointzWAL recoverzshm dead-man switchi   @ÚPENDINGÚRESERVEDc               ó(   € V ^8„  d   QhRRRRRRRR/# )é   ÚsidecarÚstrÚstartÚintÚendÚreturn© )Úformats   "ÚKC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_state_lockowners.pyÚ__annotate__r   #   s(   € ÷ %ñ %˜Sð %¨ð %°3ð %¸3ñ %ó    c                ó  € V R 8X  dK   V\         9   d   W!8X  d   \         V,          # ^{Tu;8:  d   ^8:  d   M MW!8X  d   RV^{,
           2# RV RV 2# W8X  d   V\        9   d   \        V,          # V\        ^,           8X  d   R# RV RV 2# )ú-shmzWAL read slot z
shm bytes Ú-zSHARED rangez	db bytes )Ú_SHM_LOCK_NAMESÚ_MAIN_LOCK_NAMESÚ_PENDING_BYTE)r   r   r   s   &&&r   Ú_describe_ranger   #   s‘   € Ø�&ÔØ”OÔ#¨¬Ü" 5Õ)Ð)Ø�%Ö˜3× 3¤<Ø# E¨C¥K =Ð1Ð1Ø˜E˜7 ! C 5Ð)Ð)Ø„|˜Ô!1Ô1Ü Õ&Ð&Ø” Õ!Ô!ÙØ�u�g˜Q˜s˜eÐ$Ð$r   c               ó$   € V ^8„  d   QhRRRRRR/# )r
   Útextr   Úinodeszdict[tuple[int, int], str]r   zlist[tuple[int, str, str]]r   )r   s   "r   r   r   1   s#   € ÷ ñ ˜3ð Ð(Bð ÐGañ r   c           	     óF  € . pV P                  4        F÷  pVP                  4       p\        V4      ^8  g   V^,          R8X  d   K3  VR,          w  rVrxršr¼VR8w  d   KJ   V
P                  R4      w  rÞp\        P                  ! \        V^4      \        V^4      4      pV\        V4      3p\        V	4      p\        V4      pVR8X  d   TM
\        V4      pTP                  T4      pTf   KØ  TP                  T\        TTT4      T34       Kù  	  V#   \         d     EK  i ; i)a/  ``(pid, lock kind, sidecar)`` for every WRITE lock on one of ``inodes``.

``inodes`` maps ``(st_dev, st_ino)`` to ``""`` (main file), ``"-wal"`` or ``"-shm"``. Read locks
are dropped: they never block a writer in WAL mode. An OFD lock is reported with pid ``-1``
(the kernel does not export its owner).
z->:Né   NÚWRITEÚ:ÚEOF)
Ú
splitlinesÚsplitÚlenÚosÚmakedevr   Ú
ValueErrorÚgetÚappendr   )r   r   ÚfoundÚlineÚfieldsÚ_Ú_kindÚ_clsÚaccessÚpid_sÚidentÚstart_sÚend_sÚmajor_sÚminor_sÚino_sÚdevÚkeyÚpidr   r   r   s   &&                    r   Úparse_proc_locksr>   1   s  € ð )+€EØ—‘Ö!ˆØ—‘“ˆäˆv‹;˜Œ?˜f Q�i¨4Ô/ÙØ?EÀb½zÑ<ˆ�$ ¨gØ�WÔÙð	Ø&+§k¡k°#Ó&6Ñ#ˆG˜eÜ—*’*œS ¨"Ó-¬s°7¸BÓ/?Ó@ˆCØœ˜E›
Ð#ˆCÜ�e“*ˆCÜ˜“LˆEØ  Eœ>‘%¬s°5«zˆCð —*‘*˜S“/ˆØŠ?ÙØ�‰�cœ?¨7°E¸3Ó?ÀÐIÖJñ) "ð* €Løô ô 	Ûð	ús   ÁA6DÄD ÄD c               ó   € V ^8„  d   QhRR/# )r
   r   z	list[str]r   )r   s   "r   r   r   Q   s   € ÷ ñ ¨Iñ r   c                ó6  a€ \         P                  P                  R4      '       g   . # \        P                  P                  \        P                  ! V 4      4      p/ pR F:  p \        P                  ! W,           4      pY2TP                  TP                  3&   K<  	  . o\        ^4       FX  p \        RRRR7      ;_uu_ 4       pVP                  4       pRRR4       SP                  T3R l\        XT4       4       4       KZ  	  ^ RIHp . p	S FI  w  r«pV
^ 8”  d	   V! V
4      MR	pV	P%                  V R
V R\'        W,           4      P(                   24       KK  	  V	#   \         d     EK  i ; i  + '       g   i     L¥; i  \         d    . u u # i ; i)zœOperator-facing lines naming the processes that hold a write-class lock on ``db_path``.

Empty when nothing is held or the platform has no ``/proc/locks``.
Úlinuxz/proc/locksÚasciiÚreplace)ÚencodingÚerrorsNc              3  ó8   <"  € T F  qS9  g   K  Vx € K  	  R # 5i)Nr   )Ú.0ÚentryÚhelds   & €r   Ú	<genexpr>Ú.state_db_write_lock_holders.<locals>.<genexpr>i   s   øé € Ð[Ñ'E˜eÐVZÑIZ—E’EÓ'Eùs   ƒ�
)Údescribe_holder_pidz.OFD lock, owner pid not exported by the kernelz holds z	 lock on )Ú z-walr   )ÚsysÚplatformÚ
startswithr(   ÚpathÚrealpathÚfspathÚstatÚOSErrorÚst_devÚst_inoÚrangeÚopenÚreadÚextendr>   Úhermes_state_holdersrL   r,   r   Úname)Údb_pathÚbaser   r   Ústr0   Úhandler   rL   Úlinesr=   ÚkindÚwhorI   s   &            @r   Ústate_db_write_lock_holdersre   Q   s_  ø€ ô
 �<‰<×"Ñ" 7×+Ò+Øˆ	Ü�7‰7×ÑœBŸIšI gÓ.Ó/€DØ)+€FÛ'ˆð	Ü—’˜�Ó(ˆBð *1�—	‘	˜2Ÿ9™9Ð%Ó&ñ (ð (*€DÜ�1ŽXˆð	Ü�m¨g¸i×HÕHÈFØ—{‘{“}�÷ Ið 	�‰Ô[Ô'7¸¸fÔ'EÓ[Ö[ñ õ 9à€EÛ"Ñˆ�7Ø*-°¬'Ñ! #Ô&Ð7gˆØ�‰˜�u˜G D 6¨´4¸½Ó3G×3LÑ3LÐ2MÐNÖOñ #ð €Løô' ô 	Ûð	ú÷ I×Hûäô 	ØŒIð	úsB   Á$E Â/FÃE3ÃFÅ E0Å/E0Å3FÅ>FÆFÆFÆFc               ó    € V ^8„  d   QhRRRR/# )r
   Ú
patience_sÚfloatr   ÚNoner   )r   s   "r   r   r   s   s   € ÷ 	ñ 	°ð 	¸$ñ 	r   c                óª   € \        V 4      pV'       d   RP                  V4      pMRp\        P                  RV\	        V 4      P
                  V4       R# )zQOne WARNING naming the write-lock holders at the moment a writer gave up waiting.z | zMno write-class lock held at the deadline (the holder released just before it)z2state.db write lock unavailable for %.0fs (%s): %sN)re   ÚjoinÚloggerÚwarningr   r]   )r^   rg   ÚholdersÚdetails   &&  r   Úlog_write_lock_holdersrp   s   sB   € ä)¨'Ó2€GßØ—‘˜GÓ$‰à`ˆÜ
‡N�NØ<¸jÌ$ÈwË-×J\ÑJ\Ð^dör   )Ú__doc__Ú
__future__r   Úloggingr(   rN   Úpathlibr   Útypingr   r   r   Ú	getLoggerÚ__name__rl   r   r   r   r   r>   re   rp   r   r   r   Ú<module>rx      s„   ðñõ #ã Û 	Û 
Ý ß $Ñ $à	×	Ò	˜8Ó	$€ð ˆØÐ	ØˆØÐ	ð	€ð €à�9Ø�AÕ�zðÐ õ%õõ@÷D	r   