diff options
Diffstat (limited to 'docs/clientapi.md')
-rw-r--r-- | docs/clientapi.md | 91 |
1 files changed, 37 insertions, 54 deletions
diff --git a/docs/clientapi.md b/docs/clientapi.md index a2ac18e..59998ca 100644 --- a/docs/clientapi.md +++ b/docs/clientapi.md | |||
@@ -1,18 +1,17 @@ | |||
1 | The client API consists of: | 1 | The client API consists of: |
2 | 2 | ||
3 | * a modification API for messages (Create/Modify/Delete) | 3 | * a modification API for entities (Create/Modify/Delete) |
4 | * a query API to retrieve messages | 4 | * a query API to retrieve entities |
5 | * a resource facade to abstract the resource implementation details | 5 | * a resource facade to abstract the resource implementation details |
6 | * a set of standardized domain types | 6 | * a set of standardized domain types |
7 | * a notification mechanism to be notified about changes from individual stores | 7 | * a notification mechanism to be notified about changes from individual stores |
8 | 8 | ||
9 | ## Requirements/Design goals | 9 | ## Requirements/Design goals |
10 | * zero-copy should be possible (mmap support) | 10 | * zero-copy should be possible (mmap support) |
11 | * Likely only possible until application domain until we rewrite portions of the applications | 11 | * A single copy is more realistic |
12 | * Most importantly we should hide how the data is stored (in parts, or one mmapped buffer) | 12 | * Most importantly we should hide how the data is stored (in parts, or one mmapped buffer) |
13 | * Support for mmapped buffers implies that we keep track of the lifetime of the loaded values. | 13 | * property-level on-demand loading of data |
14 | * property-level on-demand loading | 14 | * streaming support for large properties (attachments) |
15 | * streaming support for certain properties (attachments) | ||
16 | 15 | ||
17 | ## Domain Types | 16 | ## Domain Types |
18 | A 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. | 17 | A 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. |
@@ -24,42 +23,35 @@ The definition of the domain model directly affects: | |||
24 | 23 | ||
25 | The purpose of these domain types is strictly to be the interface and the types are not meant to be used by applications directly, or to be restricted by any other specifications (such as ical). By nature these types will be part of the evolving interface, and will need to be adjusted for every new property that an application must understand. | 24 | The purpose of these domain types is strictly to be the interface and the types are not meant to be used by applications directly, or to be restricted by any other specifications (such as ical). By nature these types will be part of the evolving interface, and will need to be adjusted for every new property that an application must understand. |
26 | 25 | ||
27 | ### Akonadi Domain Types | 26 | ### Application Domain Types |
28 | This is a proposed set of types that we will need to evolve into what we actually require. Hierarchical types are required to be able to query for a result set of mixed types. | 27 | This is a proposed set of types that we will need to evolve into what we actually require. Hierarchical types are required to be able to query for a result set of mixed types. |
29 | 28 | ||
30 | Items: | 29 | * Entity |
31 | 30 | * Item | |
32 | * Item | 31 | * Incidence |
33 | * incidence | 32 | * Event |
34 | * Event | 33 | * Todo |
35 | * Todo | 34 | * Journal |
35 | * Freebusy | ||
36 | * Note | ||
37 | |||
38 | * Contact | ||
39 | * Collection | ||
40 | * Mail Folder | ||
41 | * Calendar | ||
42 | * Tasklist | ||
36 | * Journal | 43 | * Journal |
37 | * Freebusy | 44 | * Contact Group |
38 | * Note | 45 | * Address Book |
39 | 46 | * Relation | |
40 | * Contact | 47 | * Tag |
41 | |||
42 | Collections: | ||
43 | |||
44 | * Collection | ||
45 | * Mail Folder | ||
46 | * Calendar | ||
47 | * Tasklist | ||
48 | * Journal | ||
49 | * Contact Group | ||
50 | * Address Book | ||
51 | |||
52 | Relations: | ||
53 | |||
54 | * Relation | ||
55 | * Tag | ||
56 | 48 | ||
57 | ## Store Facade | 49 | ## Store Facade |
58 | The store is always accessed through a store specific facade, which hides: | 50 | The store is always accessed through a store specific facade, which hides: |
59 | * store access (one store could use a database, and another one plain files) | 51 | * store access (one store could use a database, and another one plain files) |
60 | * message type (flatbuffers, ...) | 52 | * message type (flatbuffers, ...) |
61 | * indexes | 53 | * indexes |
62 | * syncronizer communication | 54 | * synchronizer communication |
63 | * notifications | 55 | * notifications |
64 | 56 | ||
65 | This abstraction layer allows each resource to separately define how data is stored and retrieved. Therefore tradeoffs can be defined to suit the expected access patters or structure of source data. Further it allows individual resources to choose different technologies as suitable. Logic can still be shared among resources, while keeping the maintenance effort reasonable, by providing default implementations that are suitable for most workloads. | 57 | This abstraction layer allows each resource to separately define how data is stored and retrieved. Therefore tradeoffs can be defined to suit the expected access patters or structure of source data. Further it allows individual resources to choose different technologies as suitable. Logic can still be shared among resources, while keeping the maintenance effort reasonable, by providing default implementations that are suitable for most workloads. |
@@ -67,7 +59,7 @@ This abstraction layer allows each resource to separately define how data is sto | |||
67 | Because the facade also implements querying of indexes, a resource my use server-side searching to fullfill the query, and fallback to local searches when the server is not available. | 59 | Because the facade also implements querying of indexes, a resource my use server-side searching to fullfill the query, and fallback to local searches when the server is not available. |
68 | 60 | ||
69 | ## Modifications | 61 | ## Modifications |
70 | Modifications are stored by the client sending modification commands to the syncronizer. The syncronizer is responsible for ensuring that modification are not lost and eventually persistet. A small window exists therefore where a modification is transferred to the syncronizer where a modifications can get lost. | 62 | Modifications are stored by the client sending modification commands to the synchronizer. The synchronizer is responsible for ensuring that modification are not lost and eventually persistet. A small window exists therefore where a modification is transferred to the synchronizer where a modifications can get lost. |
71 | 63 | ||
72 | The API consists of the following calls: | 64 | The API consists of the following calls: |
73 | 65 | ||
@@ -75,23 +67,23 @@ The API consists of the following calls: | |||
75 | * modify(domainObject, resource) | 67 | * modify(domainObject, resource) |
76 | * remove(domainObject, resource) | 68 | * remove(domainObject, resource) |
77 | 69 | ||
78 | The changeset can be recorded by the domain object adapter while the properties are set, and are then sent to the syncronizer once modify is called. | 70 | The changeset can be recorded by the domain object adapter while the properties are set, and are then sent to the synchronizer once modify is called. |
79 | 71 | ||
80 | Each modification is associated with a specific revision, which allows the syncronizer to do automatic conflict resolution. | 72 | Each modification is associated with a specific revision, which allows the synchronizer to do automatic conflict resolution. |
81 | 73 | ||
82 | ### Conflict Resolution | 74 | ### Conflict Resolution |
83 | Conflicts can occur at two points in the client: | 75 | Conflicts can occur at two points in the client: |
84 | 76 | ||
85 | * While i.e. an editor is open and we receive an update for the same entity | 77 | * While i.e. an editor is open and we receive an update for the same entity |
86 | * After a modification is sent to the syncronizer but before it's processed | 78 | * After a modification is sent to the synchronizer but before it's processed |
87 | 79 | ||
88 | In the first case the client is repsonsible to resolve the conflict, in the latter case it's the syncronizer's responsibility. | 80 | In the first case the client is repsonsible to resolve the conflict, in the latter case it's the synchronizer's responsibility. |
89 | A small window exists where the client has already started the modification (i.e. command is in socket), and a notification has not yet arrived that the same entity has been changed. In such a case the syncronizer may reject the modification because it has the revision the modification refers to no longer available. | 81 | A small window exists where the client has already started the modification (i.e. command is in socket), and a notification has not yet arrived that the same entity has been changed. In such a case the synchronizer may reject the modification because it has the revision the modification refers to no longer available. |
90 | 82 | ||
91 | This design allows the syncronizer to be in control of the revisions, and keeps it from having to wait for all clients to update until it can drop revisions. | 83 | This design allows the synchronizer to be in control of the revisions, and keeps it from having to wait for all clients to update until it can drop revisions. |
92 | 84 | ||
93 | ## Query System | 85 | ## Query System |
94 | The query system should allow for efficient retrieval for just the amount of data required by the client. Efficient querying will be supported by the indexes povided by the resources. | 86 | The query system should allow for efficient retrieval for just the amount of data required by the client. Efficient querying will be supported by the indexes provided by the resources. |
95 | 87 | ||
96 | The query always retrieves a set of entities matching the query, while not necessarily all properties of the entity need to be populated. | 88 | The query always retrieves a set of entities matching the query, while not necessarily all properties of the entity need to be populated. |
97 | 89 | ||
@@ -187,12 +179,12 @@ Generic: | |||
187 | ### Lazy Loading ### | 179 | ### Lazy Loading ### |
188 | The system provides property-level lazy loading. This allows i.e. to defer downloading of attachments until the attachments is accessed, at the expense of having to have access to the source (which could be connected via internet). | 180 | The system provides property-level lazy loading. This allows i.e. to defer downloading of attachments until the attachments is accessed, at the expense of having to have access to the source (which could be connected via internet). |
189 | 181 | ||
190 | To achieve this, the query system must check for the availability of all requested properties on all matched entities. If a property is not available the a command should be sent to the synchronizer to retrieve said properties. Once all properties are available the query can complete. | 182 | To achieve this, the query system must check for the availability of all requested properties on all matched entities. If a property is not available, a command must be sent to the synchronizer to retrieve said properties. Once all properties are available the query can complete. |
191 | 183 | ||
192 | Note: We should perhaps define a minimum set of properties that *must* be available. Otherwise local search will not work. On the other hand, if a resource implements server-side search, it may not care if local search doesn't work. | 184 | Note: We should perhaps define a minimum set of properties that *must* be available. Otherwise local search will not work. On the other hand, if a resource implements server-side search, it may not care if local search doesn't work. |
193 | 185 | ||
194 | ### Data streaming ### | 186 | ### Data streaming ### |
195 | Large objects such as attachments should be streamable. An API that allows to retrieve a single property of a defined entity in a streamable fashion is probably enough. | 187 | Large properties such as attachments should be streamable. An API that allows to retrieve a single property of a defined entity in a streamable fashion is probably enough. |
196 | 188 | ||
197 | ### Indexes ### | 189 | ### Indexes ### |
198 | Since only properties of the domain types can be queried, default implementations for commonly used indexes can be provided. These indexes are populated by generic preprocessors that use the domain-type interface to extract properties from individual entites. | 190 | Since only properties of the domain types can be queried, default implementations for commonly used indexes can be provided. These indexes are populated by generic preprocessors that use the domain-type interface to extract properties from individual entites. |
@@ -200,14 +192,5 @@ Since only properties of the domain types can be queried, default implementation | |||
200 | ## Notifications ## | 192 | ## Notifications ## |
201 | A notification mechanism is required to inform clients about changes. Running queries will automatically update the result-set if a notification is received. | 193 | A notification mechanism is required to inform clients about changes. Running queries will automatically update the result-set if a notification is received. |
202 | 194 | ||
203 | A notification constist of: | 195 | Note: A notification could supply a hint on what changed, allowing clients to ignore revisions with irrelevant changes. |
204 | 196 | A running query can do all of that transparently behind the scenes. Note that the hints should indeed only hint what has changed, and not supply the actual changeset. These hints should be tailored to what we see as useful, and must therefore be easy to modify. | |
205 | * The latest revision of the store | ||
206 | * A hint what properties changed | ||
207 | |||
208 | The revision allows the client to only fetch the data that changed. | ||
209 | The hint allows the client to avoid fetching that it's not interested in. | ||
210 | A running query can do all of that transparently behind the scenes. | ||
211 | |||
212 | Note that the hints should indeed only hint what has changed, and not supply the actual changeset. These hints should be tailored to what we see as useful, and must therefore be easy to modify. | ||
213 | |||