offchain

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPSet

type HTTPSet struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

HTTPSet holds a pool of concurrent http request calls

func NewHTTPSet

func NewHTTPSet() *HTTPSet

NewHTTPSet creates a offchain http set that can be used by runtime as HTTP clients, the max concurrent requests is 1000

func (*HTTPSet) Get

func (p *HTTPSet) Get(id int16) *Request

Get returns a request or nil if request not found

func (*HTTPSet) Remove

func (p *HTTPSet) Remove(id int16) error

Remove just remove a expecific request from reqs

func (*HTTPSet) StartRequest

func (p *HTTPSet) StartRequest(method, uri string) (int16, error)

StartRequest create a new request using the method and the uri, adds the request into the list and then return the position of the request inside the list

type Request

type Request struct {
	Request *http.Request
}

Request holds the request object and update the invalid and waiting status whenever the request starts or is waiting to be read

func (*Request) AddHeader

func (r *Request) AddHeader(name, value string) error

AddHeader adds a new HTTP header into request property, only if request is valid

Jump to

Keyboard shortcuts

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