/
types.go
55 lines (47 loc) · 1.06 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package miner
import (
"time"
)
// IndexSnapshot contains on-chain and off-chain information about miners.
type IndexSnapshot struct {
Meta MetaIndex
OnChain ChainIndex
}
// ChainIndex contains on-chain information about miners.
type ChainIndex struct {
LastUpdated int64
Miners map[string]OnChainData
}
// OnChainData contains on-chain data about a miner.
type OnChainData struct {
Power uint64
RelativePower float64
SectorSize uint64
ActiveDeals uint64
}
// MetaIndex contains off-chain information about miners.
type MetaIndex struct {
Online uint32
Offline uint32
Info map[string]Meta
}
// Meta contains off-chain information of a miner.
type Meta struct {
LastUpdated time.Time
UserAgent string
Location Location
Online bool
}
// Location contains geeoinformation.
type Location struct {
Country string
Longitude float64
Latitude float64
}
// Module provides information about miners in the
// Filecoin network.
type Module interface {
Get() IndexSnapshot
Listen() <-chan struct{}
Unregister(c chan struct{})
}