summaryrefslogtreecommitdiffstats
path: root/docs/clientapi.md
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-10-15 16:25:33 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-10-15 16:25:33 +0200
commit7ea7a77aab64ea61d9966caee2b8e7d33d0f5526 (patch)
tree6f568bc3721c33c1d1d1dd7bdcbbd33002cda232 /docs/clientapi.md
parent2101028966186fb0a18acc8fe1d80d710445f00a (diff)
downloadsink-7ea7a77aab64ea61d9966caee2b8e7d33d0f5526.tar.gz
sink-7ea7a77aab64ea61d9966caee2b8e7d33d0f5526.zip
Docs
Diffstat (limited to 'docs/clientapi.md')
-rw-r--r--docs/clientapi.md91
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 @@
1The client API consists of: 1The 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
18A 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.
@@ -24,42 +23,35 @@ The definition of the domain model directly affects:
24 23
25The 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. 24The 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
28This 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. 27This 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
30Items: 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 * Mail
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 * Mail 46 * Relation
40 * Contact 47 * Tag
41
42Collections:
43
44* Collection
45 * Mail Folder
46 * Calendar
47 * Tasklist
48 * Journal
49 * Contact Group
50 * Address Book
51
52Relations:
53
54* Relation
55 * Tag
56 48
57## Store Facade 49## Store Facade
58The store is always accessed through a store specific facade, which hides: 50The 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
65This 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. 57This 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
67Because 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. 59Because 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
70Modifications 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. 62Modifications 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
72The API consists of the following calls: 64The 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
78The 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. 70The 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
80Each modification is associated with a specific revision, which allows the syncronizer to do automatic conflict resolution. 72Each modification is associated with a specific revision, which allows the synchronizer to do automatic conflict resolution.
81 73
82### Conflict Resolution 74### Conflict Resolution
83Conflicts can occur at two points in the client: 75Conflicts 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
88In the first case the client is repsonsible to resolve the conflict, in the latter case it's the syncronizer's responsibility. 80In the first case the client is repsonsible to resolve the conflict, in the latter case it's the synchronizer's responsibility.
89A 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. 81A 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
91This 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. 83This 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
94The 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. 86The 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
96The query always retrieves a set of entities matching the query, while not necessarily all properties of the entity need to be populated. 88The 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 ###
188The 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). 180The 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
190To 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. 182To 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
192Note: 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. 184Note: 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 ###
195Large 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. 187Large 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 ###
198Since 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. 190Since 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 ##
201A notification mechanism is required to inform clients about changes. Running queries will automatically update the result-set if a notification is received. 193A notification mechanism is required to inform clients about changes. Running queries will automatically update the result-set if a notification is received.
202 194
203A notification constist of: 195Note: A notification could supply a hint on what changed, allowing clients to ignore revisions with irrelevant changes.
204 196A 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
208The revision allows the client to only fetch the data that changed.
209The hint allows the client to avoid fetching that it's not interested in.
210A running query can do all of that transparently behind the scenes.
211
212Note 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