deals

package
v0.0.0-...-be0f657 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	ClientStartDeal(ctx context.Context, data cid.Cid, addr address.Address, miner address.Address, price types.BigInt, blocksDuration uint64) (*cid.Cid, error)
	ClientImport(ctx context.Context, path string) (cid.Cid, error)
	ClientGetDealInfo(context.Context, cid.Cid) (*api.DealInfo, error)
	ChainNotify(ctx context.Context) (<-chan []*str.HeadChange, error)
}

API interacts with a Filecoin full-node

type Config

type Config struct {
	ImportPath string
}

type DealConfig

type DealConfig struct {
	Miner      string
	EpochPrice types.BigInt
}

DealConfig contains information about a proposal for a particular miner

type DealInfo

type DealInfo struct {
	ProposalCid cid.Cid
	StateID     uint64
	StateName   string
	Miner       string

	PieceRef []byte
	Size     uint64

	PricePerEpoch types.BigInt
	Duration      uint64
}

DealInfo contains information about a proposal storage deal

type Module

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

Module exposes storage and monitoring from the market.

func New

func New(api API, opts ...Option) (*Module, error)

New creates a new deal module

func (*Module) Store

func (m *Module) Store(ctx context.Context, waddr string, data io.Reader, dcfgs []DealConfig, dur uint64) ([]cid.Cid, []DealConfig, error)

Store creates a proposal deal for data using wallet addr to all miners indicated by dealConfigs for duration epochs

func (*Module) Watch

func (m *Module) Watch(ctx context.Context, proposals []cid.Cid) (<-chan DealInfo, error)

Watch returnas a channel with state changes of indicated proposals

type Option

type Option func(*Config) error

func WithImportPath

func WithImportPath(path string) Option

type Service

type Service struct {
	pb.UnimplementedAPIServer

	Module *Module
}

Service implements the gprc service

func NewService

func NewService(dm *Module) *Service

NewService is a helper to create a new Service

func (*Service) Store

func (s *Service) Store(srv pb.API_StoreServer) error

Store calls deals.Store

func (*Service) Watch

func (s *Service) Watch(req *pb.WatchRequest, srv pb.API_WatchServer) error

Watch calls deals.Watch

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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