miner

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: 24 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)
	StateMinerPower(context.Context, address.Address, *types.TipSet) (api.MinerPower, error)
	ChainHead(context.Context) (*types.TipSet, error)
	ChainGetTipSet(context.Context, types.TipSetKey) (*types.TipSet, error)
	ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet) (*types.TipSet, error)
	StateChangedActors(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error)
	StateReadState(context.Context, *types.Actor, *types.TipSet) (*api.ActorState, error)
	StateMinerPeerID(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error)
	ChainGetGenesis(context.Context) (*types.TipSet, error)
	ChainGetPath(context.Context, types.TipSetKey, types.TipSetKey) ([]*store.HeadChange, error)
}

API provides an abstraction to a Filecoin full-node

type ChainIndex

type ChainIndex struct {
	LastUpdated uint64
	Power       map[string]Power
}

ChainIndex contains on-chain information about miners

type Index

type Index struct {
	Meta  MetaIndex
	Chain ChainIndex
}

Index contains on-chain and off-chain information about miners

type Location

type Location struct {
	Country   string
	Longitude float32
	Latitude  float32
}

Location contains geeoinformation

type Meta

type Meta struct {
	LastUpdated time.Time
	UserAgent   string
	Location    Location
	Online      bool
}

Meta contains off-chain information of a miner

type MetaIndex

type MetaIndex struct {
	Online  uint32
	Offline uint32
	Info    map[string]Meta
}

MetaIndex contains off-chain information about miners

type MinerIndex

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

MinerIndex builds and provides information about FC miners

func New

func New(ds datastore.TxnDatastore, api API, h P2PHost, lr iplocation.LocationResolver) (*MinerIndex, error)

New returns a new MinerIndex. It loads from ds any previous state and starts immediately making the index up to date.

func (*MinerIndex) Close

func (mi *MinerIndex) Close() error

Close closes a MinerIndex

func (*MinerIndex) Get

func (mi *MinerIndex) Get() Index

Get returns a copy of the current index information

func (*MinerIndex) Listen

func (mi *MinerIndex) Listen() <-chan struct{}

Listen returns a channel signaler to notify when new index information is available.

func (*MinerIndex) Unregister

func (mi *MinerIndex) Unregister(c chan struct{})

Unregister unregisters a channel signaler from the signaler hub

type P2PHost

type P2PHost interface {
	Addrs(pid peer.ID) []multiaddr.Multiaddr
	Ping(ctx context.Context, pid peer.ID) bool
	GetAgentVersion(pid peer.ID) string
}

type Power

type Power struct {
	Power    uint64
	Relative float64
}

Power contains power information of a miner

type Service

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

Service implements the gprc service

func NewService

func NewService(mi *MinerIndex) *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 miner index Get

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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