kubo/config
Marcin Rataj cec7432043
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Check / lint (push) Has been cancelled
Docker Check / build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
feat: fast provide support in dag import (#11058)
* fix(add): respect Provide config in fast-provide-root

fast-provide-root should honor the same config settings as the regular
provide system:
- skip when Provide.Enabled is false
- skip when Provide.DHT.Interval is 0
- respect Provide.Strategy (all/pinned/roots/mfs/combinations)

This ensures fast-provide only runs when appropriate based on user
configuration and the nature of the content being added (pinned vs
unpinned, added to MFS or not).

* feat(config): options to adjust global defaults

Add Import.FastProvideRoot and Import.FastProvideWait configuration options
to control default behavior of fast-provide-root and fast-provide-wait flags
in ipfs add command. Users can now set global defaults in config while
maintaining per-command flag overrides.

- Add Import.FastProvideRoot (default: true)
- Add Import.FastProvideWait (default: false)
- Add ResolveBoolFromConfig helper for config resolution
- Update docs with configuration details
- Add log-based tests verifying actual behavior

* refactor: extract fast-provide logic into reusable functions

Extract fast-provide logic from add command into reusable components:
- Add config.ShouldProvideForStrategy helper for strategy matching
- Add ExecuteFastProvide function reusable across add and dag import commands
- Move DefaultFastProvideTimeout constant to config/provide.go
- Simplify add.go from 72 lines to 6 lines for fast-provide
- Move fast-provide tests to dedicated TestAddFastProvide function

Benefits:
- cleaner API: callers only pass content characteristics
- all strategy logic centralized in one place
- better separation of concerns
- easier to add fast-provide to other commands in future

* feat(dag): add fast-provide support for dag import

Adds --fast-provide-root and --fast-provide-wait flags to `ipfs dag import`,
mirroring the fast-provide functionality available in `ipfs add`.

Changes:
- Add --fast-provide-root and --fast-provide-wait flags to dag import command
- Implement fast-provide logic for all root CIDs in imported CAR files
- Works even when --pin-roots=false (strategy checked internally)
- Share ExecuteFastProvide implementation between add and dag import
- Move ExecuteFastProvide to cmdenv package to avoid import cycles
- Add logging when fast-provide is disabled
- Conditional error handling: return error when wait=true, warn when wait=false
- Update config docs to mention both ipfs add and ipfs dag import
- Update changelog to use "provide" terminology and include dag import examples
- Add comprehensive test coverage (TestDagImportFastProvide with 6 test cases)

The fast-provide feature allows immediate DHT announcement of root CIDs
for faster content discovery, bypassing the regular background queue.

* docs: improve fast-provide documentation

Refine documentation to better explain fast-provide and sweep provider working
together, and highlight the performance improvement.

Changelog:
- add fast-provide to sweep provider features list
- explain performance improvement: root CIDs discoverable in <1s vs 30+ seconds
- note this uses optimistic DHT operations (faster with sweep provider)
- simplify examples, point to --help for details

Config docs:
- fix: --fast-provide-roots should be --fast-provide-root (singular)
- clarify Import.FastProvideRoot focuses on root CIDs while sweep handles all blocks
- simplify Import.FastProvideWait description

Command help:
- ipfs add: explain sweep provider context upfront
- ipfs dag import: add fast-provide explanation section
- both explain the split: fast-provide for roots, sweep for all blocks

* test: add tests for ShouldProvideForStrategy

add tests covering all provide strategy combinations with focus on
bitflag OR logic (the else-if bug fix). organized by behavior:
- all strategy always provides
- single strategies match only their flag
- combined strategies use OR logic
- zero strategy never provides

* refactor: error cmd on error and wait=true

change ExecuteFastProvide() to return error, enabling proper error
propagation when --fast-provide-wait=true. in sync mode, provide
failures now error the command as expected. in async mode (default),
always returns nil with errors logged in background goroutine.

also remove duplicate ExecuteFastProvide() from provide.go (75 lines),
keeping single implementation in cmdenv/env.go for reuse across add
and dag import commands.

call sites simplified:
- add.go: check and propagate error from ExecuteFastProvide
- dag/import.go: return error from ForEach callback, remove confusing
  conditional error handling

semantics:
- precondition skips (DHT unavailable, etc): return nil (not failure)
- async mode (wait=false): return nil, log errors in goroutine
- sync mode (wait=true): return wrapped error on provide failure
2025-11-14 21:06:25 -08:00
..
serialize refactor: using error is instead of == (#10093) 2023-08-22 14:53:29 +00:00
addresses.go Fix typos 2022-03-18 00:58:36 +01:00
api_test.go feat(rpc): Opt-in HTTP RPC API Authorization (#10218) 2023-11-17 01:29:29 +01:00
api.go feat(rpc): Opt-in HTTP RPC API Authorization (#10218) 2023-11-17 01:29:29 +01:00
autoconf_client.go feat(config): AutoConf with "auto" placeholders (#10883) 2025-08-20 05:59:11 +02:00
autoconf_test.go feat(config): AutoConf with "auto" placeholders (#10883) 2025-08-20 05:59:11 +02:00
autoconf.go feat(config): AutoConf with "auto" placeholders (#10883) 2025-08-20 05:59:11 +02:00
autonat.go feat: run AutoNAT V2 service in addition to V1 (#10468) 2024-08-06 21:51:45 +02:00
autotls.go feat(AutoTLS): enabled by default with 1h RegistrationDelay (#10724) 2025-02-25 22:25:58 +01:00
bitswap.go feat: opt-in http retrieval client (#10772) 2025-05-06 19:06:40 +02:00
bootstrap_peers_test.go feat(config): AutoConf with "auto" placeholders (#10883) 2025-08-20 05:59:11 +02:00
bootstrap_peers.go feat(config): AutoConf with "auto" placeholders (#10883) 2025-08-20 05:59:11 +02:00
config_test.go refactor(config): migration 17-to-18 to unify Provider/Reprovider into Provide.DHT (#10951) 2025-09-18 22:17:43 +02:00
config.go refactor(config): migration 17-to-18 to unify Provider/Reprovider into Provide.DHT (#10951) 2025-09-18 22:17:43 +02:00
datastore.go feat: expose BlockKeyCacheSize and enable WriteThrough datastore options (#10614) 2024-12-19 23:12:05 +00:00
discovery.go config: remove all options that are marked as REMOVED 2024-01-22 15:33:27 +01:00
dns.go feat(config): AutoConf with "auto" placeholders (#10883) 2025-08-20 05:59:11 +02:00
experiments.go fix(config): wire up Provider.Enabled flag (#10804) 2025-05-15 19:19:18 +02:00
gateway.go feat(config): optional Gateway.MaxRangeRequestFileSize (#10997) 2025-11-11 18:54:43 -08:00
http_retrieval.go feat: HTTP retrieval enabled by default (#10836) 2025-06-17 01:48:46 +02:00
identity.go style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
import_test.go feat(config): validate Import config at daemon startup (#10957) 2025-09-09 01:53:18 +02:00
import.go feat: fast provide support in dag import (#11058) 2025-11-14 21:06:25 -08:00
init_test.go chore: clean migration 2023-11-29 12:29:59 +01:00
init.go refactor(config): migration 17-to-18 to unify Provider/Reprovider into Provide.DHT (#10951) 2025-09-18 22:17:43 +02:00
internal.go fix(mfs): add soft limit for --flush=false (#10985) 2025-09-26 01:25:23 +02:00
ipns.go feat(config): AutoConf with "auto" placeholders (#10883) 2025-08-20 05:59:11 +02:00
migration_test.go go-ipfs-config: Removed Peers from migration config 2021-05-03 09:08:16 -07:00
migration.go feat(config): AutoConf with "auto" placeholders (#10883) 2025-08-20 05:59:11 +02:00
mounts.go feat(fuse): Expose MFS as FUSE mount point (#10781) 2025-05-06 21:55:53 +02:00
peering.go chore: bump go-libp2p v0.22.0 & go1.18&go1.19 2022-09-09 17:09:38 +02:00
plugins.go fix: disable telemetry in test profile (#10931) 2025-08-24 14:30:35 +02:00
profile.go feat(config): optional Gateway.MaxRangeRequestFileSize (#10997) 2025-11-11 18:54:43 -08:00
provide_test.go feat: fast provide support in dag import (#11058) 2025-11-14 21:06:25 -08:00
provide.go feat: fast provide support in dag import (#11058) 2025-11-14 21:06:25 -08:00
provider.go refactor(config): migration 17-to-18 to unify Provider/Reprovider into Provide.DHT (#10951) 2025-09-18 22:17:43 +02:00
pubsub.go feat: Pubsub.SeenMessagesStrategy (#9543) 2023-01-27 00:24:35 +01:00
remotepin.go go-ipfs-config: add support for pinning mfs (#116) 2021-01-28 18:05:47 -05:00
reprovider.go refactor(config): migration 17-to-18 to unify Provider/Reprovider into Provide.DHT (#10951) 2025-09-18 22:17:43 +02:00
routing_test.go style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
routing.go fix: allow custom http provide when libp2p node is offline (#10974) 2025-09-19 18:55:42 +02:00
swarm.go feat(config): optional Gateway.MaxRangeRequestFileSize (#10997) 2025-11-11 18:54:43 -08:00
types_test.go feat(config): optional Gateway.MaxRangeRequestFileSize (#10997) 2025-11-11 18:54:43 -08:00
types.go feat: fast provide support in dag import (#11058) 2025-11-14 21:06:25 -08:00
version.go feat: Add CI for Spell Checking (#10637) 2025-01-30 17:50:51 +01:00