orbitdb / field-manual

The Offical User's Guide to OrbitDB
208 stars 43 forks source link

do client need to replicate whole gbs of db ? #75

Open yashwanth2804 opened 6 years ago

yashwanth2804 commented 6 years ago

does replicating bulk dbs resources and time consuming, anyway can we limit upto few records
thanks

RichardLitt commented 6 years ago

Good question, @yashwanth2804.

Let's make sure to add an answer to the docs when someone provides one.

mistakia commented 6 years ago

I don't believe there is currently a way to limit replication. You may want to explore modeling your data differently (on orbit-db or even ipfs).

Generally speaking, when modeling data for OrbitDB you should strive to "partition" it where it makes sense - i.e. along access rights. As an example, in a twitter-like application, each user should have their own database instead of a global "tweets" database for everyone.

yashwanth2804 commented 6 years ago

thanks for the reply, I understood your explanation.say if i follow Justin X (random 🌟) on Twitter, where he makes tons of tweets a day.if i am gonna subscribe him after 2 yrs. As your mentioned pubsub model ,i subscribed for him so will i get megatons of tweets from his 1st twt. i may limit in ui but how can i limit in loading those tweets.

please correct me if i am off the topic or missing something.

mistakia commented 6 years ago

If you have the tweets locally - you can limit how many entries are loaded by sending in an amount to db.load(amount):

const db = await orbitdb.feed("<justin's tweet OrbitDB address>")
await db.load(10)
// db now contains the 10 latest entries/tweets

If you don't have the data locally, I'm not sure there's a way to limit syncing to only the 10 latest entries.

cristiano-belloni commented 5 years ago

If you can't limit how many data you can replicate, it means that malicious peers could trick you to "follow" them, then just flood you with data. Which might be a huge problem in 99% of the use cases.

aphelionz commented 4 years ago

Moving to Field Manual to discuss further