Akonadi 和通訊錄
這裡的資料由KDE-PIM 開發人員 Tobias Koenig 提供。
一些定義
真實數據(real data)我們指的像是聯繫人或事件這類數據。這些數據或是存儲在「群件服務器(groupware server)」,或是存儲在本地文件中。具體存儲的位置取決於你使用的資源,比如,個人聯繫人(Personal Contacts)資源就是把數據存儲到$HOME/.local/share/contacts,同時VCard File 資源(已經不推薦使用了)則存儲數據到$HOME/.kde/share/apps/kabc/std.vcf。
緩存數據(cached data)則是真實數據的副本,放置在數據庫中便於更快速的訪問和作為離線緩存。數據庫還同時保留著用來管理數據的元數據(meta data),Akonadi需要元數據才能正常工作。
設置數據(configuration data)是設定Akonadi 服務器和個別資源的數據。服務器的設置數據可以在$HOME/.config/akonadi 找到,資源的設置數據通常存儲在$HOME/.kde/share/config/akonadi_xyz_resourcerc# (xyz 是資源名而#是其的實例數)。
The Akonadi server configuration is a couple of files in $HOME/.config/akonadi - this can be changed through environment variables, $XDG_DATA_HOME and $XDG_CONFIG_HOME, defaulting to $HOME/.local/share and $HOME/.config respectively if not set. It contains which data sources and helper programs are active and will be started and watched (so they can be restarted on crashes) by one of Akonadi's server processes (akonadi_control). KDE's local base directory can be changed using $KDEHOME environment variable, defaulting to $HOME/.kde when not set (or to $HOME/.kde4 if the distributor changed the default by patching the code).
See
kde4-config --path data
Each data source handler (called resources) or helper program (called agents) can have its own configuration although some agents or resources don't require configuration. The general rule is that for every entry in $HOME/.config/akonadi/agentsrc there is a corresponding configuration file in $HOME/.kde/share/config. For example, if the [Instances] section in agentrc contains an entry for akonadi_ical_resource_2, there is also a config file called akonadi_ical_resource_2rc in the KDE config directory.
Depending on the type of data, such config files for resources will have filenames or directory names of where the data is stored. Common locations are KDE's legacy default files, e.g. $HOME/.kde/share/apps/korganizer/std.ics. New default locations are files and directories in $HOME/.local/share, e.g. $HOME/.local/share/contacts.
For now (as in actually released versions) the database is merely used for caching and keeping structural information (e.g. which addressbook a contact belongs to). This will change when Akonadi is being used for email, since state information like read/unread is also stored there (unless the backend is also capable of doing this, e.g. IMAP).
籌備備份
然後現在是該決定備份什麼樣的數據了。如果你想備份"真實數據(real data)",這東西又得具體看你設定的資源……要是你用的是「群件服務器(groupware server)」,備份這事應該在那邊搞定。對於聯繫人,你需要的通常是$HOME/.local/share/contacts 那的文件。
Akonadi 托盤圖標提供備份和恢復功能。備份的是"緩存數據(cache data)",所以可能沒帶全你所有的數據!如果你想1:1進行系統拷貝,這功能會很有用,你可以拷貝真實數據和配置的同時復制緩存數據過去,之後便不必再次從源載入數據(比如群件服務器)。
測試你的資源
KRunner 提供Akonadi Resource Configuration,或是你通過
來訪問,你可能會發現已經建立好多個資源。還可能你會看到某個資源帶上這樣的標籤:Address Book - No KDE address book plugin configured yet.
這是舊的兼容性問題(通常是遷移工具引起的)。你應該直接刪除之!
std.vcf - Ready
這是VCard File Resource,每個默認指向$HOME/.kde/share/apps/kabc/std.vcf。不推薦再用這種方式,因為其沒有使用到Akonadi的優勢。
個人聯繫人(Personal Contacts) - Offline
這是你本地聯繫人指向的優先資源
$HOME/.local/share/contacts
注意就算是你實際在用,還是可能會提示"離線(Offline)"。這是個顯示 bug,無視之。
什麼時候更多的組件改用Akonadi啊?
剩下的組件要是遷移到Akonadi,其所有數據會存儲到~/.local/share 嗎?那樣的話備份會簡單許多。嗯,聯繫人和郵件現在已經這樣處理了。但我不知道事件/todos 今後的計劃,但也存儲到那確實有道理。我們會在今後討論的時候記住這點的!