Skip to main content

CachePurge

Struct CachePurge 

Source
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>

Source

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>

Source

pub fn get_bin(&self) -> &Path

Get the Perforce command path.

Source

pub fn set_bin(&mut self, bin: impl Into<PathBuf>) -> &mut Self

Set the Perforce command path.

Source

pub fn bin(self, bin: impl Into<PathBuf>) -> Self

Set the Perforce command path.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn get_global_opts(&self) -> &GlobalOpts

§Description

g-opts

See Global options.

Source

pub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self

§Description

g-opts

See Global options.

Source

pub fn global_opts(self, v: GlobalOpts) -> Self

§Description

g-opts

See Global options.

Source

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.

Source

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.

Source

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.

Source

pub fn get_preview(&self) -> bool

§Description

-n

Display a preview of the cachepurge operation without deleting any files.

Source

pub fn set_preview(&mut self, v: bool) -> &mut Self

§Description

-n

Display a preview of the cachepurge operation without deleting any files.

Source

pub fn preview(self, v: bool) -> Self

§Description

-n

Display a preview of the cachepurge operation without deleting any files.

Source

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).

Source

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).

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source

pub fn get_free_space(&self) -> u64

The free-space goal n selected with -f.

Source§

impl CachePurge<RevisionCountMode>

Source

pub fn get_revision_count(&self) -> u64

The revision count n selected with -m.

Source§

impl CachePurge<SizeMode>

Source

pub fn get_size(&self) -> u64

The byte count n selected with -s.

Trait Implementations§

Source§

impl<M: Clone> Clone for CachePurge<M>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: Debug> Debug for CachePurge<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M: Default> Default for CachePurge<M>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<M: PurgeGoal> ParameterizedSpawn<()> for CachePurge<M>

Source§

fn spawn_with(&mut self, (): ()) -> Result<Self::Output, Self::Error>

Spawns p4 cachepurge as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<M: PurgeGoal> SubCommand for CachePurge<M>

Source§

fn name(&self) -> &str

Source§

fn inject_local_args(&self, command: &mut Command)

Source§

fn global_opts(&self) -> Option<&GlobalOpts>

Source§

fn inject_args(&self, command: &mut Command)

Source§

fn setup_command<S: AsRef<OsStr>>(&self, bin: S) -> Command

Auto Trait Implementations§

§

impl<M> Freeze for CachePurge<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for CachePurge<M>
where M: RefUnwindSafe,

§

impl<M> Send for CachePurge<M>
where M: Send,

§

impl<M> Sync for CachePurge<M>
where M: Sync,

§

impl<M> Unpin for CachePurge<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for CachePurge<M>
where M: UnsafeUnpin,

§

impl<M> UnwindSafe for CachePurge<M>
where M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OutputExt for T
where T: SpawnExt<Output = Child, Error = Error>,

Source§

impl<T, I> ParameterizedOutput<I> for T
where T: ParameterizedSpawn<I, Output = Child, Error = Error>,

Source§

type Error = Error

Source§

fn output_with( &mut self, input: I, ) -> Result<Output, <T as ParameterizedOutput<I>>::Error>

Source§

impl<T> SpawnExt for T

Source§

fn spawn( &mut self, ) -> Result<<T as ParameterizedSpawn<()>>::Output, <T as ParameterizedSpawn<()>>::Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.