miner

package
v0.0.1-beta.8 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainIndex

type ChainIndex struct {
	LastUpdated int64
	Miners      map[string]OnChainData
}

ChainIndex contains on-chain information about miners.

type Index

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

Index builds and provides information about FC miners.

func New

func New(ds datastore.TxnDatastore, api *apistruct.FullNodeStruct, h P2PHost, lr iplocation.LocationResolver) (*Index, error)

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

func (*Index) Close

func (mi *Index) Close() error

Close closes a MinerIndex.

func (*Index) Get

func (mi *Index) Get() IndexSnapshot

Get returns a copy of the current index information.

func (*Index) Listen

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

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

func (*Index) Unregister

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

Unregister unregisters a channel signaler from the signaler hub.

type IndexSnapshot

type IndexSnapshot struct {
	Meta    MetaIndex
	OnChain ChainIndex
}

IndexSnapshot 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 OnChainData

type OnChainData struct {
	Power         uint64
	RelativePower float64
	SectorSize    uint64
	ActiveDeals   uint64
}

OnChainData contains on-chain data about a miner.

type P2PHost

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

P2PHost provides a client to connect to a libp2p peer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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