mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-28 05:24:22 +01:00
Add error handling and results for insert(), delete(), _delete(), _detach(), pop_if_not_dirty(), and clear. Now these functions fail if a page is dirty, locked, or has other references. insert() makes room with pop_if_not_dirty() beforehand to handle cache full and un-evictable, else it would evict this page silently. _delete() returns Ok when key is not present in cache and it tries first to detach the cache entry and clean its page *before* removing the entry from the map. detach() checks firstt if it's possible to evict the page and if there are no other references to the page before taking its contents. test_detach_via_delete() and test_detach_via_insert() fixed by properly checking before and after dropping the page reference. test_page_cache_fuzz() fixed by reordering and moving reference to the page into insert. Other page cache tests fixed to check new function results. All page cache tests pass. Error handling and test fixes for Pager and BTree will be added in a subsequent commit.