Akonadi 和地址薄

From KDE Wiki Sandbox
Revision as of 18:23, 26 October 2010 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

这里的资料由 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,或是你通过 Akonadi 托盘图标 -> 设置来访问,你可能会发现已经建立好多个资源。还可能你会看到某个资源带上这样的标签:

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 今后的计划,但也存储到那确实有道理。我们会在今后讨论的时候记住这点的!

Related pages

Akonadi
Akonadi Troubleshooting
KAddressBook