You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer-guide.md
+34-4Lines changed: 34 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -192,6 +192,23 @@ The `Block` class has the following attributes:
192
192
| data | bytes | The bytes in the block. |
193
193
| used | bitarray | A bit for each byte in the block to indicate whether the byte is used (allocated). |
194
194
195
+
### Class `Pool` ###
196
+
197
+
The class `Pool` represents a pool of Pre-Shared Random Data (PSRD) from which the DSKE code
198
+
make do allocations (see class `Allocation` below).
199
+
Once data is allocated, it is zeroed out in the `Pool`.
200
+
Each pool has an owner (local or remote); the concept of pool ownership is explained below.
201
+
The pools implemented as a sequence of PSRD blocks (`Block` objects).
202
+
203
+
The `Pool` class has the following attributes:
204
+
205
+
| Attribute | Type | Purpose |
206
+
|-|-|-|
207
+
| name | str | The name of the pool (for debugging purposes). |
208
+
| blocks | List[Block]| A list of blocks in the pool. |
209
+
| owner | local or remote | The owner of the pool (explained below). |
210
+
211
+
195
212
### Class `Fragment`
196
213
197
214
The class `Fragment` represents a contiguous sequence of bytes within a block that have been
@@ -202,12 +219,25 @@ The `Fragment` class has the following attributes:
202
219
| Attribute | Type | Purpose |
203
220
|-|-|-|
204
221
| block | Block | A reference to the block from which the fragment was allocated. |
205
-
|start_byte| int | The index of the byte within the block for the first byte in the fragment. |
222
+
|start| int | The index of the byte within the block for the first byte in the fragment. |
206
223
| size | int | The number of bytes in the fragment. |
207
-
| value | bytes | A copy of the bytes in the block that have been allocated to the fragment. |
208
-
| consumed | bool | True if the bytes in the fragment has been consumed. False if the bytes in the fragment have only been allocated and not yet consumed. |
224
+
| data | bytes | A copy of the bytes in the block that have been allocated to the fragment. |
225
+
226
+
### Class `Allocation` ###
227
+
228
+
The class `Allocation` represents an allocation of bytes from a PSRD pool (`Pool` object).
229
+
It is implemented as a sequence of fragments (`Fragment` objects).
230
+
This is needed because the number of bytes that need to be allocated may not be available
231
+
as a contiguous sequence of unused (non-allocated) bytes in any block in the pool.
232
+
In that case, the allocation algorithm gathers the needed number of bytes using multiple
233
+
fragments, each fragment representing a contiguous sequence of bytes.
234
+
235
+
the `Allocation` class has the following attributes:
236
+
237
+
| Attribute | Type | Purpose |
238
+
|-|-|-|
239
+
| fragments | List[Fragment]| The list of fragments that the allocation is composed of. |
209
240
210
-
The relationship between a block and its fragments in shown in the following figure:
0 commit comments