diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-06-16 20:32:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-06-16 20:32:40 +0000 |
commit | adb7f45adb8eff27515519f05042fc6ec616b38e (patch) | |
tree | 46e25c1b0659d125a2efae82fdcd5404c70ce2ef /src/datastore/datastore.h | |
parent | dc6e9887c24209d0e3dfb6cfb30fbde6ae3b47e9 (diff) | |
download | gnunet-adb7f45adb8eff27515519f05042fc6ec616b38e.tar.gz gnunet-adb7f45adb8eff27515519f05042fc6ec616b38e.zip |
improving datastore API
Diffstat (limited to 'src/datastore/datastore.h')
-rw-r--r-- | src/datastore/datastore.h | 90 |
1 files changed, 85 insertions, 5 deletions
diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h index 9165c8af8..92a2889d8 100644 --- a/src/datastore/datastore.h +++ b/src/datastore/datastore.h | |||
@@ -33,10 +33,10 @@ | |||
33 | * Message from datastore service informing client about | 33 | * Message from datastore service informing client about |
34 | * the current size of the datastore. | 34 | * the current size of the datastore. |
35 | */ | 35 | */ |
36 | struct SizeMessage | 36 | struct ReserveMessage |
37 | { | 37 | { |
38 | /** | 38 | /** |
39 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_SIZE. | 39 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE. |
40 | */ | 40 | */ |
41 | struct GNUNET_MessageHeader header; | 41 | struct GNUNET_MessageHeader header; |
42 | 42 | ||
@@ -46,9 +46,55 @@ struct SizeMessage | |||
46 | uint32_t reserved GNUNET_PACKED; | 46 | uint32_t reserved GNUNET_PACKED; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Size of the datastore in bytes. | 49 | * Number of bytes to reserve. |
50 | */ | 50 | */ |
51 | uint64_t size GNUNET_PACKED; | 51 | uint64_t size GNUNET_PACKED; |
52 | |||
53 | /** | ||
54 | * Number of items to reserve. | ||
55 | */ | ||
56 | uint64_t items GNUNET_PACKED; | ||
57 | }; | ||
58 | |||
59 | |||
60 | /** | ||
61 | * Message from datastore service informing client about | ||
62 | * the success or failure of a requested operation. | ||
63 | * This header is optionally followed by a variable-size, | ||
64 | * 0-terminated error message. | ||
65 | */ | ||
66 | struct StatusMessage | ||
67 | { | ||
68 | /** | ||
69 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS. | ||
70 | */ | ||
71 | struct GNUNET_MessageHeader header; | ||
72 | |||
73 | /** | ||
74 | * Status code. | ||
75 | */ | ||
76 | int32_t status GNUNET_PACKED; | ||
77 | |||
78 | }; | ||
79 | |||
80 | |||
81 | /** | ||
82 | * Message from datastore client informing service that | ||
83 | * the remainder of the reserved bytes can now be released | ||
84 | * for other requests. | ||
85 | */ | ||
86 | struct ReleaseReserveMessage | ||
87 | { | ||
88 | /** | ||
89 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE. | ||
90 | */ | ||
91 | struct GNUNET_MessageHeader header; | ||
92 | |||
93 | /** | ||
94 | * Reservation id. | ||
95 | */ | ||
96 | int32_t rid GNUNET_PACKED; | ||
97 | |||
52 | }; | 98 | }; |
53 | 99 | ||
54 | 100 | ||
@@ -80,6 +126,35 @@ struct GetMessage | |||
80 | 126 | ||
81 | 127 | ||
82 | /** | 128 | /** |
129 | * Message to the datastore service requesting an update | ||
130 | * to the priority or expiration for some content. | ||
131 | */ | ||
132 | struct UpdateMessage | ||
133 | { | ||
134 | /** | ||
135 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE. | ||
136 | */ | ||
137 | struct GNUNET_MessageHeader header; | ||
138 | |||
139 | /** | ||
140 | * Desired priority increase. | ||
141 | */ | ||
142 | int32_t priority GNUNET_PACKED; | ||
143 | |||
144 | /** | ||
145 | * Desired new expiration time. | ||
146 | */ | ||
147 | struct GNUNET_TIME_AbsoluteNBO expiration; | ||
148 | |||
149 | /** | ||
150 | * Unique ID for the content. | ||
151 | */ | ||
152 | uint64_t uid; | ||
153 | |||
154 | }; | ||
155 | |||
156 | |||
157 | /** | ||
83 | * Message transmitting content from or to the datastore | 158 | * Message transmitting content from or to the datastore |
84 | * service. | 159 | * service. |
85 | */ | 160 | */ |
@@ -94,9 +169,9 @@ struct DataMessage | |||
94 | struct GNUNET_MessageHeader header; | 169 | struct GNUNET_MessageHeader header; |
95 | 170 | ||
96 | /** | 171 | /** |
97 | * Always zero. | 172 | * Reservation ID to use; use zero for none. |
98 | */ | 173 | */ |
99 | uint32_t reserved GNUNET_PACKED; | 174 | uint32_t rid GNUNET_PACKED; |
100 | 175 | ||
101 | /** | 176 | /** |
102 | * Number of bytes in the item (NBO). | 177 | * Number of bytes in the item (NBO). |
@@ -117,6 +192,11 @@ struct DataMessage | |||
117 | * Desired anonymity level (NBO), zero for remove. | 192 | * Desired anonymity level (NBO), zero for remove. |
118 | */ | 193 | */ |
119 | uint32_t anonymity GNUNET_PACKED; | 194 | uint32_t anonymity GNUNET_PACKED; |
195 | |||
196 | /** | ||
197 | * Unique ID for the content (can be used for UPDATE). | ||
198 | */ | ||
199 | uint64_t uid; | ||
120 | 200 | ||
121 | /** | 201 | /** |
122 | * Expiration time (NBO); zero for remove. | 202 | * Expiration time (NBO); zero for remove. |