pub struct PreparedSave { /* private fields */ }Expand description
A detached copy of the session, taken by SessionState::prepare_save()
while the caller may hold the live session lock.
Taking it is memory work only: no file, configuration or policy input is
read, so nothing a caller holds can wait on a policy refresh (#1783). The
copy is NOT admitted for storage yet and carries no publishable bytes.
Storage admission, serialization and the commit all run in
write_to_disk() / publish(), after the lock has been released.
Contract: the copy is admitted under the Gateway and project policy that
are current when it is ADMITTED, not when it was prepared — no policy
state is captured here. If the policy is tightened between prepare and
publication, records it withholds are omitted and the admitted remainder
is published. Only a change between admission and the commit refuses the
whole save (SaveError::AuthorityChanged).
Implementations§
Source§impl PreparedSave
impl PreparedSave
Sourcepub fn write_to_disk(self) -> Result<(), String>
pub fn write_to_disk(self) -> Result<(), String>
Admits the detached session for storage, then writes the session data, latest pointer, compaction snapshot and project index atomically. A per-session file lock and version check make deferred saves monotonic even when background tasks finish out of order.
This is the step that reads configuration and policy inputs and the disk; run it after the live session lock has been released. Nothing is written when admission refuses the session or when the admitting authority no longer holds at the commit.
The lock has a deadline. A save that cannot get it reports that instead
of waiting, because SessionState::save restores unsaved_changes on
Err and the next batch tries again — whereas a caller stuck in an
unbounded wait keeps whatever it holds until the other side lets go
(#1783).
Auto Trait Implementations§
impl !RefUnwindSafe for PreparedSave
impl !UnwindSafe for PreparedSave
impl Forget for PreparedSave
impl Freeze for PreparedSave
impl Move for PreparedSave
impl Send for PreparedSave
impl Sync for PreparedSave
impl Unpin for PreparedSave
impl UnsafeUnpin for PreparedSave
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more