Documentation ¶
Overview ¶
This file is compiled for all architectures except WebAssembly.
Index ¶
Constants ¶
const (
MaxPoolSize = 20
)
const RetryableError = "Nonfatal error occurred, please retry"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
Filter filters out IDs from the provided map based on criteria in the NDF. The passed in map is a map of the NDF for easier access. The map is ID -> index in the NDF. There is no multithreading; the filter function can either edit the passed map or make a new one and return it. The general pattern is to loop through the map, then look up data about the nodes in the NDF to make a filtering decision, then add them to a new map if they are accepted.
type HostManager ¶
type HostManager interface { GetHost(hostId *id.ID) (*connect.Host, bool) AddHost(hid *id.ID, address string, cert []byte, params connect.HostParams) ( host *connect.Host, err error) RemoveHost(hid *id.ID) }
HostManager Interface allowing storage and retrieval of Host objects
type HostPool ¶
type HostPool struct {
// contains filtered or unexported fields
}
HostPool Handles providing hosts to the client
func (*HostPool) GetHostParams ¶
func (h *HostPool) GetHostParams() connect.HostParams
GetHostParams returns a copy of the connect.HostParams struct.
func (*HostPool) SetGatewayFilter ¶
SetGatewayFilter sets the filter used to filter gateways from the ID map.
func (*HostPool) UpdateNdf ¶
func (h *HostPool) UpdateNdf(ndf *ndf.NetworkDefinition)
UpdateNdf mutates internal NDF to the given NDF
type PoolParams ¶
type PoolParams struct { // MaxPoolSize is the maximum number of Hosts in the HostPool. MaxPoolSize uint32 // PoolSize allows override of HostPool size. Set to zero for dynamic size // calculation. PoolSize uint32 // ProxyAttempts dictates how many proxies will be used in event of send // failure. ProxyAttempts uint32 // MaxPings is the number of gateways to concurrently test when initializing // HostPool. Disabled if zero. MaxPings uint32 // ForceConnection determines whether host connections are initialized when // added to HostPool. ForceConnection bool // HostParams is the parameters for the creation of new Host objects. //fixme params: have this adhere to json.Marshaler. // This will allow the PoolParams object to have full adherence. HostParams connect.HostParams `json:"-"` }
PoolParams allows configuration of HostPool parameters.
func DefaultPoolParams ¶
func DefaultPoolParams() PoolParams
DefaultPoolParams returns a default set of PoolParams.
func GetParameters ¶
func GetParameters(params string) (PoolParams, error)
GetParameters returns the default PoolParams, or override with given parameters, if set.
func (PoolParams) MarshalJSON ¶
func (pp PoolParams) MarshalJSON() ([]byte, error)
MarshalJSON adheres to the json.Marshaler interface.
func (*PoolParams) UnmarshalJSON ¶
func (pp *PoolParams) UnmarshalJSON(data []byte) error
UnmarshalJSON adheres to the json.Unmarshaler interface.
type SendToPreferredFunc ¶
type SendToPreferredFunc func(host *connect.Host, target *id.ID, timeout time.Duration) (interface{}, error)
SendToPreferredFunc is the send function passed into Sender.SendToPreferred.
type Sender ¶
type Sender interface { SendToAny(sendFunc func(host *connect.Host) (interface{}, error), stop *stoppable.Single) (interface{}, error) SendToPreferred(targets []*id.ID, sendFunc SendToPreferredFunc, stop *stoppable.Single, timeout time.Duration) (interface{}, error) UpdateNdf(ndf *ndf.NetworkDefinition) SetGatewayFilter(f Filter) GetHostParams() connect.HostParams }
Sender object is used for sending that wraps the HostPool for providing destinations.
func NewSender ¶
func NewSender(poolParams PoolParams, rng *fastRNG.StreamGenerator, ndf *ndf.NetworkDefinition, getter HostManager, storage storage.Session, addGateway chan network.NodeGateway) (Sender, error)
NewSender Create a new Sender object wrapping a HostPool object