summaryrefslogtreecommitdiffstats
path: root/docs/resource.md
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-28 15:08:40 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-28 15:08:40 +0100
commitf90a6a8992ab2b99b3d56e268c1592c7432aedcf (patch)
tree7485db3459f7d3717965bf24a60424d237e0cdd2 /docs/resource.md
parent296a5ac347dbccfff44d2b2a0a378e98b0480cac (diff)
downloadsink-f90a6a8992ab2b99b3d56e268c1592c7432aedcf.tar.gz
sink-f90a6a8992ab2b99b3d56e268c1592c7432aedcf.zip
Documentation
Diffstat (limited to 'docs/resource.md')
-rw-r--r--docs/resource.md22
1 files changed, 21 insertions, 1 deletions
diff --git a/docs/resource.md b/docs/resource.md
index aa263e8..c8f58e9 100644
--- a/docs/resource.md
+++ b/docs/resource.md
@@ -9,6 +9,13 @@ The synchronizer process is responsible for processing all commands, executing s
9 9
10Processing of commands happens in the pipeline which executes all preprocessors ebfore the entity is persisted. 10Processing of commands happens in the pipeline which executes all preprocessors ebfore the entity is persisted.
11 11
12The synchronizer process has the following primary components:
13
14* Command Queues: Queues that hold all incoming commands. Persisted over reboots.
15* Command Processor: A processor that empties the command queues by pushing commands through the pipeline.
16* Listener: Opens a socket and listens for incoming connections. On connection all incoming commands are read and entered into command queues. Control commands (i.e. a sync) don't require persistency and are therefore processed directly.
17* Synchronization: Handles synchronization to the source, as well as change-replay to the source. The modification commands generated by the synchronization enter the command queue as well.
18
12# Preprocessors 19# Preprocessors
13Preprocessors are small processors that are guaranteed to be processed before an new/modified/deleted entity reaches storage. They can therefore be used for various tasks that need to be executed on every entity. 20Preprocessors are small processors that are guaranteed to be processed before an new/modified/deleted entity reaches storage. They can therefore be used for various tasks that need to be executed on every entity.
14 21
@@ -119,5 +126,18 @@ A pipeline is an assembly of a set of preprocessors with a defined order. A modi
119 * Generate a full diff directly on top of the db. The diffing process can work against a single revision/snapshot (using transactions). It then generates a necessary changeset for the store. 126 * Generate a full diff directly on top of the db. The diffing process can work against a single revision/snapshot (using transactions). It then generates a necessary changeset for the store.
120 * If the source supports incremental changes the changeset can directly be generated from that information. 127 * If the source supports incremental changes the changeset can directly be generated from that information.
121 128
122The changeset is then simply inserted in the regular modification queue and processed like all other modifications. The synchronizer has to ensure only changes are replayed to the source that didn't come from it already. 129The changeset is then simply inserted in the regular modification queue and processed like all other modifications. The synchronizer has to ensure only changes are replayed to the source that didn't come from it already. This is done by marking changes that don't require changereplay to the source.
130
131## Synchronization Store
132To track progress of the synchronization, the synchronizer needs to maintain a separate store. It needs to be separate from the main store to properly separate the the synchronization from the Command Processor, which enables the two parts to run concurrently (We can't have two threads writing to the same store).
133
134While the synchronization store can contain any useful information for a resource to synchronize a typical example looks like this:
135
136* changereplay: Contains the last replayed revision. Used by the change replay to know what has been replayed to the source already.
137* remoteid.mapping.$BUFFERTYPE: Contains the mapping of a remote identifier to a local identifier. Necessary to track what has already been synchronized, and to replay changes to the remote entity.
138* localid.mapping.$BUFFERTYPE: Reverse mapping of the remoteid.mapping.
139
140The remoteid mapping has to be updated in two places:
123 141
142* New entities that are synchronized immediately get a localid assinged, that is then recorded together with the remoteid. This is required to be able to reference other entities directly in the command queue (i.e. for parent folders).
143* Entities created by clients get a remoteid assigned during change replay, so the entity can be recognized during the next sync.