You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document is the complete reference for how a data_batch moves between lifecycle states
and which methods trigger each transition. State changes are enforced by a std::shared_mutex;
observable state is tracked atomically in _state.
States
State
Description
idle
No active locks. The batch is available for reading, mutation, or representation conversion.
read_only
One or more read_only_data_batch shared locks are active (_read_only_count > 0). Concurrent readers allowed; exclusive access blocked.
mutable_locked
One mutable_data_batch exclusive lock is active. No concurrent readers. Full read/write access to the data representation.
Accessor Classes
Data is only accessible through RAII accessor objects; the idle shared_ptr<data_batch> grants
no access to the underlying data.
Class
Lock type
Copyable
Notes
read_only_data_batch
Shared (std::shared_lock)
Yes — each copy acquires a new shared lock
_read_only_count increments per instance
mutable_data_batch
Exclusive (std::unique_lock)
No
Only one can exist at a time
Allowed Transitions
Non-static (via shared_from_this — caller's shared_ptr is NOT consumed)
From
To
Method
Blocking
idle
read_only
to_read_only()
Yes — blocks until shared lock available
idle
read_only
try_to_read_only()
No — returns std::nullopt if exclusive lock held
idle
mutable_locked
to_mutable()
Yes — blocks until exclusive lock available
idle
mutable_locked
try_to_mutable()
No — returns std::nullopt if any lock held
Static (consume accessor via && — source is left null)
From
To
Method
Blocking
Notes
read_only
idle
to_idle(read_only_data_batch&&)
No
Returns shared_ptr<data_batch>; state becomes idle when last reader releases