pinner

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0, MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColDir string = "dir"
)

Variables

View Source
var DefaultOpts = &PinManagerOpts{
	MaxActivePerUser: 15,
	QueueDataDir:     "/tmp/",
}

Functions

This section is empty.

Types

type EstuaryPinManager added in v0.3.0

type EstuaryPinManager struct {
	*PinManager
	// contains filtered or unexported fields
}

func (*EstuaryPinManager) GetPin added in v0.4.0

GetPinStatus returns the status of a pin operation

func (*EstuaryPinManager) PinCid added in v0.4.0

func (pm *EstuaryPinManager) PinCid(eCtx echo.Context, param PinCidParam) (*IpfsPinStatusResponse, error)

PinCidAndQueue adds a cid to the pin queue, and pins it if possible

func (*EstuaryPinManager) PinContent added in v0.4.0

func (m *EstuaryPinManager) PinContent(ctx context.Context, user uint, obj cid.Cid, filename string, cols []*collections.CollectionRef, origins []*peer.AddrInfo, replaceID uint, meta map[string]interface{}, replication int, makeDeal bool) (*IpfsPinStatusResponse, error)

func (*EstuaryPinManager) PinDelegatesForContent added in v0.4.0

func (m *EstuaryPinManager) PinDelegatesForContent(cont util.Content) []string

func (*EstuaryPinManager) PinStatus added in v0.4.0

func (m *EstuaryPinManager) PinStatus(cont util.Content, origins []*peer.AddrInfo) (*IpfsPinStatusResponse, error)

type GetPinParam added in v0.3.9

type GetPinParam struct {
	User     *util.User
	CidToGet string
}

type IEstuaryPinManager added in v0.4.0

type IEstuaryPinManager interface {
	IPinManager
	PinContent(ctx context.Context, user uint, obj cid.Cid, filename string, cols []*collections.CollectionRef, origins []*peer.AddrInfo, replaceID uint, meta map[string]interface{}, replication int, makeDeal bool) (*IpfsPinStatusResponse, error)
	PinCid(eCtx echo.Context, param PinCidParam) (*IpfsPinStatusResponse, error)
	PinDelegatesForContent(cont util.Content) []string
	PinStatus(cont util.Content, origins []*peer.AddrInfo) (*IpfsPinStatusResponse, error)
	GetPin(param GetPinParam) (*IpfsPinStatusResponse, error)
}

func NewEstuaryPinManager added in v0.3.0

func NewEstuaryPinManager(
	ctx context.Context,
	opts *PinManagerOpts,
	cm content.IManager,
	cfg *config.Estuary,
	shuttleMgr shuttle.IManager,
	db *gorm.DB,
	nd *node.Node,
	log *zap.SugaredLogger,
) IEstuaryPinManager

type IPinManager added in v0.4.0

type IPinManager interface {
	PinQueueSize() int
	Run(workers int)
}

type IpfsListPinStatusResponse added in v0.4.0

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

type IpfsPin added in v0.4.0

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

type IpfsPinStatusResponse added in v0.4.0

type IpfsPinStatusResponse struct {
	RequestID string                 `json:"requestid"`
	Status    status.PinningStatus   `json:"status"`
	Created   time.Time              `json:"created"`
	Delegates []string               `json:"delegates"`
	Info      map[string]interface{} `json:"info"`
	Pin       IpfsPin                `json:"pin"`
	Content   util.Content           `json:"content"`
}

type PinCidParam added in v0.3.9

type PinCidParam struct {
	User             *util.User
	CidToPin         IpfsPin
	Overwrite        bool
	IgnoreDuplicates bool
	Replication      int
	MakeDeal         bool `default:"true"`
}

type PinManager

type PinManager struct {
	RunPinFunc       PinFunc
	StatusChangeFunc PinStatusFunc

	QueueDataDir string
	// contains filtered or unexported fields
}

func NewShuttlePinManager added in v0.3.0

func NewShuttlePinManager(pinfunc PinFunc, scf PinStatusFunc, opts *PinManagerOpts, log *zap.SugaredLogger) *PinManager

func (*PinManager) Add

func (pm *PinManager) Add(op *operation.PinningOperation)

func (*PinManager) PinQueueSize

func (pm *PinManager) PinQueueSize() int

func (*PinManager) Run

func (pm *PinManager) Run(workers int)

type PinManagerOpts

type PinManagerOpts struct {
	MaxActivePerUser int
	QueueDataDir     string
}

type PinStatusFunc

type PinStatusFunc func(contID uint64, location string, status status.PinningStatus) error

type PinningOperationData added in v0.1.11

type PinningOperationData struct {
	ContId uint64
}

type ShuttleManager added in v0.3.0

type ShuttleManager struct {
	*PinManager
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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