+
    ~j                     L   ^ RI t ^ RIt^ RIt^ RIt^ RIHt Rt]P                  ! R4      P                  t	]P                  ! R4      P                  t
]P                  ! R4      P                  t]P                  ! R4      P                  tR tR tRR lt ! R R	4      tR
 R ltR# )    N)List   is   ddc                 .    \        W#4      WV^,           % R# )   N)_pack_two_doubles_func)dataposvalue	timestamps   &&&&p/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/prometheus_client/mmap_dict.py_pack_two_doublesr      s    /ADS2X    c                 .    \        V4      WV^,           % R# )   N)_pack_integer_func)r   r	   r
   s   &&&r   _pack_integerr      s    *51DS1Wr   c              #  t  "   V^ 8:  d   \        V ^ 4      ^ ,          p^pW!8  d   \        W4      ^ ,          pW2,           V8  d   \        R4      hV^,          pWW#,            pV^V^,           ^,          ,
          ,           pW%,          p\        W4      w  rgVP                  R4      WgV3x  V^,          pK  R# 5i)z<Yield (key, value, timestamp, pos). No locking is performed.z2Read beyond file size detected, file is corrupted.utf-8N)_unpack_integerRuntimeError_unpack_two_doublesdecode)r   usedr	   encoded_lenencoded_key
padded_lenr
   r   s   &&      r   _read_all_valuesr      s      qytQ'*
C
*%d03t#STTqs01 AqA(=$=>
.t9  )5S@@r	 s   B6B8c                   b   a  ] tR t^2t o RtRR lt]R 4       tR tR t	R t
R tR tR	 tR
tV tR# )
MmapedDicta  A dict of doubles, backed by an mmapped file.

The file starts with a 4 byte int, indicating how much of it is used.
Then 4 bytes of padding.
There's then a number of entries, consisting of a 4 byte int which is the
size of the next field, a utf-8 encoded string key, padding to a 8 byte
alignment, and then a 8 byte float which is the value and a 8 byte float
which is a UNIX timestamp in seconds.

Not thread safe.
c                   \        Y'       d   R MR4      V n        Wn        \        P                  ! V P                  P                  4       4      P                  pV^ 8X  d&   V P                  P                  \        4       \        pW0n	        \        P                  ! V P                  P                  4       V P                  V'       d   \        P                  M\        P                  R7      V n        / V n        \        V P                  ^ 4      ^ ,          V n        V P                   ^ 8X  d+   ^V n        \#        V P                  ^ V P                   4       R# V'       g,   V P%                  4        F  w  p rVW`P                  V&   K  	  R# R# )rbza+b)accessN)open_f_fnameosfstatfilenost_sizetruncate_INITIAL_MMAP_SIZE	_capacitymmapACCESS_READACCESS_WRITE_m
_positionsr   _usedr   r   )selffilename	read_modecapacitykey_r	   s   &&&    r   __init__MmapedDict.__init__?   s   x>88DGGNN,-55q=GG/0)H!))DGGNN,dnn7@4#3#3dFWFWY $TWWa03
::?DJ$''1djj1&*&;&;&=NCA+.OOC( '> r   c           	     L   \        V R 4      ;_uu_ 4       pVP                  \        P                  4      p\	        V^ 4      ^ ,          pV\        V4      8  d(   W!P                  V\        V4      ,
          4      ,          pRRR4       \        XX4      #   + '       g   i     L; i)r!   N)r#   readr-   PAGESIZEr   lenr   )r4   infpr   r   s   &   r   read_all_values_from_file$MmapedDict.read_all_values_from_fileT   sy    (D!!T 99T]]+D"4+A.Dc$i		$T"233 "  d++ "!s   A*BB#	c                |   VP                  R4      pVR^\        V4      ^,           ^,          ,
          ,          ,           p\        P                  ! R\        V4       R2P                  4       \        V4      VRR4      pV P                  \        V4      ,           V P
                  8  d   V ;P
                  ^,          un        V P                  P                  V P
                  4       \        P                  ! V P                  P                  4       V P
                  4      V n
        K  W@P                  V P                  V P                  \        V4      ,           % V ;P                  \        V4      ,          un        \        V P                  ^ V P                  4       V P                  ^,
          V P                  V&   R# )z0Initialize a value. Lock must be held by caller.r       isddg        N)encoder>   structpackr2   r,   r$   r*   r-   r(   r0   r   r1   )r3   r7   encodedpaddedr
   s   &&   r   _init_valueMmapedDict._init_value_   s   **W%DAW)9Q(>$>?@aF}C07793w<QTVYZjj3u:%6NNaNGGT^^,ii 0$..ADG6;

4::E
23 	

c%j 
dggq$**-#zzBr   c                D    \        V P                  V P                  R7      # )z1Yield (key, value, pos). No locking is performed.)r   r   )r   r0   r2   r3   s   &r   r   MmapedDict._read_all_valuesp   s    TWW4::>>r   c              #  N   "   V P                  4        F  w  rr4WV3x  K  	  R# 5i)z7Yield (key, value, timestamp). No locking is performed.N)r   )r3   kvtsr8   s   &    r   read_all_valuesMmapedDict.read_all_valuest   s%     002KA"(N 3s   #%c                    WP                   9  d   V P                  V4       V P                   V,          p\        V P                  V4      # N)r1   rK   r   r0   )r3   r7   r	   s   && r   
read_valueMmapedDict.read_valuey   s9    oo%S!ooc""477C00r   c                    WP                   9  d   V P                  V4       V P                   V,          p\        V P                  WBV4       R # rW   )r1   rK   r   r0   )r3   r7   r
   r   r	   s   &&&& r   write_valueMmapedDict.write_value   s8    oo%S!ooc"$''3y9r   c                    V P                   '       dE   V P                  P                  4        R V n        V P                   P                  4        R V n         R # R # rW   )r$   r0   closerN   s   &r   r^   MmapedDict.close   s8    777GGMMODGGGMMODG	 r   )r,   r$   r%   r0   r1   r2   N)F)__name__
__module____qualname____firstlineno____doc__r9   staticmethodr@   rK   r   rT   rX   r[   r^   __static_attributes____classdictcell__)__classdict__s   @r   r   r   2   sF     
/* , ,/"?
1: r   r   c                    V ^8  d   QhR\         R\         R\        \         ,          R\        \         ,          R\         R\         /# )   metric_namename
labelnameslabelvalues	help_textreturn)strr   )formats   "r   __annotate__rs      sI     N N# NS Nd3i NdSVi Ndg Nlo Nr   c                ^    \        \        W#4      4      p\        P                  ! WWT.RR7      # )z&Format a key for use in the mmap file.T)	sort_keys)dictzipjsondumps)rk   rl   rm   rn   ro   labelss   &&&&& r   mmap_keyr{      s)     #j./F::{&<MMr   i   )r   )rx   r-   r&   rG   typingr   r+   StructrH   r   r   unpack_fromr   r   r   r   r   r   r{    r   r   <module>r      s      	   ]]4(-- u-22 --%11mmE*66 B2.X XvNr   