application-research / autoretrieve

A server to make GraphSync data accessible on IPFS
22 stars 7 forks source link

Replace FilClient with Lassie RetrievalClient #159

Closed kylehuntsman closed 1 year ago

kylehuntsman commented 1 year ago

This PR implements the Lassie RetrievalClient as a replacement for FilClient. The goal being to replace the instantiation of FilClient with Lassie's RetrievalClient. In doing so, there were a couple updates required to provide some functionality that FilClient provided that the Lassie RetrievalClient did not.

Notable Changes

MinerPeerGetter

In the EstuaryEndpoint and the Config, FilClient was being passed around to use it's api.MinerPeer() function. A MinerPeerGetter abstraction was made to pass around just the MinerPeer() function instead of all of FilClient.

LassiePayChannelManager

One of the goals of Lassie was to remove all dependencies on Lotus and FilClient. In doing so, Lassie's RetrievalClient does not implement a PayChannelManager which is required to make paid retrievals. The LassiePayChannelManager implementation was created to provide PayChannelManager functionality. The implementation of the GetPayChannelWithMinFunds() method and the payChannelApi struct were taken directly from FilClient as they were originally a non exported function and struct.

Removal of LogRetrievals options

This was an early addition to Autoretrieve when we were still running it via EC2 instance and watching terminal logs. This was the last thing using the FilClient client for it's LibP2PTransferManager. After discussing with @elijaharita to make sure Estuary wasn't relying on this logging, it was removed to be able to completely remove the FilClient client.

Copy of FilClient MsgPusher and Keystore

The last two FilClient dependencies that Autoretrieve depended on were the MsgPusher and Keystore. These two structs did not rely on anything else in FilClient. To completely remove the dependency on FilClient, these two structs were copy-pasta'd from FilClient and into Autoretrieve.

codecov-commenter commented 1 year ago

Codecov Report

Base: 5.50% // Head: 5.01% // Decreases project coverage by -0.48% :warning:

Coverage data is based on head (8c9ba11) compared to base (d82b7e2). Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #159 +/- ## ========================================= - Coverage 5.50% 5.01% -0.49% ========================================= Files 10 15 +5 Lines 1527 1675 +148 ========================================= Hits 84 84 - Misses 1438 1586 +148 Partials 5 5 ``` | [Impacted Files](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research) | Coverage Δ | | |---|---|---| | [autoretrieve.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-YXV0b3JldHJpZXZlLmdv) | `0.00% <0.00%> (ø)` | | | [config.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-Y29uZmlnLmdv) | `0.00% <0.00%> (ø)` | | | [endpoint/estuary.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-ZW5kcG9pbnQvZXN0dWFyeS5nbw==) | `0.00% <0.00%> (ø)` | | | [keystore/keystore.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-a2V5c3RvcmUva2V5c3RvcmUuZ28=) | `0.00% <0.00%> (ø)` | | | [main.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-bWFpbi5nbw==) | `1.42% <ø> (+0.03%)` | :arrow_up: | | [messagepusher/msgpusher.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-bWVzc2FnZXB1c2hlci9tc2dwdXNoZXIuZ28=) | `0.00% <0.00%> (ø)` | | | [minerpeergetter/minerpeergetter.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-bWluZXJwZWVyZ2V0dGVyL21pbmVycGVlcmdldHRlci5nbw==) | `0.00% <0.00%> (ø)` | | | [paychannelapi.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-cGF5Y2hhbm5lbGFwaS5nbw==) | `0.00% <0.00%> (ø)` | | | [paychannelmanager/lassiepaychannelmanager.go](https://codecov.io/gh/application-research/autoretrieve/pull/159?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research#diff-cGF5Y2hhbm5lbG1hbmFnZXIvbGFzc2llcGF5Y2hhbm5lbG1hbmFnZXIuZ28=) | `0.00% <0.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=application-research)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

kylehuntsman commented 1 year ago

I can't tell what version of staticcheck GitHub actions are running, but upgrading staticcheck to 2022.1.3 on my local machine fixed the failing check.