Versions in this module Expand all Collapse all v0 v0.0.21 Jun 7, 2022 v0.0.2 Jun 7, 2022 Changes in this version + var ErrCantFindMaximum = errors.New("unable to find maximum allowed capacity") + var ErrNoPriority = errors.New("priority too low to raise capacity") + var ErrNotConnected = errors.New("client not connected") + type AtomicBalanceOperator interface + AddBalance func(amount int64) (uint64, uint64, error) + SetBalance func(pos, neg uint64) error + type ClientPool struct + func NewClientPool(balanceDb ethdb.KeyValueStore, minCap uint64, connectedBias time.Duration, ...) *ClientPool + func (bt ClientPool) BalanceOperation(id enode.ID, connAddress string, cb func(AtomicBalanceOperator)) + func (bt ClientPool) GetExpirationTCs() (pos, neg uint64) + func (bt ClientPool) GetPosBalanceIDs(start, stop enode.ID, maxCount int) (result []enode.ID) + func (bt ClientPool) SetDefaultFactors(posFactors, negFactors PriceFactors) + func (bt ClientPool) SetExpirationTCs(pos, neg uint64) + func (bt ClientPool) TotalTokenAmount() uint64 + func (cp *ClientPool) Handle(id enode.ID, address string, name string, data []byte) []byte + func (cp *ClientPool) Register(peer clientPeer) ConnectedBalance + func (cp *ClientPool) SetCapacity(node *enode.Node, reqCap uint64, bias time.Duration, requested bool) (capacity uint64, err error) + func (cp *ClientPool) SetConnectedBias(bias time.Duration) + func (cp *ClientPool) Start() + func (cp *ClientPool) Stop() + func (cp *ClientPool) Unregister(peer clientPeer) + func (pp ClientPool) Active() (uint64, uint64) + func (pp ClientPool) Inactive() int + func (pp ClientPool) Limits() (uint64, uint64) + func (pp ClientPool) SetLimits(maxCount, maxCap uint64) + type ConnectedBalance interface + RequestServed func(cost uint64) uint64 + SetPriceFactors func(posFactor, negFactor PriceFactors) + type PriceFactors struct + CapacityFactor float64 + RequestFactor float64 + TimeFactor float64 + type ReadOnlyBalance interface + GetBalance func() (uint64, uint64) + GetPriceFactors func() (posFactor, negFactor PriceFactors) + GetRawBalance func() (utils.ExpiredValue, utils.ExpiredValue) + type Server struct + func NewServer(delayPerRequest time.Duration) *Server + func (s *Server) Register(b Service, id, desc string) + func (s *Server) Serve(id enode.ID, address string, requests vflux.Requests) vflux.Replies + func (s *Server) ServeEncoded(id enode.ID, addr *net.UDPAddr, req []byte) []byte + func (s *Server) Stop() + type Service interface + Handle func(id enode.ID, address string, name string, data []byte) []byte