o
    }oi$                     @  s~   d dl mZ d dlZd dlmZ d dlmZ d dlmZ G dd dej	Z
G dd	 d	ej	Zed
dddG dd de
ZdS )    )annotationsN)Iterable)Any)deprecated_classc                   @  s0   e Zd ZdZejdddZejdddZdS )BaseJournalBackend  Base class for Journal storages.

    Storage classes implementing this base class must guarantee process safety. This means,
    multiple processes might concurrently call ``read_logs`` and ``append_logs``. If the
    backend storage does not internally support mutual exclusion mechanisms, such as locks,
    you might want to use :class:`~optuna.storages.journal.JournalFileSymlinkLock` or
    :class:`~optuna.storages.journal.JournalFileOpenLock` for creating a critical section.

    log_number_fromintreturnIterable[dict[str, Any]]c                 C     t )ad  Read logs with a log number greater than or equal to ``log_number_from``.

        If ``log_number_from`` is 0, read all the logs.

        Args:
            log_number_from:
                A non-negative integer value indicating which logs to read.

        Returns:
            Logs with log number greater than or equal to ``log_number_from``.
        NotImplementedError)selfr    r   Q/home/ubuntu/.local/lib/python3.10/site-packages/optuna/storages/journal/_base.py	read_logs   s   zBaseJournalBackend.read_logslogslist[dict[str, Any]]Nonec                 C  r   )zAppend logs to the backend.

        Args:
            logs:
                A list that contains json-serializable logs.
        r   )r   r   r   r   r   append_logs%   s   	zBaseJournalBackend.append_logsN)r   r	   r
   r   )r   r   r
   r   )__name__
__module____qualname____doc__abcabstractmethodr   r   r   r   r   r   r   
   s    
r   c                   @  s0   e Zd ZdZejdddZejdd	d
ZdS )BaseJournalSnapshotzOptional base class for Journal storages.

    Storage classes implementing this base class may work faster when
    constructing the internal state from the large amount of logs.
    snapshotbytesr
   r   c                 C  r   )ziSave snapshot to the backend.

        Args:
            snapshot: A serialized snapshot (bytes)
        r   )r   r   r   r   r   save_snapshot8      z!BaseJournalSnapshot.save_snapshotbytes | Nonec                 C  r   )zLoad snapshot from the backend.

        Returns:
            A serialized snapshot (bytes) if found, otherwise :obj:`None`.
        r   )r   r   r   r   load_snapshotA   r!   z!BaseJournalSnapshot.load_snapshotN)r   r   r
   r   )r
   r"   )r   r   r   r   r   r   r    r#   r   r   r   r   r   1   s    r   z4.0.0z6.0.0zAUse :class:`~optuna.storages.journal.BaseJournalBackend` instead.)textc                   @  s   e Zd ZdZdS )BaseJournalLogStorager   N)r   r   r   r   r   r   r   r   r%   K   s    r%   )
__future__r   r   collections.abcr   typingr   optuna._deprecatedr   ABCr   r   r%   r   r   r   r   <module>   s    '