ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Cache.Backend.Local.Internal

Description

Shared local capacity and transactional maintenance of separately typed stores.

Synopsis

Documentation

data LocalPool Source #

The pool owns one aggregate counter. Registered actions hold no duplicate entry index.

newLocalPool :: Int -> Int -> IO LocalPool Source #

Build one aggregate bound for all registered local stores.

newLocalPoolWithClock :: IO TimeSpec -> Int -> Int -> IO LocalPool Source #

Supply the monotonic clock for deterministic expiry checks.

registerStore :: LocalPool -> STM (Maybe TimeSpec) -> (TimeSpec -> STM ()) -> STM (CacheOccupancy, CacheOccupancy -> IO ()) -> IO () Source #

Register maintenance without erasing a store's key or value type.

runPool :: LocalPool -> (TimeSpec -> STM a) -> IO a Source #

Expiry, entry changes and accounting commit together. Gauge reports keep commit order.

readPool :: LocalPool -> (TimeSpec -> STM a) -> IO a Source #

Reads bypass telemetry when no expiry is due. Actions must not change occupancy.

poolFits :: LocalPool -> Int -> STM Bool Source #

Test aggregate capacity for one additional entry without overflowing byte arithmetic.

adjustPool :: LocalPool -> Int -> Int -> STM () Source #

Apply the same committed delta as a store's own occupancy.

poolEnabled :: LocalPool -> Bool Source #

Zero aggregate capacity disables weighing and retention.

poolAcceptsWeight :: LocalPool -> Int -> Bool Source #

Reject invalid and unretainable weights before mutating a store.