pinning

package
v0.0.0-...-2a3d9f8 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package pinning proved local (IPFS daemon) and remote (Pinata) pinning services

Index

Constants

This section is empty.

Variables

View Source
var ErrNoPinningService = fmt.Errorf("no pinning service available")

Functions

func CountPins

func CountPins(chain, status string) uint64

CountPins returns the number of remote piuns

func IsValid

func IsValid(needle string) bool

func ListPins

func ListPins(chain, status string, showProgress, countOnly bool, perPage int, dur time.Duration) ([]string, error)

ListPins pins a file remotely to the pinning service

func PinOneChunk

func PinOneChunk(chain, path string, remote bool) (types.ChunkRecord, types.ChunkRecord, error)

PinOneChunk pins the named chunk given a path to the local and/or remote pinning service

func PinOneFile

func PinOneFile(chain, dbName, fileName string, remote bool) (base.IpfsHash, base.IpfsHash, error)

PinOneFile pins the named database given a path to the local and/or remote pinning services if they are available. If the local service is not available, the remote service is used.

func Unpin

func Unpin(chain string, count bool, sleep float64) error

Types

type Pin

type Pin struct {
	Id           string        `json:"id"`
	IpfsPinHash  base.IpfsHash `json:"ipfs_pin_hash"`
	Size         int           `json:"size"`
	UserId       string        `json:"user_id"`
	DatePinned   string        `json:"date_pinned"`
	DateUnpinned string        `json:"date_unpinned"`
	Metadata     struct {
		Name      string      `json:"name"`
		Keyvalues interface{} `json:"keyvalues"`
	} `json:"metadata"`
	Regions []struct {
		RegionId                string `json:"regionId"`
		CurrentReplicationCount int    `json:"currentReplicationCount"`
		DesiredReplicationCount int    `json:"desiredReplicationCount"`
	} `json:"regions"`
	MimeType      string `json:"mime_type"`
	NumberOfFiles int    `json:"number_of_files"`
}

Pin data type carries information about remote pins

type PinSet

type PinSet struct {
	Count int   `json:"count"`
	Rows  []Pin `json:"rows"`
}

type Service

type Service struct {
	Apikey     string
	Secret     string
	Jwt        string
	HeaderFunc func(s *Service, contentType string) map[string]string
}

func NewService

func NewService(chain string, serviceType ServiceType) (Service, error)

type ServiceType

type ServiceType int
const (
	NoType ServiceType = iota
	Pinata
	Local
)

Jump to

Keyboard shortcuts

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