:py:mod:`dissect.database.sqlite3.wal` ====================================== .. py:module:: dissect.database.sqlite3.wal Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.database.sqlite3.wal.WAL dissect.database.sqlite3.wal.Frame dissect.database.sqlite3.wal.Checkpoint dissect.database.sqlite3.wal.Commit Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: dissect.database.sqlite3.wal.checksum Attributes ~~~~~~~~~~ .. autoapisummary:: dissect.database.sqlite3.wal.log dissect.database.sqlite3.wal.WAL_HEADER_MAGIC_LE dissect.database.sqlite3.wal.WAL_HEADER_MAGIC_BE dissect.database.sqlite3.wal.WAL_HEADER_MAGIC .. py:data:: log .. py:data:: WAL_HEADER_MAGIC_LE :value: 931071618 .. py:data:: WAL_HEADER_MAGIC_BE :value: 931071619 .. py:data:: WAL_HEADER_MAGIC .. py:class:: WAL(fh: pathlib.Path | BinaryIO) .. py:attribute:: fh .. py:attribute:: path .. py:attribute:: header .. py:attribute:: checksum_endian :value: '<' .. py:attribute:: highest_page_num .. py:attribute:: frame .. py:method:: close() -> None Close the WAL. .. py:method:: frames() -> collections.abc.Iterator[Frame] .. py:property:: commits :type: list[Commit] Return all commits in the WAL file. Commits are frames where ``header.page_count`` specifies the size of the database file in pages after the commit. For all other frames it is 0. .. rubric:: References - https://sqlite.org/fileformat2.html#wal_file_format .. py:property:: checkpoints :type: list[Checkpoint] Return deduplicated checkpoints, oldest first. Deduplicate commits by the ``salt1`` value of their first frame. Later commits overwrite earlier ones so the returned list contains the most recent commit for each ``salt1``, sorted ascending. .. rubric:: References - https://sqlite.org/fileformat2.html#wal_file_format - https://sqlite.org/wal.html#checkpointing .. py:class:: Frame(wal: WAL, offset: int) .. py:attribute:: wal .. py:attribute:: offset .. py:attribute:: fh .. py:attribute:: header .. py:method:: __repr__() -> str .. py:property:: valid :type: bool .. py:property:: data :type: bytes .. py:property:: page_number :type: int .. py:property:: page_count :type: int .. py:class:: Checkpoint(wal: WAL, frames: list[Frame]) Bases: :py:obj:`_FrameCollection` A checkpoint is an operation that transfers all committed transactions from the WAL file back into the main database file. .. rubric:: References - https://sqlite.org/fileformat2.html#wal_file_format .. py:class:: Commit(wal: WAL, frames: list[Frame]) Bases: :py:obj:`_FrameCollection` A commit is a collection of frames that were committed together. .. rubric:: References - https://sqlite.org/fileformat2.html#wal_file_format .. py:function:: checksum(buf: bytes, endian: str = '>') -> tuple[int, int]