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
Analyze the implementation! Only functions that internally implement safeguards against overwriting a key-value pair with _different_ data for the same key are of type (ii.a)!
160
168
161
-
* We document the struct type that is stored, here ResultApproval. If applicable, we also document additional key-value pairs that are persisted as part of this function (here "Index approval by the executed chunk"). Analyze the implementation.
162
-
* With a "CAUTION" statement (here, second bullet point), we document that the function must first attempt to read the current value to avoid overwriting and corrupting existing data. This requires synchronization, and hence locking. We document which locks are required to be held by the caller.
163
-
* The first bullet point explains further application-specific context which node is intended to use this index. You may skip this explanation for the structures you are documenting.
164
-
* We state which errors are expected during normal operations (here storage.ErrDataMismatch) and the condition under which they occur. Analyze the implementation to make the correct statements!
169
+
* We document the struct type that is stored, here `flow.StateCommitment`. If applicable, we also document additional key-value pairs that are persisted as part of this function (here, none). Analyze the implementation.
170
+
* We concisely document by which means the implementation ensures data integrity. For functions of type (ii.a), we typically just attempt to read the value for the respective key. You may adapt the explanation from this example to reflect the specifics of the implementation. Note that the behaviour might be different if a value has previously been stored. Analyze the implementation.
171
+
* With a "CAUTION" statement, we concisely document the requirement that the read for the data integrity check and the subsequent write must happen atomically. This requires synchronization, and hence locking. We document which locks are required to be held by the caller.
172
+
* Analyze the implementation to decide whether additional cautionary statements are required to reduce the probability of accidental bugs.
173
+
* We state which errors are expected during normal operations (here `storage.ErrDataMismatch`) and the condition under which they occur. Analyze the implementation to make the correct statements!
165
174
166
175
167
176
168
177
#### Type (ii.b) functions for writing data
169
178
170
-
As an example for functions of type (i.b), consider `operation.IndexPayloadSeals`:
179
+
As an example for functions of type (ii.b), consider `operation.IndexPayloadSeals`:
171
180
172
181
```golang
173
182
// IndexPayloadSeals indexes the given Seal IDs by the block ID.
0 commit comments