#316 Allow Peers to Store History

Merged
dan merged 1 commits from peer_history into master 2 months ago
sarah commented 2 months ago
There is no content yet.
dan was assigned by sarah 2 months ago
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/769
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/771
dan requested changes 2 months ago
storage/v1/profile_store.go
@@ -258,6 +260,10 @@ func (ps *ProfileStoreV1) load() error {
contact.Authorization = model.AuthApproved
}
}

dan commented 2 months ago

like above, prolly better to check at load if the attribute is set or not and set it accordingly instead of the double initializer for it you have in the event handler below. Also since this is a required attribute, should also be added to cwtchPeer.AddContact, line 194 has the attributes being initialized.

then we can create a stream store only where needed, then the event handler can just reach for the stream store and if there is one, use it, if not, not use it, simplifying that code a bunch in the event handler

BUT it does mean then doing processing of the SavePeerHistory event and creating or deleting stream stores there.
but that’s actually good as right now we don’t capture that, so we never delete history when its changed? which means when someone turns it off, the existing history sits there, forever being loaded, but never updated, which isn’t great, so that event does need handling regardless

also prolly want a ps.save after the loop to capture and save any new defaults added

like above, prolly better to check at load if the attribute is set or not and set it accordingly instead of the double initializer for it you have in the event handler below. Also since this is a required attribute, should also be added to cwtchPeer.AddContact, line 194 has the attributes being initialized. then we can create a stream store only where needed, then the event handler can just reach for the stream store and if there is one, use it, if not, not use it, simplifying that code a bunch in the event handler BUT it does mean then doing processing of the SavePeerHistory event and creating or deleting stream stores there. but that's actually good as right now we don't capture that, so we never delete history when its changed? which means when someone turns it off, the existing history sits there, forever being loaded, but never updated, which isn't great, so that event does need handling regardless also prolly want a ps.save after the loop to capture and save any new defaults added
storage/v1/profile_store.go
@@ -346,0 +368,4 @@
ss.Write(message)
}
}
case event.DontSaveHistoryDefault:
dan commented 2 months ago

very rust of you? :P
but we can just have hte one empty default

very rust of you? :P but we can just have hte one empty default
storage/v1/profile_store.go
@@ -346,0 +376,4 @@
}
}
}
ps.save()
dan commented 2 months ago

shouldn’t need this if we aren’t setting a default here

shouldn't need this if we aren't setting a default here
storage/v1/profile_store.go
@@ -346,0 +382,4 @@
}
case event.NewMessageFromPeer:
contact, exists := ps.profile.GetContact(ev.Data[event.RemotePeer])
if exists {
dan commented 2 months ago

also this is copy/pasted, should be pulled out into a function instead

also this is copy/pasted, should be pulled out into a function instead
sarah requested review from dan 2 months ago
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/773
Drone Build Status: failure https://build.openprivacy.ca/cwtch.im/cwtch/775
sarah changed title from WIP: Allow Peers to Store History to Allow Peers to Store History 2 months ago
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/777
dan merged commit 2c13feb71e into master 2 months ago

Reviewers

dan was requested for review 2 months ago
The pull request has been merged as 2c13feb71e.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.