1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-12-12 19:59:03 +08:00
Commit Graph

160 Commits

Author SHA1 Message Date
Marcin Rataj
71e883440e refactor(config): migration 17-to-18 to unify Provider/Reprovider into Provide.DHT (#10951)
* refactor: consolidate Provider/Reprovider into unified Provide config

- merge Provider and Reprovider configs into single Provide section
- add fs-repo-17-to-18 migration for config consolidation
- improve migration ergonomics with common package utilities
- convert deprecated "flat" strategy to "all" during migration
- improve Provide docs

* docs: add total_provide_count metric guidance

- document how to monitor provide success rates via prometheus metrics
- add performance comparison section to changelog
- explain how to evaluate sweep vs legacy provider effectiveness

* fix: add OpenTelemetry meter provider for metrics

- set up meter provider with Prometheus exporter in daemon
- enables metrics from external libs like go-libp2p-kad-dht
- fixes missing total_provide_count_total when SweepEnabled=true
- update docs to reflect actual metric names

---------

Co-authored-by: gammazero <11790789+gammazero@users.noreply.github.com>
Co-authored-by: guillaumemichel <guillaume@michel.id>
Co-authored-by: Daniel Norman <1992255+2color@users.noreply.github.com>
Co-authored-by: Hector Sanjuan <code@hector.link>
2025-09-18 22:17:43 +02:00
Guillaume Michel
006f9dc704 feat: opt-in new Sweep provide system (#10834)
* reprovide sweep draft

* update reprovider dep

* go mod tidy

* fix provider type

* change router type

* dual reprovider

* revert to provider.System

* back to start

* SweepingReprovider test

* fix nil pointer deref

* noop provider for nil dht

* disabled initial network estimation

* another iteration

* suppress missing self addrs err

* silence empty rt err on lan dht

* comments

* new attempt at integrating

* reverting changes in core/node/libp2p/routing.go

* removing SweepingProvider

* make reprovider optional

* add noop reprovider

* update KeyChanFunc type alias

* restore boxo KeyChanFunc

* fix missing KeyChanFunc

* test(sharness): PARALLEL=1 and timeout 30m

running sequentially to see where timeout occurs

* initialize MHStore

* revert workflow debug

* config

* config docs

* merged IpfsNode provider and reprovider

* move Provider interface to from kad-dht to node

* moved Provider interface from kad-dht to kubo/core/node

* mod_tidy

* Add Clear to Provider interface

* use latest kad-dht commit

* make linter happy

* updated boxo provide interface

* boxo PR fix

* using latest kad-dht commit

* use latest boxo release

* fix fx

* fx cyclic deps

* fix merge issues

* extended tests

* don't provide LAN DHT

* docs

* restore dual dht provider

* don't start provider before it is online

* address linter

* dual/provider fix

* add delay in provider tests for dht bootstrap

* add OfflineDelay parameter to config

* remove increase number of workers in test

* improved keystore gc process

* fix: replace incorrect logger import in coreapi

replaced github.com/labstack/gommon/log with the standard
github.com/ipfs/go-log/v2 logger used throughout kubo.
removed unused labstack dependency from go.mod files.

* fix: remove duplicate WithDefault call in provider config

* fix: use correct option method for burst workers

* fix: improve error messages for experimental sweeping provider

updated error messages to clearly indicate when commands are unavailable
due to experimental sweeping provider being enabled via Reprovider.Sweep.Enabled=true

* docs: remove obsolete KeyStoreGCInterval config

removed from config.md as option no longer exists (removed in b540fba1a)
updated keystore description to reflect gc happens at reprovide interval

* docs: add TODO placeholder changelog for experimental sweeping DHT provider

using v0.38-TODO.md name to avoid merge conflicts with master branch
and allow CI tests to run. will be renamed to v0.38.md once config
migration is added to the PR

* fix: provideKeysRec go routine

* clear keystore on close

* fix: datastore prefix

* fix: improve error handling in provideKeysRec

- close errCh channel to distinguish between nil and pending errors
- check for pending errors when provided.New closes
- handle context cancellation during error send
- prevent race condition where errors could be silently lost

this ensures DAG walk errors are always propagated correctly

* address gammazero's review

* rename BurstProvider to LegacyProvider

* use latest provider/keystore

* boxo: make mfs StartProviding async

* bump boxo

* chore: update boxo to f2b4e12fb9a8ac138ccb82aae3b51ec51d9f631c

- updated boxo dependency to specified commit
- updated go.mod and go.sum files across all modules

* use latest kad-dht/boxo

* Buffered SweepingProvider wrapper

* use latest kad-dht commit

* allow no DHT router

* use latest kad-dht & boxo

---------

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: gammazero <11790789+gammazero@users.noreply.github.com>
2025-09-18 17:22:04 +02:00
Hector Sanjuan
846e219ead feat: Reprovider.Strategy: rename "flat" to "all" (#10928)
* Reprovider strategy: rename "flat" to "all".

Value "flat" now parses to "all". Behaviour from "all" removed.

Fixes #10864 which has detailed explanation.

* core/node/provider.go: remove unused function mfsRootProvider

It was used in the "all" strategy.

* docs: improve reprovider.strategy=all changelog framing

- highlight memory efficiency improvements
- clarify this removes v0.28 workaround
- update config.md memory requirements
- fix announce-on profile typo

* feat: deprecate Reprovider.Strategy=flat

- add deprecation warning in daemon.go when flat strategy is detected
- document that flat is deprecated in ParseReproviderStrategy comment
- add explicit test case for flat -> all mapping
- flat continues to work but users are warned to migrate to all

---------

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2025-08-21 19:02:29 +02:00
Hector Sanjuan
a673c2ec95 fix: Provide according to Reprovider.Strategy (#10886)
* Provide according to strategy

Updates boxo to a version with the changes from https://github.com/ipfs/boxo/pull/976, which decentralize the providing responsibilities (from a central providing.Exchange to blockstore, pinner, mfs).

The changes consist in initializing the Pinner, MFS and the blockstore with the provider.System, which is created first.

Since the provider.System is created first, the reproviding KeyChanFunc is set
later when we can create it once we have the Pinner, MFS and the blockstore.

Some additional work applies to the Add() workflow. Normally, blocks would get provided at the Blockstore or the Pinner, but when adding blocks AND a "pinned" strategy is used, the blockstore does not provide, and the
pinner does not traverse the DAG (and thus doesn't provide either), so we need to provide directly from the Adder. This is resolved by wrapping the DAGService in a "providingDAGService" which provides every added block, when using the "pinned" strategy.

`ipfs --offline add` when the ONLINE daemon is running will now announce blocks per the chosen strategy, where before it did not announce them. This is documented in the changelog. A couple of releases ago, adding with `ipfs --offline add` was faster, but this is no longer the case so we are not incurring in any penalties by sticking to the fact that the daemon is online and has a providing strategy that we follow.

Co-authored-by: gammazero <11790789+gammazero@users.noreply.github.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2025-08-08 10:56:44 +02:00
Kapil Sareen
10abb9073d feat(add): add support for naming pinned CIDs (#10877)
* feat(add): add support for naming pinned CID

Signed-off-by: kapil <kapilsareen584@gmail.com>

* fix(add): no double pinning and simplify pin-name

- modify PinRoot to accept name parameter, eliminating double pinning
- remove automatic filename fallback logic for cleaner behavior
- only create named pins when explicitly requested via --pin-name=value
- replace NoPinName constant with idiomatic empty string literals
- Update help text and tests to reflect explicit-only behavior

* docs: changelog

* chore: lint

* test: negative case for empty pin-name

* chore: gofmt

---------

Signed-off-by: kapil <kapilsareen584@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2025-08-06 02:16:16 +02:00
Hector Sanjuan
6b55e64918 feat(config): ipfs add and Import options for controling UnixFS DAG Width (#10774)
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2025-04-15 22:56:38 +02:00
Hector Sanjuan
519ae27dce feat: expose BlockKeyCacheSize and enable WriteThrough datastore options (#10614)
* feat: expose BlockKeyCacheSize and enable WriteThrough when bloom filter disabled
* import/config: add BatchMaxSize and BatchMaxNodes
* config: make BlockKeyCacheSize an OptionalInteger
* config: add and wire datastore.WriteThrough option
* config: omitempty on BlockKeyCacheSize
* changelog: rewrite entry about new options for the datastore
* config: add docs for BatchMaxNodes and BatchMaxSize
* config: make WriteThrough an optional Flag
* changelog: improve description of new datastore/import options
* refactor: DefaultWriteThrough as bool
* chore: boxo v0.26.0
* docs: config and changelog fixes
2024-12-19 23:12:05 +00:00
Andrew Gillis
7c49860061 Upgrade to Boxo v0.26.0 (#10631)
* Upgrade to Boxo v0.26.0
* Update docs/changelogs/v0.33.md
2024-12-19 13:54:02 -08:00
Andi
642e58ef3b chore: use errors.New to replace fmt.Errorf with no parameters (#10617) 2024-12-10 13:50:35 -08:00
Andrew Gillis
224d6a3ba4 refactor(cmds): do not return errors embedded in result type (#10527)
incl. https://github.com/ipfs/boxo/pull/738
2024-12-03 20:15:33 +01:00
Hector Sanjuan
37c5060742 Update to boxo with refactored providerQueryManager. (#10595) 2024-11-26 03:34:06 -08:00
Andrew Gillis
263edb251e feat: Support storing UnixFS 1.5 Mode and ModTime (#10478)
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2024-08-21 02:02:46 +02:00
Michael Muré
a3483e352e coreapi/unixfs: don't create an additional IpfsNode for --only-hash 2024-03-19 12:37:23 +01:00
Henrique Dias
58c29399cf chore: clean migration 2023-11-29 12:29:59 +01:00
Jorropo
a5668d22ba chore: update boxo for structification of ImmutablePath 2023-10-09 09:44:39 +02:00
Henrique Dias
a7c6518497 feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
Kay
f12b372af9 style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
Jorropo
3ab1086f71 chore: migrate go-libipfs to boxo
Resolves #9677, #9676, #9675, #9736
2023-03-28 22:05:25 -04:00
Henrique Dias
255e64e49e chore: migrate from go-ipfs-files to go-libipfs/files (#9535) 2023-01-13 14:27:03 +01:00
Henrique Dias
7bdb341132 feat: fast directory listings with DAG Size column (#9481)
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-12-12 21:45:13 +01:00
Rod Vagg
cb1ba70a9b fix: handle new ProtoNode errors 2022-12-02 10:16:10 +11:00
Gus Eggert
e550d9e476 ci: add stylecheck to golangci-lint (#9334) 2022-10-06 10:18:40 -04:00
Marcin Rataj
82467bc936 refactor: rename to kubo 2022-07-06 18:40:37 +02:00
Lucas Molas
25cc85fa93 feat(gateway): Gateway.FastDirIndexThreshold (#8853)
* fix(core/gateway): option to limit directory size listing

* feat(gw): HTMLDirListingLimit

This is alternative take on the way we limit the HTML listing output.
Instead of a hard cut-off, we list up to HTMLDirListingLimit.
When a directory has more items than HTMLDirListingLimit we show
additional header and footer informing user that only $HTMLDirListingLimit
items are listed. This is a better UX.

* fix: 0 disables Gateway.HTMLDirListingLimit

* refactor: Gateway.FastDirIndexThreshold

see explainer in docs/config.md

* refactor: prealoc slices

* docs: Gateway.FastDirIndexThreshold

* refactor: core/corehttp/gateway_handler.go

https://github.com/ipfs/go-ipfs/pull/8853#discussion_r851437088

* docs: apply suggestions from code review

Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
2022-04-28 19:36:57 +02:00
SukkaW
4f7d4bcc05 docs: replace all git.io links with their actual URLs 2022-04-28 18:06:08 +02:00
Gus Eggert
f855bfe6ef feat: add basic gateway tracing (#8595)
* add deprecation warning when tracer plugins are loaded
* add response format attribute to span in gateway handler
* add note about tracing's experimental status in godoc
* add nil check for TTL when adding name span attrs
* add basic sharness test for integration with otel collector
* add nil check in UnixFSAPI.processLink
* test: sharness check all json objs for swarm span
* add env var docs to docs/environment-variables.md
* chore: pin the otel collector version
* add tracing spans per response type (#8841)
* docs: tracing with jaeger-ui

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-04 19:24:05 +02:00
Adin Schmahmann
52c177ced9 feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563)
* plumb through go-datastore context changes

* update go-libp2p to v0.16.0
* use LIBP2P_TCP_REUSEPORT instead of IPFS_REUSEPORT
* use relay config
* making deprecation notice match the go-ipfs-config key
* docs(config): circuit relay v2
* docs(config): fix links and headers
* feat(config): Internal.Libp2pForceReachability

This switches to config that supports setting and reading
Internal.Libp2pForceReachability OptionalString flag

* use configuration option for static relays

* chore: go-ipfs-config v0.18.0

https://github.com/ipfs/go-ipfs-config/releases/tag/v0.18.0

* feat: circuit v1 migration prompt when Swarm.EnableRelayHop is set (#8559)
* exit when Swarm.EnableRelayHop is set
* docs: Experimental.ShardingEnabled migration

This ensures existing users of global sharding experiment get notified
that the flag no longer works + that autosharding happens automatically.

For people who NEED to keep the old behavior (eg. have no time to
migrate today) there is a note about restoring it with
`UnixFSShardingSizeThreshold`.

* chore: add dag-jose code to the cid command output

* add support for setting automatic unixfs sharding threshold from the config
* test: have tests use low cutoff for sharding to mimic old behavior
* test: change error message to match the current error
* test: Add automatic sharding/unsharding tests (#8547)
* test: refactored naming in the sharding sharness tests to make more sense

* ci: set interop test executor to convenience image for Go1.16 + Node
* ci: use interop master

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Gus Eggert <gus@gus.dev>
Co-authored-by: Lucas Molas <schomatis@gmail.com>
2021-11-29 19:58:05 +01:00
Steven Allen
9f03f1ff14 fix(unixfs): check for errors before dereferencing the link
If there's an error, the link will be nil, and this will panic.
2021-10-12 12:39:39 -07:00
Adin Schmahmann
3a0d0e817a support async datastores 2019-12-19 00:59:31 -05:00
Adin Schmahmann
0906d7f3b1 fix (pinning): pin ls traverses all indirect pins. pin ls pin type precedence change - a direct/recursive pin is now labeled as such even if also indirectly pinned. 2019-12-02 13:53:14 -05:00
Hucg
bc8a329a74 Update unixfs.go
use sync.Once instead
2019-11-18 17:26:14 +08:00
hucg
6a171a0b61 fix issue 6760, adding with hash-only, high CPU usage. 2019-11-15 14:58:59 +08:00
Steven Allen
ec748a7b5b Merge pull request #6747 from ipfs/fix/only-hash-leak
fix(coreapi/add): close the fake repo used when adding with hash-only
2019-11-08 10:30:59 +00:00
hucg
6155fd17c1 fix bug 6748
ipfs add whit only hash, don't need to announce cid to other peer
2019-11-08 15:12:42 +08:00
Steven Allen
e9e32f8ac6 fix(coreapi/add): close the fake repo used when adding with hash-only
fixes #6744
2019-11-04 18:05:35 +00:00
Steven Allen
5f64b270f8 cmdkit -> cmds
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2019-05-10 23:00:20 -07:00
Łukasz Magiera
a54b64bede coreiface: updates for path name refactor
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-04-17 12:03:37 -07:00
Łukasz Magiera
667b7f9927 coreiface: updates for moving path to subpackage
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-04-17 12:03:37 -07:00
Steven Allen
470d6ba7a8 commands(add): fix ipfs add --nocopy URL without enabling the filestore
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2019-03-29 12:12:38 +00:00
Łukasz Magiera
95906d3201 coreapi: remove Unixfs.Wrap
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-03-25 19:00:51 +01:00
Łukasz Magiera
964ef0b2e7 unixfs add: remove StdinName
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-03-21 19:20:24 +01:00
Łukasz Magiera
c5b81e918f coreapi: remove hidden file handling in add
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-03-21 19:17:58 +01:00
Łukasz Magiera
b8bc26a700 WIP almost working ipfs add
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-03-21 19:17:58 +01:00
Łukasz Magiera
332d4aeab1 coreapi unixfs: change Wrap logic to make more sense
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-03-21 19:17:58 +01:00
Michael Avila
a9b6534687 Provide root node immediately when add and pin add
License: MIT
Signed-off-by: Michael Avila <davidmichaelavila@gmail.com>
2019-03-08 14:27:43 -08:00
Steven Allen
c6d85c2a7d ls: resolve symlinks
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2019-03-07 11:10:34 -08:00
Steven Allen
81621396a0 fix ls command to use the new coreinterface types
See: https://github.com/ipfs/interface-go-ipfs-core/pull/14

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2019-03-07 11:10:34 -08:00
Jakub Sztandera
42e191c017 gx: unrewrite
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2019-03-05 18:33:56 +01:00
Steven Allen
f227862e88 gx: update go-ipfs-cmds, go-bitswap, go-libp2p-kad-dht, and go-mplex
Fixes the latest batch of bugs found in RC testing.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2019-02-27 12:39:24 -08:00
Hector Sanjuan
6972a9aa4d Gx Bubble. libp2p-6.0.38
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-02-27 01:10:59 +00:00