quiet icon indicating copy to clipboard operation
quiet copied to clipboard

QSS: Load channels, messages, certificates into OrbitDB during LAUNCH_COMMUNITY

Open leblowl opened this issue 10 months ago • 1 comments

Add functions in the storage service to support this and call these functions from launchCommunity.

On the backend launchCommunity connects to the storage service and downloads the JSON object from /invite. Once the object has been retrieved, it can then use data from the invite property to connect to peers via p2p. We can also store the data in the invite property (psk, ownerOrbitDbIdentity, peerList) in the Community model when creating the community. Then we can load the CommunityMetadata into OrbitDB. See https://github.com/TryQuiet/quiet/pull/2190 for how to do this. Then we can load the Certificates. Then we can load Channels. Then we can load the Messages. Loading the messages depends on having the channel DBs created, which is async, so perhaps we can wait on the CHANNEL_REPLICATED/CREATED event before loading messages.

And I think that should be it. I think the ‘replicated’ event fires when loading into OrbitDB, so all other event-based actions should work as if we had connected to a peer and downloaded this data.

We will need to add functions in communityMetadata.store, certificates.store, etc. for loading entries into the OrbitDB databases.

leblowl avatar Apr 04 '24 17:04 leblowl

Not directly connected but rather pre-work: https://github.com/TryQuiet/quiet/pull/2493 Reason: we use similar or identical methods across all our stores so I introduced simple abstractions. This structure will ensure that we will implement all necessary functionalities in our stores. Next step would be to add something like loadData to abstract base class.

EmiM avatar May 10 '24 12:05 EmiM