httpx

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0, Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleRaw added in v1.11.1

func HandleRaw(action rawAction) http.HandlerFunc

func NewHistoryMiddleware added in v1.11.1

func NewHistoryMiddleware(ledgerState *ledger.State, staleThreshold int32, session db.SessionInterface, contextDBTimeout time.Duration) func(http.Handler) http.Handler

NewHistoryMiddleware adds session to the request context and ensures Aurora is not in a stale state, which is when the difference between latest core ledger and latest history ledger is higher than the given threshold

func WrapRaw added in v1.11.1

func WrapRaw(next http.Handler, action rawAction) http.Handler

Types

type HttpResponse added in v1.11.1

type HttpResponse interface {
	GetStatus() int
}

type ObjectActionHandler added in v1.11.1

type ObjectActionHandler struct {
	Action objectAction
}

func (ObjectActionHandler) ServeHTTP added in v1.11.1

func (handler ObjectActionHandler) ServeHTTP(
	w http.ResponseWriter,
	r *http.Request,
)

type ReplicaSyncCheckMiddleware added in v1.11.1

type ReplicaSyncCheckMiddleware struct {
	PrimaryHistoryQ *history.Q
	ReplicaHistoryQ *history.Q
	ServerMetrics   *ServerMetrics
}

func (*ReplicaSyncCheckMiddleware) Wrap added in v1.11.1

func (*ReplicaSyncCheckMiddleware) WrapFunc added in v1.11.1

WrapFunc executes the middleware on a given HTTP handler function

type Router added in v1.11.1

type Router struct {
	*chi.Mux
	Internal *chi.Mux
}

func NewRouter added in v1.11.1

func NewRouter(config *RouterConfig, serverMetrics *ServerMetrics, ledgerState *ledger.State) (*Router, error)

type RouterConfig added in v1.11.1

type RouterConfig struct {
	DBSession             db.SessionInterface
	PrimaryDBSession      db.SessionInterface
	TxSubmitter           *txsub.System
	RateQuota             *throttled.RateQuota
	MaxConcurrentRequests uint

	BehindCloudflare        bool
	BehindAWSLoadBalancer   bool
	SSEUpdateFrequency      time.Duration
	StaleThreshold          uint
	ConnectionTimeout       time.Duration
	ClientQueryTimeout      time.Duration
	MaxHTTPRequestSize      uint
	NetworkPassphrase       string
	MaxPathLength           uint
	MaxAssetsPerPathRequest int
	PathFinder              paths.Finder
	PrometheusRegistry      *prometheus.Registry
	CoreGetter              actions.CoreStateGetter
	AuroraVersion           string
	FriendbotURL            *url.URL
	HealthCheck             http.Handler
	DisableTxSub            bool
	SkipTxMeta              bool
	HcnetCoreURL            string
}

type Server added in v1.11.1

type Server struct {
	Router  *Router
	Metrics *ServerMetrics
	// contains filtered or unexported fields
}

Server contains the http server related fields for aurora: the Router, rate limiter, etc.

func NewServer added in v1.11.1

func NewServer(serverConfig ServerConfig, routerConfig RouterConfig, ledgerState *ledger.State) (*Server, error)

func (*Server) RegisterMetrics added in v1.11.1

func (s *Server) RegisterMetrics(registry *prometheus.Registry)

RegisterMetrics registers the prometheus metrics

func (*Server) Serve added in v1.11.1

func (s *Server) Serve() error

func (*Server) Shutdown added in v1.11.1

func (s *Server) Shutdown(ctx context.Context) error

type ServerConfig added in v1.11.1

type ServerConfig struct {
	Port      uint16
	TLSConfig *TLSConfig
	AdminPort uint16
}

type ServerMetrics added in v1.11.1

type ServerMetrics struct {
	RequestDurationSummary  *prometheus.SummaryVec
	ReplicaLagErrorsCounter prometheus.Counter
	RequestsInFlightGauge   *prometheus.GaugeVec
	RequestsReceivedCounter *prometheus.CounterVec
}

type StateMiddleware added in v1.11.1

type StateMiddleware struct {
	AuroraSession       db.SessionInterface
	ClientQueryTimeout  time.Duration
	NoStateVerification bool
}

StateMiddleware is a middleware which enables a state handler if the state has been initialized. Unless NoStateVerification is set, it ensures that the state (ledger entries) has been verified and is correct (Otherwise returns `500 Internal Server Error` to prevent returning invalid data to the user)

func (*StateMiddleware) Wrap added in v1.11.1

WrapFunc executes the middleware on a given HTTP handler function

func (*StateMiddleware) WrapFunc added in v1.11.1

WrapFunc executes the middleware on a given HTTP handler function

type TLSConfig added in v1.11.1

type TLSConfig struct {
	CertPath, KeyPath string
}

type VaryByRemoteIP added in v1.11.1

type VaryByRemoteIP struct{}

func (VaryByRemoteIP) Key added in v1.11.1

func (v VaryByRemoteIP) Key(r *http.Request) string

Jump to

Keyboard shortcuts

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