docs/src/sync-configuration.md

Sun, 17 Dec 2023 15:33:50 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 17 Dec 2023 15:33:50 +0100
changeset 800
30d484806c2b
parent 700
165811ea12ab
permissions
-rw-r--r--

fix faulty string to int conversion utilities

Probably it was expected that errno is set to EINVAL when illegal characters are encountered. But this is not standard and does not happen on every system, allowing illegal strings to be parsed as valid integers.

---
title: 'Configuration'
---

The file `$HOME/.dav/sync.xml` is used for configuring sync-directories.

The *sync.xml* file is an XML file with `<configuration>` as root element. This element can only have `<directory>` elements as children.

## directory

This element configures a sync-directory. A sync-directory must have a unique name, a (local) path, repository and a database.

Required elements: `<name>`, `<repository>`, `<path>`, `<database>` \
Optional elements: `<collection>`, `<trash>`, `<max-retry>`, `<backup-on-pull>`, `<lock-pull>`, `<lock-push>`, `<lock-timeout>`, `<filter>`, `<metadata>`, `<versioning>`, `<splitconfig>`, `<symlink-intern>`, `<symlink-extern>`, `<tagconfig>`, `<allow-cmd>`

### name

Unique sync-directory identifer. This identifer is used in combination with all *dav-sync* commands.

Type: string \
Example: `<name>mysyncdir</name>`

### repository

Name of the WebDAV-repository. A repository with the same name must be configured in [config.xml][1].

Type: string \
Example: `<name>myrepo</name>`

### path

The path of the local directory that should be synchronized. The path must be an absolute path or start with an environment variable. A path with an environment variable must start with an `$` followed by the variable name optionally followed by a path. For example:

	`<path>$HOME/Documents</path>`

The part between `$` and `/` is the environment variable name.

Type: string \
Example: `<path>/absolute/path</path>`

### database

