maestral.manager
This module contains the classes to coordinate sync threads.
- class maestral.manager.SyncManager(client)[source]
Bases:
object
Class to manage sync threads
- Parameters
client (maestral.client.DropboxClient) – The Dropbox API client, a wrapper around the Dropbox Python SDK.
- added_item_queue: queue.Queue[str]
Queue of dropbox paths which have been newly included in syncing.
- property reindex_interval: float
Interval in sec for period reindexing. Changes will be saved to state file.
- property activity: Dict[str, maestral.database.SyncEvent]
Returns a list all items queued for or currently syncing.
- property history: List[maestral.database.SyncEvent]
A list of the last SyncEvents in our history. History will be kept for the interval specified by the config value
keep_history
(defaults to two weeks) but at most 1,000 events will be kept.
- property idle_time: float
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.
- 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
- 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