Optional executor capability for bounded opaque worker-owned caches. Direct operations borrow the live executor. Leases retain only separate light controls. Payload callbacks run synchronously only inside this executor's BackgroundJob::run extent. They must not retain a borrowed value/build scope, UI state, or coroutine storage.
More...
#include <worker_storage.hpp>
|
|
| ~BackgroundWorkerStorage () |
| | Final host teardown after all workers join, never scene retirement.
|
|
| BackgroundWorkerStorage (const BackgroundWorkerStorage &)=delete |
|
BackgroundWorkerStorage & | operator= (const BackgroundWorkerStorage &)=delete |
| std::expected< WorkerStorageLease, BackgroundError > | registerSlot () |
| std::uint64_t | changeEpoch () const noexcept |
| WorkerStorageStats | stats () const noexcept |
| std::expected< void, BackgroundError > | withRead (WorkerStorageId id, const std::function< std::expected< void, BackgroundError >(const WorkerStorageValue &)> &read) |
| std::expected< void, BackgroundError > | withBuild (WorkerStorageId id, std::size_t residentCap, std::size_t scratchCap, const std::function< std::expected< void, BackgroundError >(WorkerStorageBuild &)> &build) |
Optional executor capability for bounded opaque worker-owned caches. Direct operations borrow the live executor. Leases retain only separate light controls. Payload callbacks run synchronously only inside this executor's BackgroundJob::run extent. They must not retain a borrowed value/build scope, UI state, or coroutine storage.
◆ changeEpoch()
| std::uint64_t portals::BackgroundWorkerStorage::changeEpoch |
( |
| ) |
const |
|
noexcept |
- Returns
- Advisory readiness generation; sample before admission to avoid missed release.
◆ registerSlot()
- Returns
- Light slot registration or explicit CLOSED/WOULD_BLOCK/NO_MEMORY.
◆ stats()
- Returns
- Current allocation-capacity accounting, safe while host lives.
◆ withBuild()
- Parameters
-
| id | Exact registration; build excludes readers and another build on this slot. |
| residentCap | Reserved resident bytes, including transient reallocation peak. |
| scratchCap | Reserved temporary bytes, released only after callback returns. |
| build | Worker callback allocating within both reservations and committing once. |
- Returns
- Original callback result, LIMIT_EXCEEDED for an impossible own request, or bounded backpressure. Idle LRU values can be reclaimed on this worker before admission. No worker waits for other work.
◆ withRead()
- Parameters
-
| id | Registration identity from this executor. |
| read | Worker callback borrowing an immutable opaque payload for this invocation only. |
- Returns
- Original callback result or WRONG_THREAD/CLOSED/WOULD_BLOCK; exceptions translated.
The documentation for this class was generated from the following file: