Skip to content

Commit 600d93b

Browse files
committed
Update developer docs
1 parent fe3a55f commit 600d93b

1 file changed

Lines changed: 34 additions & 4 deletions

File tree

docs/developer-guide.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,23 @@ The `Block` class has the following attributes:
192192
| data | bytes | The bytes in the block. |
193193
| used | bitarray | A bit for each byte in the block to indicate whether the byte is used (allocated). |
194194

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+
195212
### Class `Fragment`
196213

197214
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:
202219
| Attribute | Type | Purpose |
203220
|-|-|-|
204221
| 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. |
206223
| 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. |
209240

210-
The relationship between a block and its fragments in shown in the following figure:
211241

212242
### The concept of block ownership
213243

0 commit comments

Comments
 (0)