func (set *HostSet) HasHost(hostKey hostdb.HostPublicKey) bool {
	_, ok := set.sessions[hostKey]
	return ok
}
HasHost returns true if the specified host is in the set.
package renterutil
import (
	"errors"
	"fmt"
	"strings"
	"sync"
	"time"
	"go.sia.tech/siad/types"
	"lukechampine.com/us/hostdb"
	"lukechampine.com/us/renter"
	"lukechampine.com/us/renter/proto"
)
var (
	errNoHost       = errors.New("no record of that host")
	errHostAcquired = errors.New("host is currently acquired")
)
type HostError struct {
	HostKey hostdb.HostPublicKey
	Err     error
}
func (he HostError) Error() string {
	return he.HostKey.ShortKey() + ": " + he.Err.Error()
}
func (he HostError) Unwrap() error {
	return he.Err
}
type HostErrorSet []*HostError
func (hes HostErrorSet) Error() string {
	strs := make([]string, len(hes))
	for i := range strs {
		strs[i] = hes[i].Error()
	}
	return "\n" + strings.Join(strs, "\n")
}
type tryLock struct {
	c    chan struct{}
	once sync.Once
}
func (mu *tryLock) init() {
	mu.c = make(chan struct{}, 1)
	mu.c <- struct{}{}
}
func (mu *tryLock) Lock() {
	mu.once.Do(mu.init)
	<-mu.c
}
func (mu *tryLock) TryLock() bool {
	mu.once.Do(mu.init)
	select {
	case <-mu.c:
		return true
	default:
		return false
	}
}
func (mu *tryLock) Unlock() {
	mu.c <- struct{}{}
}
type lockedHost struct {
	reconnect func() error
	s         *proto.Session
	mu        tryLock
}
type HostSet struct {
	sessions      map[hostdb.HostPublicKey]*lockedHost
	hkr           renter.HostKeyResolver
	currentHeight types.BlockHeight
	lockTimeout   time.Duration
	onConnect     func(s *proto.Session)
}