pinningservice

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(authToken string, svc *PinningService) http.Handler

Types

type AddPinRequest

type AddPinRequest struct {
	CID     string                 `json:"cid"`
	Name    string                 `json:"name"`
	Origins []string               `json:"origins"`
	Meta    map[string]interface{} `json:"meta"`
}

type ListPinsResponse

type ListPinsResponse struct {
	Count   int          `json:"count"`
	Results []*PinStatus `json:"results"`
}

type Pin

type Pin struct {
	CID     string                 `json:"cid"`
	Name    string                 `json:"name"`
	Origins []string               `json:"origins"`
	Meta    map[string]interface{} `json:"meta"`
}

type PinStatus

type PinStatus struct {
	M         sync.Mutex
	RequestID string
	Status    string
	Created   time.Time
	Pin       Pin
	Delegates []string
	Info      map[string]interface{}
}

func (*PinStatus) Clone

func (p *PinStatus) Clone() PinStatus

func (*PinStatus) MarshalJSON

func (p *PinStatus) MarshalJSON() ([]byte, error)

type PinningService

type PinningService struct {

	// PinAdded is a callback that is invoked after a new pin is added via the API.
	PinAdded func(*AddPinRequest, *PinStatus)
	// contains filtered or unexported fields
}

PinningService is a basic pinning service that implements the Remote Pinning API, for testing Kubo's integration with remote pinning services. Pins are not persisted, they are just kept in-memory, and this provides callbacks for controlling the behavior of the pinning service.

func New

func New() *PinningService

Jump to

Keyboard shortcuts

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