Path to the database file used for this sync-directory. The path must be relative to the *$HOME/.dav/* directory.

Type: string \
Example: `<database>myrepo-db.xml</database>`

### collection

Path of the collection relative to the repository root collection. For example if the repository url is *http://example.com/webdav/* and the collection value is */myfiles/*, the directory is synchronized with *http://example.com/webdav/myfiles/*

Type: string \
Default: / \
Example: `<collection>/myfiles</collection>`

### hashing

Enables file hashing. The hash will be used for checking if files are modified and should be synchronized.

Type: boolean \
Default: false \
Example: `<hashing>true</hashing>`

### trash

Path to the trash directory for this sync-directory. Files that should be deleted will be moved to this directory. The value must be an absolute path or relative to the sync-directory path.

Type: string \
Example: `<trash>.trash</trash>`

### push-strategy

Controls the strategy *push* uses for deciding which files should be pushed. Possible values are: `metadata` and `hash`.

Type: pushstrategy enum \
Default: metadata
Example: `<push-strategy>hash</push-strategy>`

### max-retry

This integer value controls how many attempts of downloading/uploading a file in case of an error are made.

Type: integer \
Default: 0 \
Example: `<max-retry>3</max-retry>`

### backup-on-pull

If this element has the value of true, the *pull* command will move old local files to the trash directory before downloading the new version from the server. 

Type: boolean \
Default: false \
Example: `<backup-on-pull>true</backup-on-pull>`

### lock-pull

Enables locking for the *pull* command.

Type: boolean \
Default: false \
Example: `<lock-pull>true</lock-pull>`

### lock-push

Enables locking for the *push* command.

Type: boolean \
Default: false \
Example: `<lock-push>true</lock-push>`

### lock-timeout

Specifies the lock timeout in seconds. If the lock-timeout is 0, the client doesn't request a specific timeout and the server's default value is used. If the lock-timeout is -1, a infinite timeout is requested.

Type: integer \
Default: 0 \
Example: `<lock-timeout>50</lock-timeout>`

### metadata

Controls which file metadata should be synchronized. Possible values are: `mtime`, `mode`, `xattr` and `all`. If this element is not specified, no metadata will be synchronized.

Type: list of metadata \
Example: `<metadata>mtime mode</metadata>`

### versioning

Enables resource versioning for the commands *push* and *archive*.

Possible attributes: `type`, `always`

The attribute `type` sets the versioning method type. Possible values are `simple` and `deltav`. With *simple* versioning, resources are moved to a version history collection before the new content is uploaded. With *deltav*, the DeltaV methods *checkout* and *checkin* are used to store versions. The default value of the `type` attribute is `simple`.

The boolean attribute `always` specifies if new versions should be always created. The default value is `false`.

Optional elements: `<history>`
Example: `<versioning type="simple" always="true" />`

### history

Specifies the history collection path for *simple* versioning. The path is interpreted relatively to the root of the sync directory.

Type: string \
Default: `/.dav-version-history`
Example:

	<versioning type="simple">
		<history>/.backup/</history>
	</versioning>

### symlink-intern

Configures the handling of symlinks, which have a target inside the sync directory. Possible values are: `sync`, `follow` and `ignore`.

Type: symlink enum \
Default: follow \
Example: `<symlink-intern>sync</symlink-intern>`

## symlink-extern

Configures the handling of symlinks, which have a target outside the sync directory. Possible values are: `follow` and `ignore`. Unlike internal symlinks, external symlinks cannot be synced.

Type: symlink enum \
Default: follow \
Example: `<symlink-extern>ignore</symlink-extern>`

### tagconfig

Configures the local store for resource tags. If this element is specified, resource tags are stored locally.

Optional elements: local-store, detect-changes, xattr-name, on-conflict

### local-store

Specifies the tag-store type. Currently the only available type is `xattr`.

The element can contain the attribute `format` with one of the following values: `text`, `csv`, `xml`, `macos`. The default value is `text`.

Type: tagstore type enum \
Default: xattr \
Example: `<local-store format="csv">xattr</local-store>`

### xattr-name

Specifies the name of the extended attribute for storing tags. The default value is `tags`, unless you are using the `macos` format, where the default value is `com.apple.metadata:_kMDItemUserTags`.

Type: string \
Default: tags \
Example: `<xattr-name>file_tags</xattr-name>

### detect-changes

Controls, if tag changes should be detected.

Type: boolean \
Default: false \
Example: `<detect-changes>true</detect-changes>`

### on-conflict

Specifies the behavior, when tag conflicts occur. Possible values are: `no_conflict`, `keep_local`, `keep_remote`, `merge`

Type: onconflict enum \
Default: no_conflict \
Example: `<on-conflict>merge</on-conflict>`

### splitconfig

Parent element for all `<split>` elements.

### split

Configures if and how files should be splitted into multiple parts on *push*.

The blocksize element configures the size of each part.

The elements filter and minsize specify, in which case the files should be splitted.

Required elements: `<blocksize>` \
Optional elements: `<filter>`, `<minsize>`

Example:

	<splitconfig>
		<!-- split all files with .vmdk file extension that are bigger than 100mb -->
		<split>
			<blocksize>10m</blocksize>
			<filter>
				<include>\.vmdk$</include>
			</filter>
			<minsize>100m</minsize>
		</split>
	</splitconfig>

### blocksize

Specifies the size of each file part.

Type: size \
Example: `<blocksize>100k</blocksize>`

### minsize

Specifies the minimal size a file must have for enabling file splitting.

Type: size \
Default: 0 \
Example: `<minsize>100m</minsize>`

### filter

With the filter element, include and exclude filters can be specified, to control which files are synchronized. The *pull*, *push* and *archive* command apply these filters to file paths. At first it is checked if a file is matching any include filter. If so only files matching not an exclude filter are further processed.

It is also possible to filter resources by tags. Tags can dynamically be applied to individual files. The tag filter elements contains a tag filter expression. Only files that match the filter expression are synchronized.

Note: The file path is relative to the directory path (and WebDAV collection) but always starts with an path separator.

Optional elements: `<include>`, `<exclude>`, `<tags>`

### include

Controls which files will be included by *pull* and *push*. If an include filter is specified, only files matching this filter are included.

Type: regex string \
Default: .* \
Example: 

	<filter>
		<include>\.pdf$</include>
	</filter>

### exclude

Controls which files will be excluded by *pull* and *push*.

Type: regex string \
Example:

	<filter>
		<exclude>^/secretdir</exclude>
		<exclude>\.DS_Store$</exclude>
	</filter>

### tags

Filters resources by tags. Only resources, that are not a collection, are effected. If tags are not stored locally, the pull command still uses the filter.

Filter Syntax:

	filter ::= operator? , (tag_list | ("(" , filter , ")")+)
	tag_list ::= tag , ("," tag)*
	operator ::= "&" | "|" | "1" | "0"

Type: tag filter expression \
Example:

	<filter>
		<!-- sync only resources that have one of this tags -->
		<tags>| (tag1, tag2, tag3)</tags>
	</filter>

mercurial