orbitdb-archive / orbit-db-store

Base class for orbit-db data stores

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Best Practices for Restoring a Store + Pinning Store Data

frankfka opened this issue · comments

Are there best practices / docs for how we can restore store data from data?

For example, if a peer has no local copy and attempts to restore data from a centralized database, what happens during replication? Does this mean that we will have duplicate documents if another peer comes online and attempts to replicate data?

On a related topic, how would we "pin" a store to a pinning service and retrieve the pinned data?

Hello,

I know this is a bit late, but hopefully it will still be useful to you!

I think part of your question really gets at the core of what Orbit-DB does differently from centralised databases. In Orbit-DB, there is no centralised database; every copy, on every peer, is just as "valid" as the others and can equally contribute to sharing the data in a peer-to-peer manner (though only authorised peers are allowed to add new entries to the database). So if a peer with no local copy of a database attempts to open the database, it will sync operations (entries) on this database from all peers with the same database open. This will form the new, local copy of the database on the new peer and will then also be able to contribute to any newer peers that join the network.

Regarding pinning, as far as I know this is still a matter that requires some progress. Third-party IPFS pinning services so far do not support Orbit-DB out of the box. Of course, you could always manualy pin all of your Orbit-DB database's operations to IPFS. But since databases sync through PubSub, you will always need an actual instance of your database open in Orbit-DB on a peer somewhere for new peers to sync with. I'd say the best solution would be to run an instance of Orbit-DB on a server somewhere and configure it to open (pin) the database(s) you're interested in guaranteeing 24/7 availability for. See orbitdb/orbitdb#941 for a more detailed discussion.

Hope this helps!