Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPFS Plugin - move config into envs + method options #1060

Merged
merged 22 commits into from
Sep 15, 2022

Conversation

pileks
Copy link
Contributor

@pileks pileks commented Jul 21, 2022

Want to complete before merge:

  • Tests for timeouts
    • IPFS
    • IPFS Resolver
  • Determine what to do regarding IPFS Interface fallbackProviders
    • Should we have fallbackProviders be part of the IPFS interface specification? Seems like the answer would be “no”, because this would mean we are assuming that all implementations of the IPFS plugin should use fallback providers.
    • After discussing with @nerfZael we have decided to, for now, move fallbackProviders into the Options type of the Ipfs interface
  • Determine what to do regarding the naming of skipCheckIfExistsBeforeGetFile in IPFS Resolver Plugin env
    • I’m not a big fan of how I named this, though I can’t come up with a better name… any suggestion is welcome!
  • See if we would maybe want to switch to a providers system instead of having a provider and fallbackProviders
    • Probably not part of this PR, but wanted to see people’s thoughts.
  • Should we include Env in IPFS Interface schema?

@dOrgJelli dOrgJelli changed the base branch from origin to origin-dev July 23, 2022 06:33
@nerfZael nerfZael linked an issue Aug 2, 2022 that may be closed by this pull request
…fig-env

# Conflicts:
#	packages/js/client/src/__tests__/utils/getClientWithEnsAndIpfs.ts
#	packages/js/client/src/default-client-config.ts
#	packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts
#	packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts
krisbitney
krisbitney previously approved these changes Sep 7, 2022
Copy link
Contributor

@krisbitney krisbitney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Please review the comments before merging.

@@ -40,7 +40,8 @@ export class IpfsResolverPlugin extends Module<NoConfig> {
{
cid: `${args.path}/${manifestSearchPattern}`,
options: {
timeout: 5000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By removing the default timeout values, it looks like the timeouts will default to 0. I don't know much about IPFS timeouts. Is 0 unlimited timeout? Is this a good default value? Or should we keep default timeout values somewhere? For example, we could have default timeouts in the ipfs uri resolver like this.env.timeouts?.tryResolveUri ?? 5000, or we could add a default env in the default config. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a zero is an unlimited timeout. We could go with something simple like a single defaultTimeout which we could use for all actions? Seems like an okay solution, and we don't necessarily need to have a full default local env (especially since we wouldn't be defining all env defaults, only certain fields).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me. I don't know the best way to handle this. I just wanted to bring up the question. I think the default behavior should be that it "just works" without having to configure timeouts, and timeout configuration should be optional. If unlimited timeouts won't cause any issues (like an app hanging, waiting for a response that will never come) then that would be fine.

"""
Determines whether the plugin should try to resolve a file (check for its existence) or immediately get the file
"""
skipCheckIfExistsBeforeGetFile: Boolean,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brainstorming other names
skipCheckIfExists
skipFileCheck
skipCheckBeforeGetFile

I think the name you have already is long but clear and informative. If you decide to change it, my favorite alternative is skipCheckIfExists because it matches the timeout name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think skipCheckIfExists sounds best too! Will go with that one.

krisbitney
krisbitney previously approved these changes Sep 7, 2022
@pileks
Copy link
Contributor Author

pileks commented Sep 7, 2022

[x] Should we include Env in IPFS Interface schema?

Including Env in the interface would assume too much regarding the implementation itself - IMO we should not include it in the interface schema.

@dOrgJelli dOrgJelli merged commit c377c85 into origin-dev Sep 15, 2022
@dOrgJelli dOrgJelli deleted the pileks-ipfs-config-env branch April 10, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement comprehensive IPFS URI resolver configuration options
4 participants