summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/akonadish.md54
-rw-r--r--docs/applicationdomaintypes.md1
-rw-r--r--docs/clientapi.md3
-rw-r--r--docs/design.md16
-rw-r--r--docs/logging.md4
-rw-r--r--docs/resource.md17
-rw-r--r--docs/storage.md19
-rw-r--r--docs/terminology.md2
8 files changed, 103 insertions, 13 deletions
diff --git a/docs/akonadish.md b/docs/akonadish.md
new file mode 100644
index 0000000..b144dba
--- /dev/null
+++ b/docs/akonadish.md
@@ -0,0 +1,54 @@
1The akonadi shell is the primary interaction point from the commandline. It can be used for debugging, maintenance and scripting.
2
3The syntax is:
4 `akonadish COMMAND TYPE ...`
5
6# Commands
7
8## list
9The list command allows to execute queries and retreive results in form of lists.
10Eventually you will be able to specify which properties should be retrieved, for now it's a hardcoded list for each type. It's generally useful to check what the database contains and whether queries work.
11
12## count
13Like list, but only output the result count.
14
15## stat
16Some statistics how large the database is, how the size is distributed accross indexes, etc.
17
18## create/modify/delete
19Allows to create/modify/delete entities. Currently this is only of limited use, but works already nicely with resources. Eventually it will allow to i.e. create/modify/delete all kinds of entities such as events/mails/folders/....
20
21## clear
22Drops all caches of a resource but leaves the config intact. This is useful while developing because it i.e. allows to retry a sync, without having to configure the resource again.
23
24## synchronize
25Allows to synchronize a resource. For an imap resource that would mean that the remote server is contacted and the local dataset is brought up to date,
26for a maildir resource it simply means all data is indexed and becomes queriable by akonadi.
27
28Eventually this will allow to specify a query as well to i.e. only synchronize a specific folder.
29
30## show
31Provides the same contents as "list" but in a graphical tree view. This was really just a way for me to test whether I can actually get data into a view, so I'm not sure if it will survive as a command. For the time being it's nice to compare it's performance to the QML counterpart.
32
33# Setting up a new resource instance
34akonadi_cmd is already the primary way how you create resource instances:
35
36 `akonadish create resource org.kde.maildir path /home/developer/maildir1`
37
38This creates a resource of type "org.kde.maildir" and a configuration of "path" with the value "home/developer/maildir1". Resources are stored in configuration files, so all this does is write to some config files.
39
40 `akonadish list resource`
41
42By listing all available resources we can find the identifier of the resource that was automatically assigned.
43
44 `akonadish synchronize org.kde.maildir.instance1`
45
46This triggers the actual synchronization in the resource, and from there on the data is available.
47
48 `akonadish list folder org.kde.maildir.instance1`
49
50This will get you all folders that are in the resource.
51
52 `akonadish remove resource org.kde.maildir.instance1`
53
54And this will finally remove all traces of the resource instance.
diff --git a/docs/applicationdomaintypes.md b/docs/applicationdomaintypes.md
index 9a50940..4baf317 100644
--- a/docs/applicationdomaintypes.md
+++ b/docs/applicationdomaintypes.md
@@ -2,6 +2,7 @@
2A set of standardized domain types is defined. This is necessary to decouple applications from resources (so a calendar can access events from all resources), and to have a "language" for queries. 2A set of standardized domain types is defined. This is necessary to decouple applications from resources (so a calendar can access events from all resources), and to have a "language" for queries.
3 3
4The definition of the domain model directly affects: 4The definition of the domain model directly affects:
5
5* granularity for data retrieval (email property, or individual subject, date, ...) 6* granularity for data retrieval (email property, or individual subject, date, ...)
6* queriable properties for filtering and sorting (sender, id, ...) 7* queriable properties for filtering and sorting (sender, id, ...)
7 8
diff --git a/docs/clientapi.md b/docs/clientapi.md
index e0c66fb..219f972 100644
--- a/docs/clientapi.md
+++ b/docs/clientapi.md
@@ -17,6 +17,7 @@ The client API consists of:
17A set of standardized domain types is defined. This is necessary to decouple applications from resources (so a calendar can access events from all resources), and to have a "language" for queries. 17A set of standardized domain types is defined. This is necessary to decouple applications from resources (so a calendar can access events from all resources), and to have a "language" for queries.
18 18
19The definition of the domain model directly affects: 19The definition of the domain model directly affects:
20
20* granularity for data retrieval (email property, or individual subject, date, ...) 21* granularity for data retrieval (email property, or individual subject, date, ...)
21* queriable properties for filtering and sorting (sender, id, ...) 22* queriable properties for filtering and sorting (sender, id, ...)
22 23
@@ -24,6 +25,7 @@ The purpose of these domain types is strictly to be the interface and the types
24 25
25## Store Facade 26## Store Facade
26The store is always accessed through a store specific facade, which hides: 27The store is always accessed through a store specific facade, which hides:
28
27* store access (one store could use a database, and another one plain files) 29* store access (one store could use a database, and another one plain files)
28* message type (flatbuffers, ...) 30* message type (flatbuffers, ...)
29* indexes 31* indexes
@@ -69,6 +71,7 @@ Queries can be kept open (live) to receive updates as the store changes.
69 71
70### Query 72### Query
71The query consists of: 73The query consists of:
74
72* a set of filters to match the wanted entities 75* a set of filters to match the wanted entities
73* the set of properties to retrieve for each entity 76* the set of properties to retrieve for each entity
74 77
diff --git a/docs/design.md b/docs/design.md
index fe0d214..772bd65 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -39,6 +39,16 @@ Implications of the above:
39 39
40# Overview 40# Overview
41 41
42## Client API
43The client facing API hides all akonadi internals from the applications and emulates a unified store that provides data through a standardized interface.
44This allows applications to transparently use various data sources with various data source formats.
45
46## Resource
47A resource is a plugin that provides access to an additional source. It consists of a store, a synchronizer process that executes synchronization & change replay to the source and maintains the store, as well as a facade plugin for the client api.
48
49## Store
50Each resource maintains a store that can either store the full dataset for offline access or only metadata for quick lookups. Resources can define how data is stored.
51
42## Types 52## Types
43### Domain Type 53### Domain Type
44The domain types exposed in the public interface. 54The domain types exposed in the public interface.
@@ -46,10 +56,12 @@ The domain types exposed in the public interface.
46### Buffer Type 56### Buffer Type
47The individual buffer types as specified by the resource. The are internal types that don't necessarily have a 1:1 mapping to the domain types, although that is the default case that the default implementations expect. 57The individual buffer types as specified by the resource. The are internal types that don't necessarily have a 1:1 mapping to the domain types, although that is the default case that the default implementations expect.
48 58
59## Mechanisms
49### Change Replay 60### Change Replay
50The change replay is based on the revisions in the store. Clients (and also the write-back mechanism), are informed that a new revision is available. Each client can then go through all new revisions (starting from the last seen revision), and thus update it's state to the latest revision. 61The change replay is based on the revisions in the store. Clients (as well as also the write-back mechanism that replays changes to the source), are informed that a new revision is available. Each client can then go through all new revisions (starting from the last seen revision), and thus update its state to the latest revision.
51 62
52# Client API 63### Preprocessor pipeline
64Each resource has an internal pipeline of preprocessors that can be used for tasks such as indexing or filtering. The pipeline guarantees that the preprocessor steps are executed before the entity is persisted.
53 65
54# Tradeoffs/Design Decisions 66# Tradeoffs/Design Decisions
55* Key-Value store instead of relational 67* Key-Value store instead of relational
diff --git a/docs/logging.md b/docs/logging.md
index a11a943..a495a7a 100644
--- a/docs/logging.md
+++ b/docs/logging.md
@@ -19,8 +19,10 @@ For debugging purposes a logging framework is required. Simple qDebugs() proved
19 19
20## Collected information 20## Collected information
21Additionally to the regular message we want: 21Additionally to the regular message we want:
22
22* pid 23* pid
23* threadid? 24* threadid?
24* timestamp 25* timestamp
25* sourcefile + position + function name 26* sourcefile + position + function name
26* application name 27* application name / resource identfier
28* component identifier (i.e. resource access)
diff --git a/docs/resource.md b/docs/resource.md
index d1b2bbe..aa263e8 100644
--- a/docs/resource.md
+++ b/docs/resource.md
@@ -5,12 +5,9 @@ The resource consists of:
5* a configuration setting of the filters 5* a configuration setting of the filters
6 6
7# Synchronizer 7# Synchronizer
8* The synchronization can either: 8The synchronizer process is responsible for processing all commands, executing synchronizations with the source, and replaying changes to the source.
9 * 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.
10 * If the source supports incremental changes the changeset can directly be generated from that information.
11 9
12The changeset is then simply inserted in the regular modification queue and processed like all other modifications. 10Processing of commands happens in the pipeline which executes all preprocessors ebfore the entity is persisted.
13The synchronizer already knows that it doesn't have to replay this changeset to the source, since replay no longer goes via the store.
14 11
15# Preprocessors 12# Preprocessors
16Preprocessors 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. 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.
@@ -106,7 +103,7 @@ The indexes status information can be recorded using the latest revision the ind
106Most preprocessors will likely be used by several resources, and are either completely generic, or domain specific (such as only for mail). 103Most preprocessors will likely be used by several resources, and are either completely generic, or domain specific (such as only for mail).
107It is therefore desirable to have default implementations for common preprocessors that are ready to be plugged in. 104It is therefore desirable to have default implementations for common preprocessors that are ready to be plugged in.
108 105
109The domain types provide a generic interface to access most properties of the entities, on top of which generic preprocessors can be implemented. 106The domain type adaptors provide a generic interface to access most properties of the entities, on top of which generic preprocessors can be implemented.
110It is that way trivial to i.e. implement a preprocessor that populates a hierarchy index of collections. 107It is that way trivial to i.e. implement a preprocessor that populates a hierarchy index of collections.
111 108
112## Preprocessors generating additional entities 109## Preprocessors generating additional entities
@@ -116,3 +113,11 @@ In such a case the preprocessor must invoke the complete pipeline for the new en
116 113
117# Pipeline 114# Pipeline
118A pipeline is an assembly of a set of preprocessors with a defined order. A modification is always persisted at the end of the pipeline once all preprocessors have been processed. 115A pipeline is an assembly of a set of preprocessors with a defined order. A modification is always persisted at the end of the pipeline once all preprocessors have been processed.
116
117# Synchronization / Change Replay
118* The synchronization can either:
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.
120 * If the source supports incremental changes the changeset can directly be generated from that information.
121
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.
123
diff --git a/docs/storage.md b/docs/storage.md
index b6d73fe..f1de2db 100644
--- a/docs/storage.md
+++ b/docs/storage.md
@@ -27,7 +27,9 @@ Entity {
27The store consists of entities that have each an id and a set of properties. Each entity can have multiple revisions. 27The store consists of entities that have each an id and a set of properties. Each entity can have multiple revisions.
28 28
29A entity is uniquely identified by: 29A entity is uniquely identified by:
30
30* Resource + Id 31* Resource + Id
32
31The additional revision identifies a specific instance/version of the entity. 33The additional revision identifies a specific instance/version of the entity.
32 34
33Uri Scheme: 35Uri Scheme:
@@ -37,8 +39,10 @@ Uri Scheme:
37Each entity can be as normalized/denormalized as useful. It is not necessary to have a solution that fits everything. 39Each entity can be as normalized/denormalized as useful. It is not necessary to have a solution that fits everything.
38 40
39Denormalized: 41Denormalized:
42
40* priority is that mime message stays intact (signatures/encryption) 43* priority is that mime message stays intact (signatures/encryption)
41* could we still provide a streaming api for attachments? 44* could we still provide a streaming api for attachments?
45
42``` 46```
43Mail { 47Mail {
44 id 48 id
@@ -47,6 +51,7 @@ Mail {
47``` 51```
48 52
49Normalized: 53Normalized:
54
50* priority is that we can access individual members efficiently. 55* priority is that we can access individual members efficiently.
51* we don't care about exact reproducability of e.g. ical file 56* we don't care about exact reproducability of e.g. ical file
52``` 57```
@@ -72,6 +77,7 @@ The advantage of this is that a resource only needs to specify a minimal set of
72 77
73### Value Format 78### Value Format
74Each entity-value in the key-value store consists of the following individual buffers: 79Each entity-value in the key-value store consists of the following individual buffers:
80
75* Metadata: metadata that is required for every entity (revision, ....) 81* Metadata: metadata that is required for every entity (revision, ....)
76* Resource: the buffer defined by the resource (synchronized properties, values that help for synchronization such as remoteId's) 82* Resource: the buffer defined by the resource (synchronized properties, values that help for synchronization such as remoteId's)
77* Local-only: default storage buffer that is domain-type specific. 83* Local-only: default storage buffer that is domain-type specific.
@@ -81,7 +87,7 @@ Each entity-value in the key-value store consists of the following individual bu
81Storage is split up in multiple named databases that reside in the same database environment. 87Storage is split up in multiple named databases that reside in the same database environment.
82 88
83``` 89```
84 $DATADIR/akonadi2/storage/$RESOURCE_IDENTIFIER/$BUFFERTYPE.main 90 $DATADIR/storage/$RESOURCE_IDENTIFIER/$BUFFERTYPE.main
85 $BUFFERTYPE.index.$INDEXTYPE 91 $BUFFERTYPE.index.$INDEXTYPE
86``` 92```
87 93
@@ -103,29 +109,35 @@ Files are used to handle opaque large properties that should not end up in memor
103For reading: 109For reading:
104 110
105Resources... 111Resources...
106* store the file in ~/akonadi2/storage/$RESOURCE_IDENTIFIER_files/ 112
113* store the file in $DATADIR/storage/$RESOURCE_IDENTIFIER_files/
107* store the filename in the blob property. 114* store the filename in the blob property.
108* delete the file when the corresponding entity is deleted. 115* delete the file when the corresponding entity is deleted.
109 116
110Queries... 117Queries...
118
111* Copy the requested property to /tmp/akonadi2/client_files/ and provide the path in the property 119* Copy the requested property to /tmp/akonadi2/client_files/ and provide the path in the property
112* The file is guaranteed to exist for the lifetime of the query result. 120* The file is guaranteed to exist for the lifetime of the query result.
113 121
114Clients.. 122Clients..
123
115* Load the file from disk and use it as they wish (moving is fine too) 124* Load the file from disk and use it as they wish (moving is fine too)
116 125
117For writing: 126For writing:
118 127
119Clients.. 128Clients..
129
120* Request a path from akonadi2 and store the file there. 130* Request a path from akonadi2 and store the file there.
121* Store the path of the written file in the property. 131* Store the path of the written file in the property.
122 132
123Resources.. 133Resources..
124* move the file to ~/akonadi2/storage/$RESOURCE_IDENTIFIER_files/ 134
135* move the file to $DATADIR/storage/$RESOURCE_IDENTIFIER_files/
125* store the new path in the entity 136* store the new path in the entity
126 137
127#### Design Considerations 138#### Design Considerations
128Using regular files as the interface has the advantages: 139Using regular files as the interface has the advantages:
140
129* Existing mechanisms can be used to stream data directly to disk. 141* Existing mechanisms can be used to stream data directly to disk.
130* The necessary file operations can be efficiently handled depending on OS and filesystem. 142* The necessary file operations can be efficiently handled depending on OS and filesystem.
131* We avoid reinventing the wheel. 143* We avoid reinventing the wheel.
@@ -147,6 +159,7 @@ SQL not very useful (it would just be a very slow key-value store). While docume
147* Memory consumption is suitable for desktop-system (no in-memory stores). 159* Memory consumption is suitable for desktop-system (no in-memory stores).
148 160
149Other useful properties: 161Other useful properties:
162
150* Is suitable to implement some indexes (the fewer tools we need the better) 163* Is suitable to implement some indexes (the fewer tools we need the better)
151* Support for transactions 164* Support for transactions
152* Small overhead in on-disk size 165* Small overhead in on-disk size
diff --git a/docs/terminology.md b/docs/terminology.md
index 4b49f2d..9da8851 100644
--- a/docs/terminology.md
+++ b/docs/terminology.md
@@ -14,7 +14,7 @@ It is recommended to familiarize yourself with the terms before going further in
14* store facade: An object provided by resources which provides transformations between domain objects and the store. 14* store facade: An object provided by resources which provides transformations between domain objects and the store.
15* synchronizer: The operating system process responsible for overseeing the process of modifying and synchronizing a store. To accomplish this, a synchronizer loads the correct resource plugin, manages pipelines and handles client communication. One synchronizer is created for each source that is accessed by clients; these processes are shared by all clients. 15* synchronizer: The operating system process responsible for overseeing the process of modifying and synchronizing a store. To accomplish this, a synchronizer loads the correct resource plugin, manages pipelines and handles client communication. One synchronizer is created for each source that is accessed by clients; these processes are shared by all clients.
16* Preprocessor: A component that takes an entity and performs some modification of it (e.g. changes the folder an email is in) or processes it in some way (e.g. indexes it) 16* Preprocessor: A component that takes an entity and performs some modification of it (e.g. changes the folder an email is in) or processes it in some way (e.g. indexes it)
17* pipeline: A run-time definable set of filters which are applied to an entity after a resource has performed a specific kind of function on it (add, update, remove) 17* pipeline: A run-time definable set of filters which are applied to an entity after a resource has performed a specific kind of function on it (create, modify, delete)
18* query: A declarative method for requesting entities from one or more sources that match a given set of constraints 18* query: A declarative method for requesting entities from one or more sources that match a given set of constraints
19* command: Clients request modifications, additions and deletions to the store by sending commands to a synchronizer for processing 19* command: Clients request modifications, additions and deletions to the store by sending commands to a synchronizer for processing
20* command queue: A queue of commands kept by the synchronizer to ensure durability and, when necessary, replayability 20* command queue: A queue of commands kept by the synchronizer to ensure durability and, when necessary, replayability