maestral/docs/state_files.rst

95 lines
2.7 KiB
ReStructuredText
Raw Normal View History

2020-05-20 16:16:21 +03:00
State files
===========
2020-07-07 00:30:15 +03:00
Maestral saves its persistent state in two files: ``{config_name}.index`` for the file
index and ``{config_name}.state`` for anything else. Both files are located at
``$XDG_DATA_DIR/maestral`` on Linux (typically ``~/.local/share/maestral``) and
``~/Library/Application Support/maestral`` on macOS. Each configuration will get its
own state file.
2020-05-20 16:16:21 +03:00
Index file
**********
The index file contains all the tracked files and folders with their lower-case path
relative to the Dropbox folder and their "rev". Each line contains a single entry, written
as a dictionary ``{path: rev}`` in json format, for example:
.. code-block:: python
{"/test folder/subfolder/file.txt": "015a4ae1f15853400000001695a6c40"}
If there are multiple entries (lines) which refer to the same path, the last entry
overwrites any previous entries. This allows rapidly updating the rev for a file or folder
2020-07-07 00:30:15 +03:00
by appending a new line to the index file without needing to write an entire file. An
entry with ``rev == None`` means that any previous entries for this path and its children
should be discarded.
2020-05-20 16:16:21 +03:00
After a sync cycle has completed, the file is cleaned up and all duplicate or empty
entries are removed.
State file
**********
The state file has the following sections:
.. code-block:: ini
[account]
2020-07-07 00:30:15 +03:00
2020-05-20 16:16:21 +03:00
email = foo@bar.com
display_name = Foo Bar
abbreviated_name = FB
type = business
usage = 39.2% of 1312.8TB used
usage_type = team
2020-07-07 00:30:15 +03:00
# The type of OAuth access token used:
# legacy: long-lived token
# offline: short-lived token with long-libed refresh token
token_access_type = offline
2020-05-20 16:16:21 +03:00
[app]
2020-07-07 00:30:15 +03:00
# Version for which update / migration scripts have
# run. This is bumped to the currently installed
# version after an update.
updated_scripts_completed = 1.2.0
# Time stamp of last update notification
2020-05-20 16:16:21 +03:00
update_notification_last = 0.0
2020-07-07 00:30:15 +03:00
# Latest avilable release
latest_release = 1.2.0
2020-05-20 16:16:21 +03:00
[sync]
2020-07-07 00:30:15 +03:00
# Cursor reflecting last-synced remote state
2020-05-20 16:16:21 +03:00
cursor = ...
2020-07-07 00:30:15 +03:00
# Time stamp reflecting last-synced local state
2020-05-20 16:16:21 +03:00
lastsync = 1589979736.623609
2020-07-07 00:30:15 +03:00
# Time stamp of last full reindexing
2020-05-20 16:16:21 +03:00
last_reindex = 1589577566.8533309
2020-07-07 00:30:15 +03:00
# Dbx paths with sync errors
2020-05-20 16:16:21 +03:00
download_errors = []
2020-07-07 00:30:15 +03:00
# Dbx paths of interrupted downloads
2020-05-20 16:16:21 +03:00
pending_downloads = []
2020-07-07 00:30:15 +03:00
# List of recent file-changes as dicts
2020-05-20 16:16:21 +03:00
recent_changes = []
[main]
2020-07-07 00:30:15 +03:00
# State file version (not the Maestral version!)
2020-05-20 16:16:21 +03:00
version = 12.0.0
Notably, account info which can be changed by the user such as the email address is saved
in the state file while only the fixed Dropbox ID is saved in the config file.