| 3831 | Future<Void> onClosed() const override { return closedPromise.getFuture(); } |
| 3832 | |
| 3833 | StorageBytes getStorageBytes() const override { |
| 3834 | int64_t free; |
| 3835 | int64_t total; |
| 3836 | if (memoryOnly) { |
| 3837 | total = pageCache.evictor().sizeLimit; |
| 3838 | free = pageCache.evictor().getSizeUsed(); |
| 3839 | } else { |
| 3840 | g_network->getDiskBytes(parentDirectory(filename), free, total); |
| 3841 | } |
| 3842 | int64_t pagerSize = header.pageCount * physicalPageSize; |
| 3843 | |
| 3844 | // It is not exactly known how many pages on the delayed free list are usable as of right now. It could be |
| 3845 | // known, if each commit delayed entries that were freeable were shuffled from the delayed free queue to the |
| 3846 | // free queue, but this doesn't seem necessary. |
| 3847 | |
| 3848 | // Amount of space taken up by all of the items in the free lists |
| 3849 | int64_t reusablePageSpace = (freeList.numEntries + delayedFreeList.numEntries) * physicalPageSize; |
| 3850 | // Amount of space taken up by the free list queues themselves, as if we were to pop and use |
| 3851 | // items on the free lists the space the items are stored in would also become usable |
| 3852 | int64_t reusableQueueSpace = (freeList.numPages + delayedFreeList.numPages) * physicalPageSize; |
| 3853 | int64_t reusable = reusablePageSpace + reusableQueueSpace; |
| 3854 | |
| 3855 | // Space currently in used by old page versions have have not yet been freed due to the remap cleanup window. |
| 3856 | int64_t temp = remapQueue.numEntries * physicalPageSize; |
| 3857 | |
| 3858 | return StorageBytes(free, total, pagerSize - reusable, free + reusable, temp); |
| 3859 | } |
| 3860 | |
| 3861 | int64_t getPageCacheCount() override { return pageCache.getCount(); } |
| 3862 | int64_t getPageCount() override { return header.pageCount; } |
no test coverage detected