summaryrefslogtreecommitdiffstats
path: root/docs/storage.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/storage.md')
-rw-r--r--docs/storage.md19
1 files changed, 16 insertions, 3 deletions
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