diff options
Diffstat (limited to 'docs/storage.md')
-rw-r--r-- | docs/storage.md | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/docs/storage.md b/docs/storage.md index 4852131..afd55d8 100644 --- a/docs/storage.md +++ b/docs/storage.md | |||
@@ -1,17 +1,3 @@ | |||
1 | ## Store access | ||
2 | Access to the entities happens through a well defined interface that defines a property-map for each supported domain type. A property map could look like: | ||
3 | ``` | ||
4 | Event { | ||
5 | startDate: QDateTime | ||
6 | subject: QString | ||
7 | ... | ||
8 | } | ||
9 | ``` | ||
10 | |||
11 | This property map can be freely extended with new properties for various features. It shouldn't adhere to any external specification and exists solely to define how to access the data. | ||
12 | |||
13 | Clients will map these properties to the values of their domain object implementations, and resources will map the properties to the values in their buffers. | ||
14 | |||
15 | ## Storage Model | 1 | ## Storage Model |
16 | The storage model is simple: | 2 | The storage model is simple: |
17 | ``` | 3 | ``` |
@@ -42,8 +28,7 @@ Each entity can be as normalized/denormalized as useful. It is not necessary to | |||
42 | 28 | ||
43 | Denormalized: | 29 | Denormalized: |
44 | 30 | ||
45 | * priority is that mime message stays intact (signatures/encryption) | 31 | * priority is that the mime message stays intact (signatures/encryption) |
46 | * could we still provide a streaming api for attachments? | ||
47 | 32 | ||
48 | ``` | 33 | ``` |
49 | Mail { | 34 | Mail { |
@@ -55,7 +40,7 @@ Mail { | |||
55 | Normalized: | 40 | Normalized: |
56 | 41 | ||
57 | * priority is that we can access individual members efficiently. | 42 | * priority is that we can access individual members efficiently. |
58 | * we don't care about exact reproducability of e.g. ical file | 43 | * we don't care about exact reproducability of e.g. an ical file |
59 | ``` | 44 | ``` |
60 | Event { | 45 | Event { |
61 | id | 46 | id |
@@ -101,7 +86,7 @@ The resource can be effectively removed from disk (besides configuration), | |||
101 | by deleting the directories matching `$RESOURCE_IDENTIFIER*` and everything they contain. | 86 | by deleting the directories matching `$RESOURCE_IDENTIFIER*` and everything they contain. |
102 | 87 | ||
103 | #### Design Considerations | 88 | #### Design Considerations |
104 | * The stores are split by buffertype, so a full scan (which is done by type), doesn't require filtering by type first. The downside is that an additional lookup is required to get from revision to the data. | 89 | The stores are split by buffertype, so a full scan (which is done by type), doesn't require filtering by type first. The downside is that an additional lookup is required to get from revision to the data. |
105 | 90 | ||
106 | ### Revisions | 91 | ### Revisions |
107 | Every operation (create/delete/modify), leads to a new revision. The revision is an ever increasing number for the complete store. | 92 | Every operation (create/delete/modify), leads to a new revision. The revision is an ever increasing number for the complete store. |
@@ -167,6 +152,8 @@ Using regular files as the interface has the advantages: | |||
167 | The copy is necessary to guarantee that the file remains for the client/resource even if the resource removes the file on it's side as part of a sync. | 152 | The copy is necessary to guarantee that the file remains for the client/resource even if the resource removes the file on it's side as part of a sync. |
168 | The copy could be optimized by using hardlinks, which is not a portable solution though. For some next-gen copy-on-write filesystems copying is a very cheap operation. | 153 | The copy could be optimized by using hardlinks, which is not a portable solution though. For some next-gen copy-on-write filesystems copying is a very cheap operation. |
169 | 154 | ||
155 | A downside of having a file based design is that it's not possible to directly stream from a remote resource i.e. into the application memory, it always has to go via a file. | ||
156 | |||
170 | ## Database choice | 157 | ## Database choice |
171 | By design we're interested in key-value stores or perhaps document databases. This is because a fixed schema is not useful for this design, which makes | 158 | By design we're interested in key-value stores or perhaps document databases. This is because a fixed schema is not useful for this design, which makes |
172 | SQL not very useful (it would just be a very slow key-value store). While document databases would allow for indexes on certain properties (which is something we need), we did not yet find any contenders that looked like they would be useful for this system. | 159 | SQL not very useful (it would just be a very slow key-value store). While document databases would allow for indexes on certain properties (which is something we need), we did not yet find any contenders that looked like they would be useful for this system. |