Skip to content

Commit

Permalink
Add prune functionality to RecordsDelete section. (#305)
Browse files Browse the repository at this point in the history
* add prune property to RecordsDelete section

* add processing line for prune

* Update RecordsDelete section to include prune property as a required field with appropriate examples

* Update spec/spec.md

Co-authored-by: Ted Thibodeau Jr <[email protected]>

* bad formatting

---------

Co-authored-by: Ted Thibodeau Jr <[email protected]>
  • Loading branch information
LiranCohen and TallTed authored Sep 4, 2024
1 parent 08c081b commit fbde42a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions spec/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -1079,11 +1079,13 @@ TODO
#### `RecordsDelete`

`RecordsDelete` messages are JSON objects that include general [Message Descriptor](#message-descriptors) properties and the following additional properties, which ****must**** be composed as follows:
- The object ****MUST**** contain a `prune` property, and its value ****MUST**** be a boolean indicating whether to purge any children records (`true`) or to only tombstone the deleted record (`false`).

- The message object ****MUST**** contain a `descriptor` property, and its value ****MUST**** be a JSON object composed as follows:
- The object ****MUST**** contain an `interface` property, and its value ****MUST**** be the string `Records`.
- The object ****MUST**** contain a `method` property, and its value ****MUST**** be the string `Delete`.
- The message object ****MUST**** contain a `recordId` property, and its value ****MUST**** be the `recordId` of the logical record the entry corresponds with.
- The object ****MUST**** contain a `recordId` property, and its value ****MUST**** be the `recordId` of the logical record the entry corresponds with.
- The object ****MUST**** contain a `prune` property, and its value ****MUST**** be a boolean that signals whether descendent records should be pruned.
- The object ****MUST**** contain a `messageTimestamp` property, and its value
****MUST**** be of type string property, and its value ****MUST**** be an [[spec:rfc3339]] ISO 8601 timestamp that ****MUST**** be set and interpreted
as the time the `RecordsDelete` record itself was created by the requester.
Expand All @@ -1102,9 +1104,10 @@ TODO
{
"descriptor": {
"recordId": "b65b7r8n7bewv5w6eb7r8n7t78yj7hbevsv567n8r77bv65b7e6vwvd67b6",
"messageTimestamp": 2002-10-02T10:00:00-05:00Z",
"messageTimestamp": "2002-10-02T10:00:00-05:00Z",
"interface": "Records",
"method": "Delete"
"method": "Delete",
"prune": false
}
}
```
Expand All @@ -1116,7 +1119,7 @@ TODO

```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://identity.foundation/dwn/json-schemas/records-delete.json",
"type": "object",
"additionalProperties": false,
Expand All @@ -1126,7 +1129,7 @@ TODO
],
"properties": {
"authorization": {
"$ref": "https://identity.foundation/dwn/json-schemas/general-jws.json"
"$ref": "https://identity.foundation/dwn/json-schemas/authorization-delegated-grant.json"
},
"descriptor": {
"type": "object",
Expand All @@ -1135,7 +1138,8 @@ TODO
"interface",
"method",
"messageTimestamp",
"recordId"
"recordId",
"prune"
],
"properties": {
"interface": {
Expand All @@ -1155,6 +1159,9 @@ TODO
},
"recordId": {
"type": "string"
},
"prune": {
"type": "boolean"
}
}
}
Expand Down Expand Up @@ -1195,6 +1202,7 @@ Retained messages in the Records interface are those that may be stored against
2. Ensure all immutable values from the [_Initial Entry_](#initial-record-entry) remained unchanged if present in the inbound message. If any have been mutated, discard the message and cease processing.
3. Fetch the active `RecordsDelete` entry that exists for the record. If no such entry is present, proceed to the next step. If an active `RecordsDelete` entry for the record is present, the `dateCreated` value of the inbound message ****MUST**** be greater than the active `RecordsDelete` entry; if it is not, discard the message and cease processing.
4. Store the message as the [_Latest Checkpoint Entry_](#latest-records-checkpoint), delete all messages back to the [_Initial Entry_](#initial-record-entry), including their data, and cease processing.
5. If the `descriptor` property `prune` is set to the value `true`, delete all the descendent messages associated with the `recordId`.

### Protocols

Expand Down

0 comments on commit fbde42a

Please sign in to comment.