Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Propose TP25 - Snapshots for DWeb Nodes #9

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Conversation

thehenrytsai
Copy link
Member

No description provided.

@thehenrytsai thehenrytsai marked this pull request as draft June 6, 2023 17:55
@thehenrytsai thehenrytsai changed the title Propose TP24 - Snapshots for DWeb Nodes Propose TP25 - Snapshots for DWeb Nodes Jun 7, 2023

This means the snapshot is taken at a global scope. ie. any message not included in the snapshot is deleted.

1. `"scope": "protocols/<protocolUri>"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for later discussion: The way you set this up looks like we can pretty easily define a snapshot scope that encompasses PermissionGrants. There are some difficulties with delegated grants+revokes that would be solved with this hierarchical snapshot scoping.

const newerSnapshots = getNewerSnapshots(incomingSnapshot.timestamp);
for (const newerSnapshot of newerSnapshots) {
if (newerSnapshot.scope.isSuperSetOf(incomingSnapshot.scope)) {
return; // no need to process this snapshot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarity: isSuperSetOf() should just be newerSnapshot.scope.startsWith(incomingSnapshot.scope), right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes conceptually... but there might be complication depending on if there is the trailing slash /.

e.g. 'aaaaaa/bbb'.startsWith('aaa') would return an unwanted true...

tp025/README.md Outdated

// computes the complete inclusion list at the scope of thd given snapshot
function computeInclusionList(currentSnapshot) {
// NOTE: immediate descending snapshots do NOT have to have direct child scope
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this means. If immediate descending snapshots don't need to be have direct child scope, what does "immediate descending" mean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please help me word it better! If you look like the example snapshots of a DWN above, photos snapshot is an immediate descending snapshot of social-media protocol snapshot, but it is not a direct "child".

tp025/README.md Outdated

Messages under a particular protocol.

1. `"scope": "protocols/<protocolUri>/<protocolPath>"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since protocol paths contain / as a delimiter, is it gonna be annoying to parse if we reuse / as a delimiter? It's definitely possible, not hard, just might be weird if we ever, for example, add a child scope below <protocolPath>.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is convenient right now that it is the last segment. Will be the complete opposite of convenient if we ever add descendants below protocolPaths. Actually, after reading your TP on permission, I am thinking it's probably good to append recordId as all leaf nodes in the structure....


1. It does not make sense functionally and even potentially dangerous even to allow scopes that span across both protocol-authorized messages and protocol-less message.

1. It does not seem logical to permit the deletion of a snapshot once it is created for authorization purposes. If the snapshot is deleted, the DWeb Node will no longer be able to utilize the deleted snapshot to prevent unauthorized access.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice, does that mean a DWN could "un-snapshot" some messages by creating a new SnapshotsCreate with an empty list of CIDs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one creates a SnapshotCreate with empty list of CIDs, I think the expressed intent is to blow away everything under the specified scope.

"un-snapshot" would be SnapshotsDelete in mind, just calling out here it's immediate implication (amongst other complications also), so I don't waste time designing/documenting it if we don't even want it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants