hostdb

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEachAnnouncement

func ForEachAnnouncement(b types.Block, height uint64, fn func(types.PublicKey, Announcement))

ForEachAnnouncement calls fn on each host announcement in a block.

Types

type Announcement

type Announcement struct {
	Index      types.ChainIndex
	Timestamp  time.Time
	NetAddress string
}

Announcement represents a host announcement in a given block.

type Host

type Host struct {
	KnownSince       time.Time          `json:"knownSince"`
	LastAnnouncement time.Time          `json:"lastAnnouncement"`
	PublicKey        types.PublicKey    `json:"publicKey"`
	NetAddress       string             `json:"netAddress"`
	PriceTable       HostPriceTable     `json:"priceTable"`
	Settings         rhpv2.HostSettings `json:"settings"`
	Interactions     Interactions       `json:"interactions"`
	Scanned          bool               `json:"scanned"`
}

A Host pairs a host's public key with a set of interactions.

func (Host) IsAnnounced

func (h Host) IsAnnounced() bool

IsAnnounced returns whether the host has been announced.

func (Host) IsOnline

func (h Host) IsOnline() bool

IsOnline returns whether a host is considered online.

type HostAddress

type HostAddress struct {
	PublicKey  types.PublicKey `json:"publicKey"`
	NetAddress string          `json:"netAddress"`
}

HostAddress contains the address of a specific host identified by a public key.

type HostInfo

type HostInfo struct {
	Host
	Blocked bool `json:"blocked"`
}

HostInfo extends the host type with a field indicating whether it is blocked or not.

type HostPriceTable

type HostPriceTable struct {
	rhpv3.HostPriceTable
	Expiry time.Time `json:"expiry"`
}

A HostPriceTable extends the host price table with its expiry.

type HostScan

type HostScan struct {
	HostKey    types.PublicKey `json:"hostKey"`
	Success    bool
	Timestamp  time.Time
	Settings   rhpv2.HostSettings
	PriceTable rhpv3.HostPriceTable
}

type Interactions

type Interactions struct {
	TotalScans              uint64        `json:"totalScans"`
	LastScan                time.Time     `json:"lastScan"`
	LastScanSuccess         bool          `json:"lastScanSuccess"`
	LostSectors             uint64        `json:"lostSectors"`
	SecondToLastScanSuccess bool          `json:"secondToLastScanSuccess"`
	Uptime                  time.Duration `json:"uptime"`
	Downtime                time.Duration `json:"downtime"`

	SuccessfulInteractions float64 `json:"successfulInteractions"`
	FailedInteractions     float64 `json:"failedInteractions"`
}

Interactions contains metadata about a host's interactions.

type PriceTableUpdate

type PriceTableUpdate struct {
	HostKey    types.PublicKey `json:"hostKey"`
	Success    bool
	Timestamp  time.Time
	PriceTable HostPriceTable
}

Jump to

Keyboard shortcuts

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