ethersphere / swarm

Swarm: Censorship resistant storage and communication infrastructure for a truly sovereign digital society
https://swarm.ethereum.org/
GNU Lesser General Public License v3.0
488 stars 110 forks source link

remove redundancy in target extraction from publisher #2181

Open mortelli opened 4 years ago

mortelli commented 4 years ago

As it is, the content recovery hook is working out targets—based on the publisher in the manifest—for each chunk that needs to be repaired.

This is inefficient, as the owner will be determined (plus its feed queried) each time a chunk for the same publisher is attempted to be recovered.

Rather than a feeds handler, the recovery hook should use a struct which gets and sets known targets for any given publisher.

This struct would:

In this manner, the calculations from publisher to targets will be done only once per publisher.

With each subsequent call, the hook would then consult this struct to get the target list and avoid repeated operations & queries.

As a result, the injection of the publisher in the context should be replaced with the injection of the targets instead.


Additionally, check if lookup.NoClue could be replaced with something smarter once we know when the last update happened for a feed.