State

State

class preader.State

Bases: object

Saved progress of an iterator over one file

Saving an iterator or loading from the registry returns one, and passing it back as the state of a new iterator resumes from it

file

Metadata of the tracked file, recorded when the state was created or last resynced

name

Name the state is saved under

percent()

Returns position as a share of the recorded file size, from 0.0 to 100.0

It returns 0.0 for an empty file

position

Byte offset just past the last finished item, where a resumed iterator starts

timestamps

Times the state was created and last saved or resynced

FileMetadata

class preader.FileMetadata

Bases: object

Path, size, modification time and fingerprint of a state’s tracked file

The metadata is recorded when the state is created or resynced and is never refreshed by a save. After the file grows, resuming reads only up to size, or fails with a size mismatch when verify_state is on, until a resync records the file again

fingerprint

SHA-256 hex digest of the first 4096 bytes of the file

mtime

Modification time of the file, at microsecond precision

path

Path of the file, canonical when recorded by an iterator or a resync

size

Size of the file in bytes, where reads stop

Timestamps

class preader.Timestamps

Bases: object

Creation and last update times of a state, in whole UTC seconds

updated_at changes only when the state is saved or resynced, not while an iterator advances

created_at

When the state was first created

updated_at

When the state was last saved or resynced