maestral.manager

This module contains the classes to coordinate sync threads.

Module Contents

class maestral.manager.SyncManager(sync, desktop_notifier=None)[source]

Class to manage sync threads

Parameters:
property idle_time: float[source]

Returns the idle time in seconds since the last file change or since startup if there haven’t been any changes in our current session.

Return type:

float

download_queue: PersistentQueue[str][source]

Queue of remote paths which have been newly included in syncing.

start()[source]

Creates observer threads and starts syncing.

Return type:

None

stop()[source]

Stops syncing and destroys worker threads.

Return type:

None

reset_sync_state()[source]

Resets all saved sync state. Settings are not affected.

Return type:

None

rebuild_index()[source]

Rebuilds the rev file by comparing remote with local files and updating rev numbers from the Dropbox server. Files are compared by their content hashes and conflicting copies are created if the contents differ. File changes during the rebuild process will be queued and uploaded once rebuilding has completed.

Rebuilding will be performed asynchronously.

Return type:

None

check_and_update_path_root()[source]

Checks if the user’s root namespace corresponds to the currently configured path root. Updates the root namespace if required and migrates the local folder structure. Syncing will be paused during the migration.

Returns:

Whether the path root was updated.

Return type:

bool

connection_monitor()[source]

Monitors the connection to Dropbox servers. Pauses syncing when the connection is lost and resumes syncing when reconnected and syncing has not been paused by the user.

Return type:

None

download_worker(running, startup_completed, autostart)[source]

Worker to sync changes of remote Dropbox with local folder.

Parameters:
  • running (threading.Event) – Event to shut down local file event handler and worker threads.

  • startup_completed (threading.Event) – Set when startup sync is completed.

  • autostart (threading.Event) – Set when syncing should automatically resume on connection.

Return type:

None

download_worker_added_item(running, startup_completed, autostart)[source]

Worker to download items which have been newly included in sync.

Parameters:
  • running (threading.Event) – Event to shut down local file event handler and worker threads.

  • startup_completed (threading.Event) – Set when startup sync is completed.

  • autostart (threading.Event) – Set when syncing should automatically resume on connection.

Return type:

None

upload_worker(running, startup_completed, autostart)[source]

Worker to sync local changes to remote Dropbox.

Parameters:
  • running (threading.Event) – Event to shut down local file event handler and worker threads.

  • startup_completed (threading.Event) – Set when startup sync is completed.

  • autostart (threading.Event) – Set when syncing should automatically resume on connection.

Return type:

None

startup_worker(running, startup_completed, autostart)[source]

Worker to sync local changes to remote Dropbox.

Parameters:
  • running (threading.Event) – Event to shut down local file event handler and worker threads.

  • startup_completed (threading.Event) – Set when startup sync is completed.

  • autostart (threading.Event) – Set when syncing should automatically resume on connection.

Return type:

None