Skip to content

Engine State

Engine state classes.

Classes:

Name Description
FolderStats

Dataclass for state.

Context

Abstract base class for engine state context.

EngineContext

Class for engine state context.

EngineState

Abstract base class for engine states.

RunningState

State representing engine running.

DryRunState

State representing engine running in dry-run mode.

TransferSuccessState

State representing successful file transfer.

TransferErrorState

State representing failed file transfer.

StoppedState

State representing engine stopped due to an error.

SuccessState

State representing successful completion of folder processing.

UserStoppedState

State representing user-requested stop of processing.

NoFilesFoundAllSearchedState

State representing no files found in the folder and all files searched.

NoFilesFoundState

State representing no files found in the folder.

AllSearched

State representing all folders being searched.

FolderSizeLimitState

State representing folder size limit reached.

TotalSizeLimitState

State representing total size limit reached.

FolderStats(count: int = 0, starttime: float = 0.0, curr_size: int = 0, total_size: int = 0) dataclass

Dataclass for state.

Methods:

Name Description
reset

Reset state variables for a new folder.

update

Update state on successful operation.

reset() -> None

Reset state variables for a new folder.

update(size: int) -> None

Update state on successful operation.

Context(folder: Folder, quota: DiversityQuota, folder_size_limit: SizeLimit, total_size_limit: SizeLimit, reporter: ReportWriter, is_dry_run: bool, dtstamp: DateTimeStamp, is_stop_requested: bool = False, folderstats: FolderStats = FolderStats(), _state: EngineState | None = None) dataclass

Bases: ABC

Abstract base class for engine state context.

Methods:

Name Description
should_stop

Check and update state before file validation.

is_none_found

Check if no files were found in the current folder.

prepare

Prepare the context for a new folder processing.

update_on_success

Update context on successful file operation.

should_treat_as_dry_run

Check if a file has already been transferred.

set_errored

Set the state to invalid file transfer.

set_transferred

Set the state to successful file transfer.

finalize

Finalize the context after processing.

Attributes:

Name Type Description
state EngineState

Get the current engine state.

state: EngineState property writable

Get the current engine state.

should_stop(target: int) -> bool abstractmethod

Check and update state before file validation.

is_none_found() -> bool abstractmethod

Check if no files were found in the current folder.

prepare(dest: str) -> None abstractmethod

Prepare the context for a new folder processing.

update_on_success(entry: FSEntry) -> None abstractmethod

Update context on successful file operation.

should_treat_as_dry_run(copy_path_str: str) -> bool abstractmethod

Check if a file has already been transferred.

set_errored(copy_path_str: str) -> None abstractmethod

Set the state to invalid file transfer.

set_transferred(copy_path_str: str) -> None abstractmethod

Set the state to successful file transfer.

finalize(target: int, dest: str) -> str abstractmethod

Finalize the context after processing.

EngineContext(folder: Folder, quota: DiversityQuota, folder_size_limit: SizeLimit, total_size_limit: SizeLimit, reporter: ReportWriter, is_dry_run: bool, dtstamp: DateTimeStamp, is_stop_requested: bool = False, folderstats: FolderStats = FolderStats(), _state: EngineState | None = None) dataclass

Bases: Context

Class for engine state context.

Methods:

Name Description
should_stop

Check and update state before file validation.

is_none_found

Check if no files were found in the current folder.

prepare

Prepare the context for a new folder processing.

update_on_success

Update context on successful file operation.

should_treat_as_dry_run

Check if a file has already been transferred.

set_errored

Set the state to invalid file transfer.

set_transferred

Set the state to successful file transfer.

finalize

Finalize the context after processing.

Attributes:

Name Type Description
state EngineState

Get the current engine state.

state: EngineState property writable

Get the current engine state.

should_stop(target: int) -> bool

Check and update state before file validation.

is_none_found() -> bool

Check if no files were found in the current folder.

prepare(dest: str) -> None

Prepare the context for a new folder processing.

update_on_success(entry: FSEntry) -> None

Update context on successful file operation.

should_treat_as_dry_run(copy_path_str: str) -> bool

Check if a file has already been transferred.

set_errored(copy_path_str: str) -> None

Set the state to invalid file transfer.

set_transferred(copy_path_str: str) -> None

Set the state to successful file transfer.

finalize(target: int, dest: str) -> str

Finalize the context after processing.

EngineState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Abstract base class for engine states.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

RunningState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: EngineState

State representing engine running.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

DryRunState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: RunningState

State representing engine running in dry-run mode.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

TransferSuccessState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: RunningState

State representing successful file transfer.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

TransferErrorState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: RunningState

State representing failed file transfer.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

StoppedState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: EngineState

State representing engine stopped due to an error.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

SuccessState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: StoppedState

State representing successful completion of folder processing.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

UserStoppedState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: StoppedState

State representing user-requested stop of processing.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

NoFilesFoundAllSearchedState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: StoppedState

State representing no files found in the folder and all files searched.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

NoFilesFoundState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: StoppedState

State representing no files found in the folder.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

AllSearched(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: StoppedState

State representing all folders being searched.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

FolderSizeLimitState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: StoppedState

State representing folder size limit reached.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.

TotalSizeLimitState(status: str = '', message: str = '', _context: Context | None = None) dataclass

Bases: StoppedState

State representing total size limit reached.

Methods:

Name Description
__post_init__

Post-initialization tasks.

Attributes:

Name Type Description
context Context

Get the engine state context.

context: Context property writable

Get the engine state context.

__post_init__() -> None

Post-initialization tasks.