ask

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: 16 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 {
	StateListMiners(context.Context, *types.TipSet) ([]address.Address, error)
	ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*types.SignedStorageAsk, error)
	StateMinerPeerID(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error)
}

API provides an abstraction to a Filecoin full-node

type AskIndex

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

AskIndex contains cached information about markets

func New

func New(ds datastore.TxnDatastore, api API) (*AskIndex, error)

New returnas a new AskIndex. It loads saved information from ds, and immeediatelly starts keeping the cache up to date.

func (*AskIndex) Close

func (ai *AskIndex) Close() error

Close closes the AskIndex

func (*AskIndex) Get

func (ai *AskIndex) Get() Index

Get returns a copy of the current index data

func (*AskIndex) Listen

func (ai *AskIndex) Listen() <-chan struct{}

Listen returns a new channel signaler that notifies when the index gets updated.

func (*AskIndex) Query

func (ai *AskIndex) Query(q Query) ([]StorageAsk, error)

Query executes a query to retrieve active Asks

func (*AskIndex) Unregister

func (ai *AskIndex) Unregister(c chan struct{})

Unregister unregisters a channel signaler from the signaler hub

type Index

type Index struct {
	LastUpdated        time.Time
	StorageMedianPrice uint64
	Storage            map[string]StorageAsk
}

Index contains Ask information from markets

type Query

type Query struct {
	MaxPrice  uint64
	PieceSize uint64
	Limit     int
	Offset    int
}

Query specifies filtering and paging data to retrieve active Asks

type Service

type Service struct {
	pb.UnimplementedAPIServer
	// contains filtered or unexported fields
}

Service implements the gprc service

func NewService

func NewService(ai *AskIndex) *Service

NewService is a helper to create a new Service

func (*Service) Get

func (s *Service) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetReply, error)

Get calls askIndex.Get

func (*Service) Query

func (s *Service) Query(ctx context.Context, req *pb.QueryRequest) (*pb.QueryReply, error)

Query calls askIndex.Query

type StorageAsk

type StorageAsk struct {
	Miner        string
	Price        uint64
	MinPieceSize uint64
	Timestamp    uint64
	Expiry       uint64
}

StorageAsk has information about an active ask from a storage miner

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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