Skip to content

P4OO.Counter#

Perforce Counter objects

P4OO.Counter provides common behaviors for all P4OO Counter objects.

Unlike SpecObj objects, we do not cache the values from Perforce for counters. Since they are simply name/value pairs, assume the caller will keep track of them as appropriate, and always query Perforce.

Counters are designed to change frequently, so when queried multiple times it's likely a use case where the counter is expected to have changed.

P4OOCounter dataclass #

Bases: _P4OOBase

Perforce Counter Object

id Required: Yes

Forcible: No

Attributes:

Name Type Description
id str

Name of the Counter

See Also

Perforce Helix Core Command Reference: https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_counter.html

getValue() #

Retrieve the current value of the counter

Returns:

Type Description
int

Current value of the counter

setValue(newValue) #

Set the new value of the counter

Parameters:

Name Type Description Default
newValue int

New value for the counter

required

Returns:

Type Description
int

New current value for the counter

P4OOCounterSet #

Bases: _P4OOSet

P4OOSet of P4OOCounter objects

query(maxresults=None, namefilter=None, **kwargs) #

Executes p4 counters query

Parameters:

Name Type Description Default
maxresults int

Return only the first [max] results

None
namefilter str

Case-sensitive filter on counter name

None

Returns:

Type Description
P4OOCounterSet

P4OOSet of P4OOCounter objects matching query parameters

See Also

Perforce Helix Core Command Reference: https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_counters.html