hostdb

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostDB

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

The HostDB is a set of hosts that get weighted and inserted into a tree

func New

func New() (hdb *HostDB, err error)

New returns an empty HostDatabase.

func (*HostDB) FlagHost

func (hdb *HostDB) FlagHost(id string) error

func (*HostDB) Info

func (hdb *HostDB) Info() ([]byte, error)

func (*HostDB) Insert

func (hdb *HostDB) Insert(entry components.HostEntry) error

Insert adds an entry to the hostdb, wrapping the standard insert call with a lock. When called externally, the lock needs to be in place, however sometimes insert needs to be called internally when there is already a lock in place.

func (*HostDB) RandomHost

func (hdb *HostDB) RandomHost() (h components.HostEntry, err error)

RandomHost pulls a random host from the hostdb weighted according to whatever internal metrics exist within the hostdb.

func (*HostDB) Remove

func (hdb *HostDB) Remove(id string) error

Remove deletes an entry from the hostdb.

func (*HostDB) Size

func (hdb *HostDB) Size() int

func (*HostDB) Update

func (hdb *HostDB) Update(initialStateHeight consensus.BlockHeight, rewoundBlocks []consensus.Block, appliedBlocks []consensus.Block) (err error)

Update throws a bunch of blocks at the hostdb to be integrated.

Jump to

Keyboard shortcuts

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