pub struct Policy { /* private fields */ }Expand description
Resolved durability policy for repository writes.
Combines the component selection from core.fsync, the barrier choice
from core.fsyncMethod, and the GIT_TEST_FSYNC gate, in the shape of
upstream’s fsync_components + fsync_method + use_fsync globals.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn from_values(
core_fsync: Option<&str>,
core_fsync_method: Option<&str>,
) -> Self
pub fn from_values( core_fsync: Option<&str>, core_fsync_method: Option<&str>, ) -> Self
Resolve from raw core.fsync / core.fsyncMethod values. Absent
values leave the corresponding platform default in place.
Sourcepub fn resolve(config: &impl FsyncConfigSource) -> Self
pub fn resolve(config: &impl FsyncConfigSource) -> Self
Resolve from parsed configuration (e.g. GitConfig). Configuration
lookup failures should fall back to Policy::default, which matches
reading a repository without core.fsync keys.
Sourcepub fn overridden(
self,
core_fsync: Option<&str>,
core_fsync_method: Option<&str>,
) -> Self
pub fn overridden( self, core_fsync: Option<&str>, core_fsync_method: Option<&str>, ) -> Self
Apply command-line-style overrides (git -c core.fsync=...): Some
values replace the corresponding setting, None keeps it, and the
test switch is re-read afterwards so callers holding a long-lived
policy observe current environment state.
Sourcepub const fn components(&self) -> FsyncComponents
pub const fn components(&self) -> FsyncComponents
Component set after core.fsync parsing.
Sourcepub const fn method(&self) -> FsyncMethod
pub const fn method(&self) -> FsyncMethod
Effective barrier method.
Sourcepub const fn syncs(&self, component: FsyncComponents) -> bool
pub const fn syncs(&self, component: FsyncComponents) -> bool
Whether writes to component take a barrier under this policy
(upstream fsync_component()’s gating, including the test switch).
Sourcepub const fn method_if_enabled(
&self,
component: FsyncComponents,
) -> Option<FsyncMethod>
pub const fn method_if_enabled( &self, component: FsyncComponents, ) -> Option<FsyncMethod>
The barrier method to apply when writing component files, or None
when no barrier applies. This is the shape threaded through locked
write paths that sync before rename.