Documentation ¶
Index ¶
Constants ¶
const ( StatusInternalErr status = "internal_err" StatusNotFound status = "not_found" StatusTimeout status = "timeout" StatusSuccess status = "success" StatusRateLimited status = "rate_limited" )
Variables ¶
var ErrInvalidResponse = errors.New("server returned an invalid response or caused an internal error")
ErrInvalidResponse is returned when a peer returns an invalid response or caused an internal error. It is used to signal that the peer couldn't serve the data successfully, and should not be retried.
var ErrNotFound = errors.New("the requested data or resource could not be found")
ErrNotFound is returned when a peer is unable to find the requested data or resource. It is used to signal that the peer couldn't serve the data successfully, and it's not available at the moment. The request may be retried later, but it's unlikely to succeed.
Functions ¶
func ProtocolID ¶ added in v0.7.0
ProtocolID creates a protocol ID string according to common format
Types ¶
type Metrics ¶ added in v0.9.2
type Metrics struct {
// contains filtered or unexported fields
}
func InitClientMetrics ¶ added in v0.9.2
func InitServerMetrics ¶ added in v0.9.2
type Middleware ¶ added in v0.9.2
type Middleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶ added in v0.9.2
func NewMiddleware(concurrencyLimit int) *Middleware
func (*Middleware) DrainCounter ¶ added in v0.9.2
func (m *Middleware) DrainCounter() int64
DrainCounter returns the current value of the rate limit counter and resets it to 0.
func (*Middleware) RateLimitHandler ¶ added in v0.9.2
func (m *Middleware) RateLimitHandler(handler network.StreamHandler) network.StreamHandler
type Parameters ¶ added in v0.7.0
type Parameters struct { // ServerReadTimeout sets the timeout for reading messages from the stream. ServerReadTimeout time.Duration // ServerWriteTimeout sets the timeout for writing messages to the stream. ServerWriteTimeout time.Duration // HandleRequestTimeout defines the deadline for handling request. HandleRequestTimeout time.Duration // ConcurrencyLimit is the maximum number of concurrently handled streams ConcurrencyLimit int // contains filtered or unexported fields }
Parameters is the set of parameters that must be configured for the shrex/eds protocol.
func DefaultParameters ¶ added in v0.7.0
func DefaultParameters() *Parameters
func (*Parameters) NetworkID ¶ added in v0.7.0
func (p *Parameters) NetworkID() string
NetworkID returns the value of networkID stored in params
func (*Parameters) Validate ¶ added in v0.7.0
func (p *Parameters) Validate() error
func (*Parameters) WithNetworkID ¶ added in v0.7.0
func (p *Parameters) WithNetworkID(networkID string)
WithNetworkID sets the value of networkID in params