summaryrefslogtreecommitdiffstats
path: root/docs/design.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/design.md')
-rw-r--r--docs/design.md98
1 files changed, 98 insertions, 0 deletions
diff --git a/docs/design.md b/docs/design.md
new file mode 100644
index 0000000..9b074b1
--- /dev/null
+++ b/docs/design.md
@@ -0,0 +1,98 @@
1# Goals
2## Axioms
31. Personal information is stored in multiple sources (address books, email stores, calendar files, ...)
42. These sources may local, remote or a mix of local and remote
5
6## Requirements
71. Local mirrors of these sources must be available to 1..N local clients simultaneously
82. Local clients must be able to make (or at least request) changes to the data in the local mirrors
93. Local mirrors must be usable without network, even if the source is remote
104. Local mirrors must be able to syncronoize local changes to their sources (local or remote)
115. Local mirrors must be able to syncronize remote changes and propagate those to local clients
126. Content must be searchable by a number of terms (dates, identities, body text ...)
137. This must all run with acceptable performance on a moderate consumer-grade desktop system
14
15Nice to haves:
16
171. As-close-to-zero-copy-as-possible for data
182. Simple change notification semantics
193. Resource-specific syncronization techniques
204. Data agnostic storage
21
22Immediate goals:
23
241. Ease development of new features in existing resources
252. Ease maintenance of existing resources
263. Make adding new resources easy
274. Make adding new types of data or data relations easy
285. Improve performance relative to existing Akonadi implementation
29
30Long-term goals:
31
321. Project view: given a query, show all items in all stores that match that query easily and quickly
33
34Implications of the above:
35
36* Local mirrors must support multi-reader, but are probably best served with single-writer semantics as this simplifies both local change recording as well as remote synchronization by keeping it in one process which can process write requests (local or remote) in sequential fashion.
37* There is no requirement for a central server if the readers can concurrently access the local mirror directly
38* A storage system which requires a schema (e.g. relational databases) are a poor fit given the desire for data agnosticism and low memory copying
39
40# Overview
41
42# Types
43## Domain Type
44The domain types exposed in the public interface.
45
46## 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.
48
49## Steps to add support for new types
50* Add new type to applicationdomaintypes.h and implement `getTypenName()`
51* Implement `TypeImplementation<>` for updating indexes etc.
52* Add a type.fbs default schema for the type
53
54## Steps for adding support for a type to a resource
55* Add a TypeAdaptorFactory, which can either register resource specific mappers, or stick to what the default implementation in TypeImplementation provides
56* Add a TypeFacade that injects the TypeAdaptorFactory in the GenericFacade
57* Register the facade in the resource
58* Add synchronization code that creates the relevant objects
59
60# Change Replay
61The 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.
62
63# Tradeoffs/Design Decisions
64* Key-Value store instead of relational
65 * `+` Schemaless, easier to evolve
66 * `-` No need to fully normalize the data in order to make it queriable. And without full normalization SQL is not really useful and bad performance wise.
67 * `-` We need to maintain our own indexes
68
69* Individual store per resource
70 * Storage format defined by resource individually
71 * `-` Each resource needs to define it's own schema
72 * `+` Resources can adjust storage format to map well on what it has to synchronize
73 * `+` Synchronization state can directly be embedded into messages
74 * `+` Individual resources could switch to another store technology
75 * `+` Easier maintenance
76 * `+` Resource is only responsible for it's own store and doesn't accidentaly break another resources store
77 * `-` Inter`-`resource moves are both more complicated and more expensive from a client perspective
78 * `+` Inter`-`resource moves become simple additions and removals from a resource perspective
79 * `-` No system`-`wide unique id per message (only resource/id tuple identifies a message uniquely)
80 * `+` Stores can work fully concurrently (also for writing)
81
82* Indexes defined and maintained by resources
83 * `-` Relational queries accross resources are expensive (depending on the query perhaps not even feasible)
84 * `-` Each resource needs to define it's own set of indexes
85 * `+` Flexible design as it allows to change indexes on a per resource level
86 * `+` Indexes can be optimized towards resources main usecases
87 * `+` Indexes can be shared with the source (IMAP serverside threading)
88
89* Shared domain types as common interface for client applications
90 * `-` yet another abstraction layer that requires translation to other layers and maintenance
91 * `+` decoupling of domain logic from data access
92 * `+` allows to evolve types according to needs (not coupled to specific applicatoins domain types)
93
94# Risks
95* key-value store does not perform with large amounts of data
96* query performance is not sufficient
97* turnaround time for modifications is too high to feel responsive
98* design turns out similarly complex as akonadi1