pub struct CachePurge<M = Unselected> { /* private fields */ }Expand description
Type-safe builder for p4 cachepurge.
Reclaim disk space on a replicated server by deleting versioned file
content from the replica’s cache; file content is deleted only from the
replica, and purged content is retrieved from the target server on
demand. This command requires super access.
§Syntax
p4 [g-opts] cachepurge -a [-i N -n -R -S N -O] [-D file[revRange]]
p4 [g-opts] cachepurge -f n [-i N -n -R -S N -O] [-D file[revRange]]
p4 [g-opts] cachepurge -m n [-i N -n -R -S N -O] [-D file[revRange]]
p4 [g-opts] cachepurge -s n [-i N -n -R -S N -O] [-D file[revRange]]The M type parameter tracks the purge goal at compile time: it starts
as Unselected, in which the command has no effect and cannot be
spawned. One of Self::purge_all (-a), Self::free_space
(-f n), Self::revision_count (-m n), or Self::size (-s n)
must be used to select a goal before the command can be spawned. The
goal can be switched freely with the same methods; the common options
are preserved and the previously selected goal is discarded.
The deletion-order options -R / -O are available in every goal
state through CachePurge::purge_in_order and
CachePurge::purge_oldest_first.
Implementations§
Source§impl CachePurge<Unselected>
impl CachePurge<Unselected>
Sourcepub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self
pub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self
Creates a new p4 cachepurge command with no purge goal selected.
bin is the path to the Perforce command-line executable. The
command has no effect in this state; use Self::purge_all,
Self::free_space, Self::revision_count, or Self::size to
select the required -a / -f / -m / -s goal.
Source§impl<M> CachePurge<M>
impl<M> CachePurge<M>
Sourcepub fn purge_all(self) -> CachePurge<PurgeAllMode>
pub fn purge_all(self) -> CachePurge<PurgeAllMode>
Selects -a: delete all file content.
This transitions into the PurgeAllMode state, discarding any
previously selected purge goal; the common options are preserved.
Sourcepub fn free_space(self, n: u64) -> CachePurge<FreeSpaceMode>
pub fn free_space(self, n: u64) -> CachePurge<FreeSpaceMode>
Selects -f n: delete sufficient file content to leave n bytes of
free space for the file system.
This transitions into the FreeSpaceMode state, discarding any
previously selected purge goal; the common options are preserved.
Sourcepub fn revision_count(self, n: u64) -> CachePurge<RevisionCountMode>
pub fn revision_count(self, n: u64) -> CachePurge<RevisionCountMode>
Selects -m n: delete n file revisions.
This transitions into the RevisionCountMode state, discarding any
previously selected purge goal; the common options are preserved.
Sourcepub fn size(self, n: u64) -> CachePurge<SizeMode>
pub fn size(self, n: u64) -> CachePurge<SizeMode>
Selects -s n: delete n bytes of file data.
This transitions into the SizeMode state, discarding any
previously selected purge goal; the common options are preserved.
Sourcepub fn get_global_opts(&self) -> &GlobalOpts
pub fn get_global_opts(&self) -> &GlobalOpts
Sourcepub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self
pub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self
Sourcepub fn global_opts(self, v: GlobalOpts) -> Self
pub fn global_opts(self, v: GlobalOpts) -> Self
Sourcepub fn get_interval(&self) -> Option<u64>
pub fn get_interval(&self) -> Option<u64>
§Description
-i N
Repeat the command every N seconds. If you omit this option, the
command runs only once.
Sourcepub fn set_interval(&mut self, v: u64) -> &mut Self
pub fn set_interval(&mut self, v: u64) -> &mut Self
§Description
-i N
Repeat the command every N seconds. If you omit this option, the
command runs only once.
Sourcepub fn interval(self, v: u64) -> Self
pub fn interval(self, v: u64) -> Self
§Description
-i N
Repeat the command every N seconds. If you omit this option, the
command runs only once.
Sourcepub fn get_preview(&self) -> bool
pub fn get_preview(&self) -> bool
Sourcepub fn set_preview(&mut self, v: bool) -> &mut Self
pub fn set_preview(&mut self, v: bool) -> &mut Self
Sourcepub fn get_filter(&self) -> Option<&str>
pub fn get_filter(&self) -> Option<&str>
§Description
-D file[revRange]
Limit the action of the command to the specified set of files (and revision range, if specified).
Sourcepub fn set_filter(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_filter(&mut self, v: impl Into<String>) -> &mut Self
§Description
-D file[revRange]
Limit the action of the command to the specified set of files (and revision range, if specified).
Sourcepub fn filter(self, v: impl Into<String>) -> Self
pub fn filter(self, v: impl Into<String>) -> Self
§Description
-D file[revRange]
Limit the action of the command to the specified set of files (and revision range, if specified).
Sourcepub fn get_retain_recent_revision(&self) -> Option<u64>
pub fn get_retain_recent_revision(&self) -> Option<u64>
§Description
-S N
Do not delete the N most recent revisions of each file. For
example, specifying -S 1 means that the head revision of each file
is retained in the replica’s cache if it is already there.
Sourcepub fn set_retain_recent_revision(&mut self, v: u64) -> &mut Self
pub fn set_retain_recent_revision(&mut self, v: u64) -> &mut Self
§Description
-S N
Do not delete the N most recent revisions of each file. For
example, specifying -S 1 means that the head revision of each file
is retained in the replica’s cache if it is already there.
Sourcepub fn retain_recent_revision(self, v: u64) -> Self
pub fn retain_recent_revision(self, v: u64) -> Self
§Description
-S N
Do not delete the N most recent revisions of each file. For
example, specifying -S 1 means that the head revision of each file
is retained in the replica’s cache if it is already there.
Sourcepub fn get_purge_in_order(&self) -> bool
pub fn get_purge_in_order(&self) -> bool
§Description
-R
Delete files in the order specified by the -O option. If the
-O option is not specified, file names are used to determine
order of deletion.
Sourcepub fn set_purge_in_order(&mut self, v: bool) -> &mut Self
pub fn set_purge_in_order(&mut self, v: bool) -> &mut Self
§Description
-R
Delete files in the order specified by the -O option. If the
-O option is not specified, file names are used to determine
order of deletion.
Sourcepub fn purge_in_order(self, v: bool) -> Self
pub fn purge_in_order(self, v: bool) -> Self
§Description
-R
Delete files in the order specified by the -O option. If the
-O option is not specified, file names are used to determine
order of deletion.
Sourcepub fn get_purge_oldest_first(&self) -> bool
pub fn get_purge_oldest_first(&self) -> bool
§Description
-O
Delete the files from the oldest to the newest; that is, delete older files before deleting newer files.
Sourcepub fn set_purge_oldest_first(&mut self, v: bool) -> &mut Self
pub fn set_purge_oldest_first(&mut self, v: bool) -> &mut Self
§Description
-O
Delete the files from the oldest to the newest; that is, delete older files before deleting newer files.
Sourcepub fn purge_oldest_first(self, v: bool) -> Self
pub fn purge_oldest_first(self, v: bool) -> Self
§Description
-O
Delete the files from the oldest to the newest; that is, delete older files before deleting newer files.
Source§impl CachePurge<FreeSpaceMode>
impl CachePurge<FreeSpaceMode>
Sourcepub fn get_free_space(&self) -> u64
pub fn get_free_space(&self) -> u64
The free-space goal n selected with -f.
Source§impl CachePurge<RevisionCountMode>
impl CachePurge<RevisionCountMode>
Sourcepub fn get_revision_count(&self) -> u64
pub fn get_revision_count(&self) -> u64
The revision count n selected with -m.