Skip to content
Snippets Groups Projects
Select Git revision
  • 3d2a7642d41e2e089e0edd717bc35884bb7a190e
  • master default protected
  • windows-tests-skip-remove
  • fix-cmd-without-daemon
  • move-stats-reprovide-cmd
  • fix/10837-provide-according-to-strategy
  • fix/add-api-v0-log--get-level
  • feat-mainnet-autoconfig
  • sukun/chore-test-go-libp2p
  • telemetry-plugin2
  • spellcheck
  • docs-release-checklist-037
  • release
  • release-v036
  • release-v0.36.0
  • telemetry-plugin
  • reprovide-sweep
  • fix-editor-env-handling
  • fix-flush-files-rm
  • unixfs-percent-encoding-poc
  • fix-flaky-verify-test
  • v0.36.0
  • v0.36.0-rc2
  • v0.36.0-rc1
  • v0.35.0
  • v0.35.0-rc2
  • v0.35.0-rc1
  • v0.34.1
  • v0.34.0
  • v0.34.0-rc2
  • v0.34.0-rc1
  • v0.33.2
  • v0.33.1
  • v0.33.0
  • v0.33.0-rc3
  • v0.33.0-rc2
  • v0.33.0-rc1
  • v0.32.1
  • v0.32.0
  • v0.32.0-rc2
  • v0.32.0-rc1
41 results

fx.go

Blame
  • user avatar
    Gus Eggert authored and Adin Schmahmann committed
    This adds a plugin interface that lets the plugin modify the fx
    options that are passed to fx when the app is initialized. This means
    plugins can inject their own implementations of IPFS interfaces. This
    enables granular customization of go-ipfs behavior by plugins, such
    as:
    
    - Bitswap with custom filters (e.g. for CID blocking) Custom interface
    
    - implementations such as Pinner or DAGService
    
    - Dynamic configuration of libp2p ...
    
    One downside of this is that we're exposing the entire dependency
    graph, init hooks, initialization, etc. to users, so this comes with a
    caveat that we reserve the right to make breaking changes to the graph
    structure and initialization logic (although this historically happens
    rarely). If these things are changed, we should mention them in
    release notes and changelogs though, since they could impact users of
    this plugin interface.
    
    I'm not particularly fond of DI frameworks (and neither are some of
    the folks work on/near go-ipfs), but it seems unlikely that somebody
    will rewrite the dependency wiring and lifecycle hooks of go-ipfs, and
    add dynamic extension points, so this seems like a palatable
    compromise.
    
    There are also problems that we should clean up in how model the
    go-ipfs app in fx, such as:
    
    - We make extensive use of nested fx.Options, which fx itself
    discourages because it "limits the user's ability to customize their
    application". It should be easy to flatten these out into a single
    []fx.Option slice.
    
    - We pass around a list of opaque libp2p opts, which makes it hard to
    customize after-the-fact...we should consider naming each of these
    opts and providing them to fx as proper dependencies, so that they can
    be explicitly overridden.
    
    - We call fx.Invoke() in some places with anonymous functions. We
    should instead only pass exported functions to fx.Invoke(), so that
    they have exported names, which would make it easier to remove/augment
    the invocations that happen when the app is initialized.
    
    These aren't blocking issues, they just make it harder and more
    brittle to customize go-ipfs with this plugin.
    310dca55
    History
    fx.go 719 B