orbitdb-archive / orbit-db-store

Base class for orbit-db data stores
MIT License
40 stars 22 forks source link

Filter heads by invocation of "access.canAppend" during a loading #101

Open pashoo2 opened 3 years ago

pashoo2 commented 3 years ago

https://github.com/orbitdb/orbit-db-store/blob/2ebc0c2cbec70cc98e7cd0f45edc077853098f72/src/Store.js#L241

Why don't to filter the heads as it's already implemented within the "sync" method, that is called during synchronization with another peer?

https://github.com/orbitdb/orbit-db-store/blob/2ebc0c2cbec70cc98e7cd0f45edc077853098f72/src/Store.js#L295

aphelionz commented 3 years ago

It seems like it could be a valuable update but I would need to know the performance tradeoff, since usually a cryptographic key verification needs to take place within canAppend.

@tabcat can you help @pashoo2 with benchmarking when you get a chance?

tabcat commented 3 years ago

Trying to understand what the change is being suggested here...

@pashoo2 you are saying we could use the same code that loads entries also to sync entries?

pashoo2 commented 3 years ago

@aphelionz @tabcat sorry i've seen the mention today. I meant that there is a code that apply filters to heads when a syncronization with another peer is performing, but i suppose it should be done also when reading heads from a local presistant storage to memory. I don't remember the exact case, but it seems not neccessary to read such heads for consistency of a local statw with another peer sync logic