Template Struct AbstractBlockManager
Defined in File block.h
Inheritance Relationships
Base Types
public CE::Memory::BlockManagement< T >(Template Struct BlockManagement)public CE::Memory::BlockManagerInterface< T >(Template Struct BlockManagerInterface)
Derived Types
public CE::Memory::Objects::Pool< T >(Template Struct Pool)public CE::Memory::Objects::PoolState< T >(Template Struct PoolState)
Struct Documentation
-
template<typename T>
struct AbstractBlockManager : public CE::Memory::BlockManagement<T>, public CE::Memory::BlockManagerInterface<T> Implements block lookup, merging, and culling over CE::Memory::BlockManagement<T>’s shared sets.
Derived managers decide how blocks are acquired and returned.
Subclassed by CE::Memory::Objects::Pool< T >, CE::Memory::Objects::PoolState< T >
Public Types
Public Functions
-
AbstractBlockManager() = default
Retain the shared T bookkeeping state without allocating object backing or acquiring a range.
-
~AbstractBlockManager() override = default
Release the facade’s state reference; other retained contexts/owners preserve shared bookkeeping.
-
inline virtual void cull(std::chrono::minutes age) override
Queue complete free owners old enough for release through BlockTransactions.
- Parameters:
age – Minimum duration since a whole owner became free; negative values make current free owners immediately eligible. Does not release backing yet or invalidate checked-out ranges.
-
inline virtual void release_culled() override
Transactionally remove eligible complete free owners, then release final backing after unlocking.
Owners that became checked out/split again are not forcibly freed.
Protected Functions
-
template<typename Tuple>
inline ::CE::Memory::OptionalBlock<T> search_right(::CE::Memory::Block<T> block, Tuple &tuple) Observe the next higher-address range of the same backing owner.
- Parameters:
block – Starting metadata.
tuple – Ordered collection borrowed under its read lock.
- Returns:
Copied range or no match; does not reserve or verify contiguity.
-
template<typename Tuple>
inline ::CE::Memory::OptionalBlock<T> search_left(::CE::Memory::Block<T> block, Tuple &tuple) Observe an earlier-address range of the same backing owner.
- Parameters:
block – Starting metadata.
tuple – Ordered collection borrowed under its read lock.
- Returns:
Copied range or no match; no checkout or contiguity guarantee follows.
-
template<typename Tuple>
inline ::CE::Memory::OptionalBlock<T> contiguous_right(::CE::Memory::Block<T> block, Tuple &tuple) Find a same-owner right neighbor whose head meets this range’s end.
- Parameters:
block – Stable valid starting metadata.
tuple – Ordered collection used for the observation.
- Returns:
Retained neighbor metadata or no match; concurrent transitions require the transactional API.
-
template<typename Tuple>
inline ::CE::Memory::OptionalBlock<T> contiguous_left(::CE::Memory::Block<T> block, Tuple &tuple) Find a same-owner left neighbor whose end meets this range’s head.
- Parameters:
block – Stable valid starting metadata.
tuple – Ordered collection used for the observation.
- Returns:
Retained neighbor metadata or no match; no range is claimed.
-
template<typename Tuple>
inline ::CE::Memory::OptionalBlock<T> adjacent_right(::CE::Memory::Block<T> block, Tuple &tuple) Observe the successor under the set’s ordering, which may differ from address order.
- Parameters:
block – Comparator search key.
tuple – Ordered collection borrowed under a shared lock.
- Returns:
Copied successor or no value, without owner/contiguity validation.
-
template<typename Tuple>
inline ::CE::Memory::OptionalBlock<T> adjacent_left(::CE::Memory::Block<T> block, Tuple &tuple) Observe the predecessor under the set’s ordering, which may differ from address order.
- Parameters:
block – Comparator search key.
tuple – Ordered collection borrowed under a shared lock.
- Returns:
Copied predecessor or no value, without claiming or validating contiguity.
-
inline virtual void record_new(::CE::Memory::Block<T> block) override
Record complete backing metadata through the shared-domain transaction owner.
- Parameters:
block – Valid owner range; allocation of collection records may throw. Does not construct T or make it a free pool range.
-
inline virtual void mark_stale(::CE::Memory::Block<T> block) override
Timestamp an exact complete free owner under coordinated bookkeeping locks.
- Parameters:
block – Valid complete owner; absent/nonfree metadata is ignored.
-
inline virtual ::CE::Memory::OptionalBlock<T> merge_into_pool(::CE::Memory::Block<T> block) override
Return a current checked-out range through BlockTransactions, merging free neighbors.
- Parameters:
block – Range whose live users/objects have ended.
- Returns:
Merged free metadata, or no value for invalid/already-pooled input. Allocation failures preserve the prior logical partition.
-
inline virtual ::CE::Memory::OptionalBlock<T> find_section(T *ptr) override
Copy split-section metadata containing ptr under the section read lock.
- Parameters:
ptr – Candidate address in retained storage.
- Returns:
Matching range or no value; observation is not an exclusive reservation.
-
inline virtual ::CE::Memory::OptionalBlock<T> find_owner(T *ptr) override
Copy complete backing-owner metadata containing ptr under the registry read lock.
- Parameters:
ptr – Candidate address.
- Returns:
Matching owner or no value; not a live-object or checked-out-state guarantee.
-
inline virtual ::CE::Memory::OptionalBlock<T> fill_request(std::size_t N, std::align_val_t minimum_alignment = std::align_val_t{0}) override
Claim one existing free range with sufficient count and alignment.
See also
- Parameters:
N – Minimum elements, or bytes for void; callers supply a meaningful positive request.
minimum_alignment – Additional alignment requirement; effective minimum is alignof(T), or 64 for void.
- Returns:
Whole compatible range or no value; no new allocation or split occurs.
Protected Static Functions
- Returns:
Borrowed mutex at tuple index zero; caller keeps the collection tuple alive and follows its lock-order policy.
-
template<typename ...Tuples>
static inline void read_lock(Tuples&... tuples) Acquire shared mutexes sequentially in argument order.
- Parameters:
tuples – Live collection tuples whose element zero is a shared_mutex. Low-level non-RAII helper: caller avoids inconsistent lock order/reentry and releases acquired locks, including cleanup if a later lock throws. It does not atomically lock all collections.
-
template<typename ...Tuples>
static inline void read_unlock(Tuples&... tuples) Release each previously held shared mutex in argument order.
- Parameters:
tuples – Exactly the collection tuples locked by the calling thread. No ownership validation, transaction or automatic exception cleanup is supplied.
-
template<typename ...Tuples>
static inline void emplace(::CE::Memory::Block<T> b, Tuples&... tuples) Insert range metadata into each selected collection under separate write locks.
- Parameters:
b – Valid metadata copied into each collection.
tuples – Live bookkeeping tuple/set pairs. This is not a cross-collection transaction: a later insertion failure can leave earlier collections changed. Use BlockTransactions for invariant-preserving compound operations.
-
template<typename ...Tuples>
static inline void erase(::CE::Memory::Block<T> b, Tuples&... tuples) Erase comparator-matching metadata from each selected set under its own write lock.
- Parameters:
b – Lookup metadata.
tuples – Live collection tuples. Separate lock scopes do not form an atomic multi-collection transition; callers maintain invariants/quiescence when using this primitive.
-
template<typename ...Tuples>
static inline bool contains(::CE::Memory::Block<T> b, Tuples&... tuples) Check a complete Block equality match in every selected collection under separate read locks.
- Parameters:
b – Full owner/head/alignment/length metadata.
tuples – Live collection tuples.
- Returns:
True when each individual observation found exact metadata; this is not one atomic snapshot across all sets.
-
AbstractBlockManager() = default