model

package
v0.0.0-...-2259e1c Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDb

func CloseDb()

func IdGen

func IdGen() string

func OpenDb

func OpenDb(addr string)

func PinAdd

func PinAdd(ctx context.Context, status *PinStatus) error

func PinCount

func PinCount(ctx context.Context) (int64, error)

func PinDelete

func PinDelete(ctx context.Context, reqId string) error

func PinUpdate

func PinUpdate(ctx context.Context, status *PinStatus) error

Types

type Pin

type Pin struct {

	// Content Identifier (CID) to be pinned recursively
	Cid string `json:"cid"`

	// Optional name for pinned data; can be used for lookups later
	Name string `json:"name,omitempty"`

	// Optional list of multiaddrs known to provide the data
	Origins []string `json:"origins,omitempty"`

	// Optional metadata for pin object
	Meta map[string]string `json:"meta,omitempty"`
}

Pin - Pin object

type PinStatus

type PinStatus struct {

	// Globally unique identifier of the pin request; can be used to check the status of ongoing pinning, or pin removal
	Requestid string `json:"requestid"`

	Status Status `json:"status"`

	// Immutable timestamp indicating when a pin request entered a pinning service; can be used for filtering results and pagination
	Created time.Time `json:"created"`

	Pin Pin `json:"pin"`

	// List of multiaddrs designated by pinning service for transferring any new data from external peers
	Delegates []string `json:"delegates"`

	// Optional info for PinStatus response
	Info map[string]string `json:"info,omitempty"`
}

PinStatus - Pin object with status

func PinGet

func PinGet(ctx context.Context, reqId string) (*PinStatus, error)

func PinList

func PinList(ctx context.Context, offset, limit int64) ([]PinStatus, error)

type Status

type Status string

Status : Status a pin object can have at a pinning service

const (
	QUEUED  Status = "queued"
	PINNING Status = "pinning"
	PINNED  Status = "pinned"
	FAILED  Status = "failed"
)

List of Status

Jump to

Keyboard shortcuts

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