Skip to content

Commit f4cd5b3

Browse files
committed
Support named pins [ipfs/kubo#4757]
1 parent b8fd93c commit f4cd5b3

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

simple/reprovide.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ func NewBlockstoreProvider(bstore blocks.Blockstore) KeyChanFunc {
179179
// Pinner interface defines how the simple.Reprovider wants to interact
180180
// with a Pinning service
181181
type Pinner interface {
182-
DirectKeys(ctx context.Context) ([]cid.Cid, error)
183-
RecursiveKeys(ctx context.Context) ([]cid.Cid, error)
182+
PinnedCids(recursive bool) ([]cid.Cid, error)
184183
}
185184

186185
// NewPinnedProvider returns provider supplying pinned keys
@@ -216,21 +215,21 @@ func pinSet(ctx context.Context, pinning Pinner, dag ipld.DAGService, onlyRoots
216215
defer cancel()
217216
defer close(set.New)
218217

219-
dkeys, err := pinning.DirectKeys(ctx)
218+
directCids, err := pinning.PinnedCids(false)
220219
if err != nil {
221-
logR.Errorf("reprovide direct pins: %s", err)
222220
return
223221
}
224-
for _, key := range dkeys {
225-
set.Visitor(ctx)(key)
226-
}
227-
228-
rkeys, err := pinning.RecursiveKeys(ctx)
222+
223+
recursiveCids, err := pinning.PinnedCids(true)
229224
if err != nil {
230-
logR.Errorf("reprovide indirect pins: %s", err)
231225
return
232226
}
233-
for _, key := range rkeys {
227+
228+
for _, key := range directCids {
229+
set.Visitor(ctx)(key)
230+
}
231+
232+
for _, key := range recursiveCids {
234233
if onlyRoots {
235234
set.Visitor(ctx)(key)
236235
} else {

0 commit comments

Comments
 (0)