Skip to main content

DiskSpace

Struct DiskSpace 

Source
pub struct DiskSpace<M = Unselected> { /* private fields */ }
Expand description

Type-safe builder for p4 diskspace.

p4 df is an alias for p4 diskspace.

§Syntax

p4 [g-opts] diskspace [P4ROOT | P4JOURNAL | P4LOG | TEMP | journalPrefix | depot]

Shows summary information about the current availability of disk space on the server.

The output of p4 diskspace is in the form:

name (type type) : xxx GB free, yyy GB used, zzz GB total (ff % full)

Where name can be either P4ROOT, P4JOURNAL, P4LOG, TEMP, a prefix to a non-default P4 Server journal file location, or the name of a P4 Server depot. The filesystem type is that reported by the operating system.

If no arguments are specified, disk space information is displayed for all objects.

By default, P4 Server rejects commands when free space on the filesystems housing the P4ROOT, P4JOURNAL, P4LOG, or TEMP falls below 10 megabytes. To change this behavior, set the filesys.P4ROOT.min (and corresponding) configurables to your desired limits.

If the user account that runs the P4 Server is subject to disk quotas, the filesys.*.min configurables reflect those quotas, regardless of how much physical space actually remains on the filesystem(s) in question.

§Note

Server releases prior to 16.1 included reserved space in the number displayed for used space in the Size column for Unix filesystems. This has been changed so that the size given now excludes reserved space.

The M type parameter tracks the target at compile time. Unselected (the state returned by DiskSpace::new) spawns the bare command, which reports disk space for every object, and can also be spawned with an arbitrary target argument through ParameterizedSpawn with a one-element tuple, or SpawnExt1; that covers a journalPrefix or a depot name. Use DiskSpace::report_p4root, DiskSpace::report_p4journal, DiskSpace::report_p4log, or DiskSpace::report_temp to select one of the predefined targets; those states spawn without arguments.

Implementations§

Source§

impl DiskSpace<Unselected>

Source

pub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self

Creates a new p4 diskspace command.

bin is the path to the Perforce command-line executable. The resulting command has no target argument and reports disk space for every object.

Source§

impl<M> DiskSpace<M>

Source

pub fn report_p4root(self) -> DiskSpace<P4Root>

§Description

P4ROOT

Report disk space available for filesystem holding P4ROOT.

Transitions to the P4Root state, which spawns without arguments.

Source

pub fn report_p4journal(self) -> DiskSpace<P4Journal>

§Description

P4JOURNAL

Report disk space available for filesystem holding P4JOURNAL.

Transitions to the P4Journal state, which spawns without arguments.

Source

pub fn report_p4log(self) -> DiskSpace<P4Log>

§Description

P4LOG

Report disk space available for filesystem holding P4LOG (server log).

Transitions to the P4Log state, which spawns without arguments.

Source

pub fn report_temp(self) -> DiskSpace<Temp>

§Description

TEMP

Report disk space available for filesystem holding temporary files. If not defined, uses P4ROOT on Windows, and /tmp on Unix.

Transitions to the Temp state, which spawns without arguments.

Source§

impl<M: ExclusiveOption> DiskSpace<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 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.

Trait Implementations§

Source§

impl<M: Clone> Clone for DiskSpace<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 DiskSpace<M>

Source§

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

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

impl<M: Default> Default for DiskSpace<M>

Source§

fn default() -> Self

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

impl<M: ExclusiveOption> ParameterizedSpawn<()> for DiskSpace<M>

Source§

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

Spawns p4 diskspace 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<S: AsRef<OsStr>> ParameterizedSpawn<(S,)> for DiskSpace<Unselected>

Source§

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

Spawns p4 diskspace <target> as a child process with piped standard output and error streams, where target is a journalPrefix or a depot name.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<M: ExclusiveOption> SubCommand for DiskSpace<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 DiskSpace<M>
where M: Freeze,

§

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

§

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

§

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

§

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

§

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

§

impl<M> UnwindSafe for DiskSpace<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, T1> OutputExt1<T1> for T
where T: SpawnExt1<T1, Output = Child, Error = Error>,

Source§

fn output( &mut self, a: T1, ) -> Result<Output, <T as ParameterizedSpawn<(T1,)>>::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, T1> SpawnExt1<T1> for T

Source§

fn spawn( &mut self, a: T1, ) -> Result<<T as ParameterizedSpawn<(T1,)>>::Output, <T as ParameterizedSpawn<(T1,)>>::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.