Skip to content

Commit d53886a

Browse files
lidelhsanjuan
authored andcommitted
refactor: rename ContentRouter to DelegatedRouter
- introduce DelegatedRouter interface for delegated routing operations - keep ContentRouter as deprecated alias for backward compatibility - update internal server struct to use DelegatedRouter - clarify interface focuses on querying with IPNS publishing support - note that additional publishing methods may be added via IPIP process this better aligns with the Delegated Routing V1 HTTP API spec and clarifies that this interface handles all routing operations (content, peers, values, DHT), not just content routing
1 parent 384effb commit d53886a

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

routing/http/contentrouter/contentrouter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var logger = logging.Logger("routing/http/contentrouter")
2323

2424
const ttl = 24 * time.Hour
2525

26-
// A Client provides HTTP Content Routing methods. See also [server.ContentRouter].
26+
// A Client provides HTTP Delegated Routing methods. See also [server.DelegatedRouter].
2727
type Client interface {
2828
FindProviders(ctx context.Context, key cid.Cid) (iter.ResultIter[types.Record], error)
2929
ProvideBitswap(ctx context.Context, keys []cid.Cid, ttl time.Duration) (time.Duration, error)

routing/http/server/server.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@ type FindProvidersAsyncResponse struct {
6262
Error error
6363
}
6464

65-
type ContentRouter interface {
65+
// DelegatedRouter provides the Delegated Routing V1 HTTP API for offloading
66+
// routing operations to another process/server.
67+
//
68+
// This interface focuses on querying operations for content providers, peers,
69+
// IPNS records, and DHT routing information. It also supports delegated IPNS
70+
// publishing. Additional publishing methods may be added in the future via the
71+
// IPIP process as the ecosystem evolves and new needs arise.
72+
type DelegatedRouter interface {
6673
// FindProviders searches for peers who are able to provide the given [cid.Cid].
6774
// Limit indicates the maximum amount of results to return; 0 means unbounded.
6875
FindProviders(ctx context.Context, cid cid.Cid, limit int) (iter.ResultIter[types.Record], error)
@@ -94,6 +101,10 @@ type ContentRouter interface {
94101
GetClosestPeers(ctx context.Context, peerID, closerThan peer.ID, count int) (iter.ResultIter[*types.PeerRecord], error)
95102
}
96103

104+
// ContentRouter is deprecated, use DelegatedRouter instead.
105+
// Deprecated: use DelegatedRouter. ContentRouter will be removed in a future version.
106+
type ContentRouter = DelegatedRouter
107+
97108
// Deprecated: protocol-agnostic provide is being worked on in [IPIP-378]:
98109
//
99110
// [IPIP-378]: https://github.com/ipfs/specs/pull/378
@@ -205,7 +216,7 @@ func Handler(svc ContentRouter, opts ...Option) http.Handler {
205216
var handlerCount atomic.Int32
206217

207218
type server struct {
208-
svc ContentRouter
219+
svc DelegatedRouter
209220
disableNDJSON bool
210221
recordsLimit int
211222
streamingRecordsLimit int

0 commit comments

Comments
 (0)