:py:mod:`dissect.apfs.cursor` ============================= .. py:module:: dissect.apfs.cursor Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.apfs.cursor.Cursor .. py:class:: Cursor(btree: dissect.apfs.objects.BTree, omap: dissect.apfs.objects.ObjectMap | None = None, oid: int = 0, xid: int | None = None) Cursor for traversing B-Trees. :param btree: B-Tree to traverse. :param omap: Optional object map to resolve child pointers. :param oid: Optional base object ID to resolve child pointers. :param xid: Optional transaction ID to resolve child pointers. .. py:attribute:: btree .. py:attribute:: omap :value: None .. py:attribute:: oid :value: 0 .. py:attribute:: xid :value: None .. py:property:: state :type: tuple[dissect.apfs.objects.BTreeNode, int, list[tuple[dissect.apfs.objects.BTreeNode, int]]] Get the current cursor state. .. py:method:: reset() -> Self Reset the cursor to the root of the B-Tree. .. py:method:: key() -> bytes Get the current key. .. py:method:: value() -> bytes Get the current value. .. py:method:: item() -> tuple[bytes, bytes] Get the current key and value. .. py:method:: first() -> bool Move the cursor to the first item in the B-Tree. .. py:method:: last() -> bool Move the cursor to the last item in the B-Tree. .. py:method:: next() -> bool Move the cursor to the next item in the B-Tree. .. py:method:: prev() -> bool Move the cursor to the previous item in the B-Tree. .. py:method:: push() -> Self Push down to the child node at the current index. .. py:method:: pop() -> Self Pop back to the parent node. .. py:method:: walk() -> collections.abc.Iterator[tuple[bytes, bytes]] Walk the B-Tree in order, yielding (key, value) tuples. .. py:method:: search(key: Any, *, exact: bool = False, cmp: collections.abc.Callable[[Any, bytes], Literal[-1, 0, 1]] = cmp_default) -> Self Search for a key in the B-Tree. :param key: Key to search for. :param exact: If ``True``, only return if an exact match is found. :param cmp: Comparison function to use. Should return -1, 0, or 1.