internal

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRetryHTTPClient

func NewRetryHTTPClient(maxRetries uint) *http.Client

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

type BoxoClientConfig struct {
	MaxRetries uint
	MaxDelay   time.Duration
	MaxJitter  time.Duration
}

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

Add implements PinningClient.Add.

func (*BoxoPinningClient) DeleteByID

func (c *BoxoPinningClient) DeleteByID(ctx context.Context, pinID string) error

DeleteByID implements PinningClient.DeleteByID.

func (*BoxoPinningClient) GetStatusByID

GetStatusByID implements PinningClient.GetStatusByID.

func (*BoxoPinningClient) LsSync

LsSync implements PinningClient.LsSync.

func (*BoxoPinningClient) Replace

Replace implements PinningClient.Replace.

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

type RetryConfig struct {
	MaxRetries uint
	MaxDelay   time.Duration
}

RetryConfig holds configuration for retry behavior.

func DefaultRetryConfig

func DefaultRetryConfig() RetryConfig

DefaultRetryConfig returns default retry configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL