Documentation
¶
Index ¶
- Variables
- func NewRetryHTTPClient(maxRetries uint) *http.Client
- type BoxoClientConfig
- type BoxoClientOption
- type BoxoPinningClient
- func (c *BoxoPinningClient) Add(ctx context.Context, cid cid.Cid, ...) (go_pinning_service_http_client.PinStatusGetter, error)
- func (c *BoxoPinningClient) DeleteByID(ctx context.Context, pinID string) error
- func (c *BoxoPinningClient) GetStatusByID(ctx context.Context, pinID string) (go_pinning_service_http_client.PinStatusGetter, error)
- func (c *BoxoPinningClient) LsSync(ctx context.Context, opts ...go_pinning_service_http_client.LsOption) ([]go_pinning_service_http_client.PinStatusGetter, error)
- func (c *BoxoPinningClient) Replace(ctx context.Context, pinID string, cid cid.Cid, ...) (go_pinning_service_http_client.PinStatusGetter, error)
- type InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) Show(text ...string) (string, error)
- func (p *InteractiveContinuePrinter) WithDefaultText(text string) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithDefaultValue(value string) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithDefaultValueIndex(value int) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithDelimiter(delimiter string) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithHandles(handles []string) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithOptions(options []string) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithOptionsStyle(style *pterm.Style) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithShowShortHandles(b ...bool) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithSuffixStyle(style *pterm.Style) *InteractiveContinuePrinter
- func (p *InteractiveContinuePrinter) WithTextStyle(style *pterm.Style) *InteractiveContinuePrinter
- type PinningClient
- type PinningClientFactory
- type RetryConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultInteractiveContinue = &InteractiveContinuePrinter{ DefaultValueIndex: 0, DefaultText: "Do you want to continue", TextStyle: &pterm.ThemeDefault.PrimaryStyle, Options: []string{"yes", "no", "all", "cancel"}, OptionsStyle: &pterm.ThemeDefault.SuccessMessageStyle, SuffixStyle: &pterm.ThemeDefault.SecondaryStyle, Delimiter: ": ", }
DefaultInteractiveContinue is the default InteractiveContinue printer.
Functions ¶
func NewRetryHTTPClient ¶
NewRetryHTTPClient creates an HTTP client with retry logic for network failures. It retries on temporary network errors (timeouts, connection refused, DNS errors, etc.) with exponential backoff. Non-retryable errors (4xx client errors) are not retried.
Types ¶
type BoxoClientConfig ¶
BoxoClientConfig holds configuration for BoxoPinningClient retry behavior.
func DefaultBoxoClientConfig ¶
func DefaultBoxoClientConfig() BoxoClientConfig
DefaultBoxoClientConfig returns the default retry configuration.
type BoxoClientOption ¶
type BoxoClientOption func(*BoxoClientConfig)
BoxoClientOption configures a BoxoPinningClient.
func WithMaxDelay ¶
func WithMaxDelay(maxDelay time.Duration) BoxoClientOption
WithMaxDelay sets the maximum delay between retries.
func WithMaxJitter ¶
func WithMaxJitter(maxJitter time.Duration) BoxoClientOption
WithMaxJitter sets the maximum jitter to add to delays.
func WithMaxRetries ¶
func WithMaxRetries(maxRetries uint) BoxoClientOption
WithMaxRetries sets the maximum number of retry attempts.
type BoxoPinningClient ¶
type BoxoPinningClient struct {
// contains filtered or unexported fields
}
BoxoPinningClient wraps the boxo pinning service HTTP client.
func (*BoxoPinningClient) Add ¶
func (c *BoxoPinningClient) Add(ctx context.Context, cid cid.Cid, opts ...go_pinning_service_http_client.AddOption) (go_pinning_service_http_client.PinStatusGetter, error)
Add implements PinningClient.Add.
func (*BoxoPinningClient) DeleteByID ¶
func (c *BoxoPinningClient) DeleteByID(ctx context.Context, pinID string) error
DeleteByID implements PinningClient.DeleteByID.
func (*BoxoPinningClient) GetStatusByID ¶
func (c *BoxoPinningClient) GetStatusByID(ctx context.Context, pinID string) (go_pinning_service_http_client.PinStatusGetter, error)
GetStatusByID implements PinningClient.GetStatusByID.
func (*BoxoPinningClient) LsSync ¶
func (c *BoxoPinningClient) LsSync(ctx context.Context, opts ...go_pinning_service_http_client.LsOption) ([]go_pinning_service_http_client.PinStatusGetter, error)
LsSync implements PinningClient.LsSync.
func (*BoxoPinningClient) Replace ¶
func (c *BoxoPinningClient) Replace(ctx context.Context, pinID string, cid cid.Cid, opts ...go_pinning_service_http_client.AddOption) (go_pinning_service_http_client.PinStatusGetter, error)
Replace implements PinningClient.Replace.
type InteractiveContinuePrinter ¶
type InteractiveContinuePrinter struct {
DefaultValueIndex int
DefaultText string
Delimiter string
TextStyle *pterm.Style
Options []string
OptionsStyle *pterm.Style
Handles []string
ShowShortHandles bool
SuffixStyle *pterm.Style
}
InteractiveContinuePrinter is a printer for interactive continue prompts. This is a copy of PTerm's InteractiveContinuePrinter that handles Ctrl+C gracefully.
func (*InteractiveContinuePrinter) Show ¶
func (p *InteractiveContinuePrinter) Show(text ...string) (string, error)
Show shows the continue prompt.
func (*InteractiveContinuePrinter) WithDefaultText ¶
func (p *InteractiveContinuePrinter) WithDefaultText(text string) *InteractiveContinuePrinter
WithDefaultText sets the default text.
func (*InteractiveContinuePrinter) WithDefaultValue ¶
func (p *InteractiveContinuePrinter) WithDefaultValue(value string) *InteractiveContinuePrinter
WithDefaultValue sets the default value.
func (*InteractiveContinuePrinter) WithDefaultValueIndex ¶
func (p *InteractiveContinuePrinter) WithDefaultValueIndex(value int) *InteractiveContinuePrinter
WithDefaultValueIndex sets the default value.
func (*InteractiveContinuePrinter) WithDelimiter ¶
func (p *InteractiveContinuePrinter) WithDelimiter(delimiter string) *InteractiveContinuePrinter
WithDelimiter sets the delimiter.
func (*InteractiveContinuePrinter) WithHandles ¶
func (p *InteractiveContinuePrinter) WithHandles(handles []string) *InteractiveContinuePrinter
WithHandles allows you to customize the short handles.
func (*InteractiveContinuePrinter) WithOptions ¶
func (p *InteractiveContinuePrinter) WithOptions(options []string) *InteractiveContinuePrinter
WithOptions sets the options.
func (*InteractiveContinuePrinter) WithOptionsStyle ¶
func (p *InteractiveContinuePrinter) WithOptionsStyle(style *pterm.Style) *InteractiveContinuePrinter
WithOptionsStyle sets the continue style.
func (*InteractiveContinuePrinter) WithShowShortHandles ¶
func (p *InteractiveContinuePrinter) WithShowShortHandles(b ...bool) *InteractiveContinuePrinter
WithShowShortHandles will set ShowShortHandles to true.
func (*InteractiveContinuePrinter) WithSuffixStyle ¶
func (p *InteractiveContinuePrinter) WithSuffixStyle(style *pterm.Style) *InteractiveContinuePrinter
WithSuffixStyle sets the suffix style.
func (*InteractiveContinuePrinter) WithTextStyle ¶
func (p *InteractiveContinuePrinter) WithTextStyle(style *pterm.Style) *InteractiveContinuePrinter
WithTextStyle sets the text style.
type PinningClient ¶
type PinningClient interface {
// Add pins a CID to the pinning service with optional options.
Add(ctx context.Context, cid cid.Cid, opts ...go_pinning_service_http_client.AddOption) (go_pinning_service_http_client.PinStatusGetter, error)
// LsSync lists pins synchronously with optional filters.
LsSync(ctx context.Context, opts ...go_pinning_service_http_client.LsOption) ([]go_pinning_service_http_client.PinStatusGetter, error)
// GetStatusByID retrieves pin status by request ID.
GetStatusByID(ctx context.Context, pinID string) (go_pinning_service_http_client.PinStatusGetter, error)
// DeleteByID removes a pin by request ID.
DeleteByID(ctx context.Context, pinID string) error
// Replace replaces an existing pin with a new CID and options.
Replace(ctx context.Context, pinID string, cid cid.Cid, opts ...go_pinning_service_http_client.AddOption) (go_pinning_service_http_client.PinStatusGetter, error)
}
PinningClient defines the interface for IPFS pinning service client operations.
func NewBoxoPinningClient ¶
func NewBoxoPinningClient(endpoint, authToken string, opts ...BoxoClientOption) PinningClient
NewBoxoPinningClient creates a new BoxoPinningClient wrapping the boxo client. Uses default retry configuration unless options are provided.
type PinningClientFactory ¶
type PinningClientFactory func(endpoint, authToken string) PinningClient
PinningClientFactory creates a PinningClient with the given endpoint and auth token.
type RetryConfig ¶
RetryConfig holds configuration for retry behavior.
func DefaultRetryConfig ¶
func DefaultRetryConfig() RetryConfig
DefaultRetryConfig returns default retry configuration.