Skip to content

Commit

Permalink
chore: update to boxo without goprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Oct 31, 2024
1 parent 1ca0ae0 commit c151b4a
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 12 deletions.
27 changes: 27 additions & 0 deletions core/node/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,33 @@ func (lp *lcProcess) Append(f goprocess.ProcessFunc) {
})
}

type lcStartStop struct {
fx.In

LC fx.Lifecycle
}

// Append runx CtxFunc, and appends it to the lifecycle
func (lcss *lcStartStop) Append(f func() func()) {
// Hooks are guaranteed to run in sequence. If a hook fails to start, its
// OnStop won't be executed.
var stopFunc func()

lcss.LC.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
stopFunc = f()
return nil
},
OnStop: func(ctx context.Context) error {
if stopFunc == nil { // Theoretically this shouldn't ever happen
return errors.New("lcStatStop: stopFunc was nil")
}
stopFunc()
return nil
},
})
}

func maybeProvide(opt interface{}, enable bool) fx.Option {
if enable {
return fx.Provide(opt)
Expand Down
4 changes: 2 additions & 2 deletions core/node/ipns.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func Namesys(cacheSize int, cacheMaxTTL time.Duration) func(rt irouting.ProvideM
}

// IpnsRepublisher runs new IPNS republisher service
func IpnsRepublisher(repubPeriod time.Duration, recordLifetime time.Duration) func(lcProcess, namesys.NameSystem, repo.Repo, crypto.PrivKey) error {
return func(lc lcProcess, namesys namesys.NameSystem, repo repo.Repo, privKey crypto.PrivKey) error {
func IpnsRepublisher(repubPeriod time.Duration, recordLifetime time.Duration) func(lcStartStop, namesys.NameSystem, repo.Repo, crypto.PrivKey) error {
return func(lc lcStartStop, namesys namesys.NameSystem, repo repo.Repo, privKey crypto.PrivKey) error {
repub := republisher.NewRepublisher(namesys, repo.Datastore(), privKey, repo.Keystore())

if repubPeriod != 0 {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/kubo-as-a-library/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go 1.23
replace github.com/ipfs/kubo => ./../../..

require (
github.com/ipfs/boxo v0.24.2
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333
github.com/ipfs/kubo v0.0.0-00010101000000-000000000000
github.com/libp2p/go-libp2p v0.37.0
github.com/multiformats/go-multiaddr v0.13.0
Expand Down
5 changes: 2 additions & 3 deletions docs/examples/kubo-as-a-library/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c h1:7Uy
github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c/go.mod h1:6EekK/jo+TynwSE/ZOiOJd4eEvRXoavEC3vquKtv4yI=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/boxo v0.24.2 h1:feLM6DY6CNI0uSG3TvP/Hv4PdM/fsekjqSCqKtifF0E=
github.com/ipfs/boxo v0.24.2/go.mod h1:Dt3TJjMZtF2QksMv2LC8pQlG9VQUiSV2DsHQzvDiroo=
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333 h1:2OvIEEviF9OEqnEp4khojrAR+cxn2OVpx9VAZNJV9jc=
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333/go.mod h1:cDmTBd0IEM6UuOIZGXfxhumKlGr5CK/kfh+2Ka662lc=
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
github.com/ipfs/go-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ=
Expand Down Expand Up @@ -406,7 +406,6 @@ github.com/ipshipyard/p2p-forge v0.0.0-20241028231853-f599f4803109 h1:Od9XhliY3E
github.com/ipshipyard/p2p-forge v0.0.0-20241028231853-f599f4803109/go.mod h1:taPeh3PDSO8Ual0/N2tIOAUXPV8gZoPF3uPXoUyiq14=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc=
github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk=
github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/hashicorp/go-version v1.7.0
github.com/ipfs-shipyard/nopfs v0.0.12
github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c
github.com/ipfs/boxo v0.24.2
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333
github.com/ipfs/go-block-format v0.2.0
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-cidutil v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c h1:7Uy
github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c/go.mod h1:6EekK/jo+TynwSE/ZOiOJd4eEvRXoavEC3vquKtv4yI=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/boxo v0.24.2 h1:feLM6DY6CNI0uSG3TvP/Hv4PdM/fsekjqSCqKtifF0E=
github.com/ipfs/boxo v0.24.2/go.mod h1:Dt3TJjMZtF2QksMv2LC8pQlG9VQUiSV2DsHQzvDiroo=
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333 h1:2OvIEEviF9OEqnEp4khojrAR+cxn2OVpx9VAZNJV9jc=
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333/go.mod h1:cDmTBd0IEM6UuOIZGXfxhumKlGr5CK/kfh+2Ka662lc=
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
github.com/ipfs/go-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ=
Expand Down
2 changes: 1 addition & 1 deletion test/dependencies/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ require (
github.com/huin/goupnp v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/boxo v0.24.2 // indirect
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333 // indirect
github.com/ipfs/go-block-format v0.2.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions test/dependencies/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/boxo v0.24.2 h1:feLM6DY6CNI0uSG3TvP/Hv4PdM/fsekjqSCqKtifF0E=
github.com/ipfs/boxo v0.24.2/go.mod h1:Dt3TJjMZtF2QksMv2LC8pQlG9VQUiSV2DsHQzvDiroo=
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333 h1:2OvIEEviF9OEqnEp4khojrAR+cxn2OVpx9VAZNJV9jc=
github.com/ipfs/boxo v0.24.3-0.20241030212043-d15e9528c333/go.mod h1:cDmTBd0IEM6UuOIZGXfxhumKlGr5CK/kfh+2Ka662lc=
github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs=
github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM=
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
Expand Down

0 comments on commit c151b4a

Please sign in to comment.