-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle
NoEntries
cid gracefully and improve cli output
When encountering `NoEntries` CID, do not attempt to traverse it in `provider` CLI. Do not traverse entries of a removal advertisement even if a CID is present. Instead, print useufl messages to signal such cases. Improve output for human readability. Fixes #179
- Loading branch information
Showing
6 changed files
with
179 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package internal | ||
|
||
import "github.com/ipld/go-ipld-prime/traversal/selector" | ||
|
||
type ( | ||
Option func(*options) error | ||
|
||
options struct { | ||
entriesRecurLimit selector.RecursionLimit | ||
topic string | ||
} | ||
) | ||
|
||
func newOptions(o ...Option) (*options, error) { | ||
opts := &options{ | ||
entriesRecurLimit: selector.RecursionLimitNone(), | ||
topic: "/indexer/ingest/mainnet", | ||
} | ||
for _, apply := range o { | ||
if err := apply(opts); err != nil { | ||
return nil, err | ||
} | ||
} | ||
return opts, nil | ||
} | ||
|
||
func WithTopic(topic string) Option { | ||
return func(o *options) error { | ||
o.topic = topic | ||
return nil | ||
} | ||
} | ||
|
||
func WithEntriesRecursionLimit(limit selector.RecursionLimit) Option { | ||
return func(o *options) error { | ||
o.entriesRecurLimit = limit | ||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters