protonfs.usage.model module

Value types the du engine returns: Entry, Breakdown and their enums.

UsageEngine produces these; the terminal report and the web UI read them. Every figure carries the Unix time it was measured (at).

Added in version 3.4.0.

class protonfs.usage.model.Breakdown(path, size, descendants, at, state, entries, gap, gap_kind, oldest_at, newest_at, error=None, invalid=False)[source]

Bases: object

A folder’s size split into its listed children plus a labelled remainder.

size == Σ entry sizes + Σ hidden-row sizes + gap whenever every counted child has a figure. Hidden (-X) children are not in entries but still count toward gap and gap_kind.

Variables:
  • path – escaped Drive path of the folder ("/" for the account view).

  • size – the folder total in bytes, or None when unknown.

  • descendants – node count beneath the folder, or None when unknown.

  • at – Unix time size was measured (for /, the oldest entry’s time).

  • state – LISTED with entries; SIZED when only the total is cached; UNMEASURED when nothing is known; EXCLUDED when the folder itself matches an exclusion rule; ERROR when its size or list call failed; PARTIAL (/ and /devices only) when size leaves out an unmeasured or hidden section or device.

  • entries – the visible children in listing order; empty when no listing is cached or the folder’s own call failed.

  • gap – size minus the known child sizes, or None without a listing.

  • gap_kind – the label of gap, see GapKind.

  • oldest_at – the oldest measurement time among all inputs, or None.

  • newest_at – the newest measurement time among all inputs, or None.

  • error – the failure text when state is ERROR, else None.

  • invalid – True when the cached listing was invalidated by a newer measurement of one of its children (so entries may no longer add up to size); a fresh pass replaces it. False otherwise, including when nothing is cached.

Added in version 3.4.0.

at: float | None
descendants: int | None
entries: tuple[Entry, ...]
error: str | None = None
gap: int | None
gap_kind: GapKind
invalid: bool = False
newest_at: float | None
oldest_at: float | None
path: str
size: int | None
state: NodeState
class protonfs.usage.model.Entry(name, path, kind, uid, size, descendants, at, state, exclusion, mtime, decrypted, error=None)[source]

Bases: object

One child of a breakdown: a file, a folder or (in the / view) an account section.

Variables:
  • name – plain (unescaped) name; the node uid when the name could not be decrypted.

  • path – escaped Drive path of the node.

  • kind – "file", "folder" or "section" (entries of the / view).

  • uid – Drive node uid, if known.

  • size – bytes (encrypted totalStorageSize, trashed descendants included for folders), or None when unknown.

  • descendants – node count beneath a folder, None for files or when unknown.

  • at – Unix time the size was measured, or None when unknown.

  • state – what is known, see NodeState.

  • exclusion – the freeze/hide rule that matched, or Exclusion.NONE.

  • mtime – modificationTime from the listing, if any.

  • decrypted – whether name is the decrypted name.

  • error – the failure text when state is ERROR, else None.

Added in version 3.4.0.

at: float | None
decrypted: bool
descendants: int | None
error: str | None = None
exclusion: Exclusion
kind: str
mtime: str | None
name: str
path: str
size: int | None
state: NodeState
uid: str | None
class protonfs.usage.model.GapKind(*values)[source]

Bases: Enum

How the remainder of a folder’s size, beyond its listed children, is labelled.

  • NONE: there is no remainder (or no breakdown to compute one from).

  • TRASH ("in_trash"): every input comes from one pass and every counted child has a figure, so the remainder is trashed items whose original parent is this folder.

  • UNATTRIBUTED: some child (excluded, failed or unmeasured) has no figure, so the remainder includes its bytes.

  • UNRECONCILED: the remainder is negative, or the inputs come from different passes, so it cannot be attributed.

Added in version 3.4.0.

NONE = 'none'
TRASH = 'in_trash'
UNATTRIBUTED = 'unattributed'
UNRECONCILED = 'unreconciled'
class protonfs.usage.model.NodeState(*values)[source]

Bases: Enum

What is known about a node.

  • LISTED: a folder whose own listing is cached (it can be broken down).

  • SIZED: a size figure is known but no listing (always the case for files).

  • EXCLUDED: a folder matched by a freeze rule; its cached figure, if any, is shown without being refreshed.

  • UNMEASURED: no figure is known (nothing cached, or the node cannot be sized).

  • ERROR: the Drive call for this node failed; see the error text.

  • PARTIAL: only for the / and /devices views: the total leaves out a section or device that counts toward “used” (/my-files, /devices or a device) but has no figure or is hidden. The entries show which.

Added in version 3.4.0.

ERROR = 'error'
EXCLUDED = 'excluded'
LISTED = 'listed'
PARTIAL = 'partial'
SIZED = 'sized'
UNMEASURED = 'unmeasured'