pin

package
v0.0.0-...-a092f05 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEndpoint = errs.Class("pin endpoint")

ErrEndpoint - pin endpoint error class.

View Source
var ErrService = errs.Class("pin service")

ErrService - pin service error class.

Functions

This section is empty.

Types

type Address

type Address = common.Address

Address represents address in ethereum network.

func AddressFromHex

func AddressFromHex(hex string) (Address, error)

AddressFromHex creates new address from hex string.

type Chore

type Chore struct {
	Loop         *sync2.Cycle
	IPFS         *ipfs.Service
	ByteDayPrice *big.Int
	// contains filtered or unexported fields
}

Chore persists new on-chain events to the db

func NewChore

func NewChore(log *zap.Logger, db *pindb.PinDB, service *ipfs.Service, endpoint string, contract string) *Chore

func (*Chore) Close

func (c *Chore) Close() error

func (*Chore) PersistRequests

func (c *Chore) PersistRequests(ctx context.Context) (err error)

PersistRequests reads all the pin requests and save them to the db.

func (*Chore) Pin

func (c *Chore) Pin(ctx context.Context, txHash string, ix uint, cid string, amount *big.Int) error

func (*Chore) PinMissing

func (c *Chore) PinMissing(ctx context.Context) (err error)

PinMissing pins the requests which are not yet pinned.

func (*Chore) RecordError

func (c *Chore) RecordError(ctx context.Context, transaction string, index uint, cid string, s string) error

func (*Chore) Run

func (c *Chore) Run(ctx context.Context) error

type Config

type Config struct {
	EthereumEndpoint string
	TokenContract    string
	PinContract      string
}

Config holds pin service configuration.

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

Endpoint for querying ERC20 token information from ethereum chain.

architecture: Endpoint

func NewEndpoint

func NewEndpoint(log *zap.Logger, service *Service) *Endpoint

NewEndpoint creates new payments endpoint instance.

func (*Endpoint) Block

func (endpoint *Endpoint) Block(w http.ResponseWriter, r *http.Request)

Block endpoint retrieves one Block which is pinned.

func (*Endpoint) Blocks

func (endpoint *Endpoint) Blocks(w http.ResponseWriter, r *http.Request)

Blocks endpoint retrieves all Blocks which are pinned.

func (*Endpoint) Config

func (endpoint *Endpoint) Config(w http.ResponseWriter, r *http.Request)

Config returns with the actual config required by the web UI.

func (*Endpoint) PinOfHash

func (endpoint *Endpoint) PinOfHash(w http.ResponseWriter, request *http.Request)

func (*Endpoint) Pins

func (endpoint *Endpoint) Pins(w http.ResponseWriter, r *http.Request)

Pins endpoint retrieves all Pin request events.

func (*Endpoint) Register

func (endpoint *Endpoint) Register(router *mux.Router)

Register registers endpoint methods on API server subroute.

type Hash

type Hash = common.Hash

Hash represent cryptographic hash.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service for querying ERC20 token information from ethereum chain.

architecture: Service

func NewService

func NewService(log *zap.Logger, db *pindb.PinDB, endpoint string, token Address, pin Address) *Service

NewService creates new token service instance.

func (*Service) AllPins

func (service *Service) AllPins(ctx context.Context) (result []pindb.Pin, err error)

func (*Service) Cid

func (service *Service) Cid(ctx context.Context, hash string) (result pindb.Cid, err error)

func (*Service) Cids

func (service *Service) Cids(ctx context.Context) (result []pindb.Cid, err error)

func (*Service) Config

func (service *Service) Config(ctx context.Context) (cfg WebConfig, err error)

Config returns the UI configuration

func (*Service) PinsFromChain

func (service *Service) PinsFromChain(ctx context.Context) (_ []pindb.Pin, err error)

PinsFromChain returns with all on-chain pin request

func (*Service) PinsOfHash

func (service *Service) PinsOfHash(ctx context.Context, cid string) (result []pindb.Pin, err error)

type WebConfig

type WebConfig struct {
	PinContract   string
	TokenContract string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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