Documentation
¶
Index ¶
- func HandleRaw(action rawAction) http.HandlerFunc
- func NewHistoryMiddleware(ledgerState *ledger.State, staleThreshold int32, session db.SessionInterface) func(http.Handler) http.Handler
- func WrapRaw(next http.Handler, action rawAction) http.Handler
- type ObjectActionHandler
- type ReplicaSyncCheckMiddleware
- type Router
- type RouterConfig
- type Server
- type ServerConfig
- type ServerMetrics
- type StateMiddleware
- type TLSConfig
- type VaryByRemoteIP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleRaw ¶
func HandleRaw(action rawAction) http.HandlerFunc
func NewHistoryMiddleware ¶
func NewHistoryMiddleware(ledgerState *ledger.State, staleThreshold int32, session db.SessionInterface) func(http.Handler) http.Handler
NewHistoryMiddleware adds session to the request context and ensures Frontier 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
Types ¶
type ObjectActionHandler ¶
type ObjectActionHandler struct {
Action objectAction
}
func (ObjectActionHandler) ServeHTTP ¶
func (handler ObjectActionHandler) ServeHTTP( w http.ResponseWriter, r *http.Request, )
type ReplicaSyncCheckMiddleware ¶
type ReplicaSyncCheckMiddleware struct {
PrimaryHistoryQ *history.Q
ReplicaHistoryQ *history.Q
ServerMetrics *ServerMetrics
}
func (*ReplicaSyncCheckMiddleware) Wrap ¶
func (m *ReplicaSyncCheckMiddleware) Wrap(h http.Handler) http.Handler
func (*ReplicaSyncCheckMiddleware) WrapFunc ¶
func (m *ReplicaSyncCheckMiddleware) WrapFunc(h http.HandlerFunc) http.HandlerFunc
WrapFunc executes the middleware on a given HTTP handler function
type Router ¶
func NewRouter ¶
func NewRouter(config *RouterConfig, serverMetrics *ServerMetrics, ledgerState *ledger.State) (*Router, error)
type RouterConfig ¶
type RouterConfig struct {
DBSession db.SessionInterface
PrimaryDBSession db.SessionInterface
TxSubmitter *txsub.System
RateQuota *throttled.RateQuota
BehindCloudflare bool
BehindAWSLoadBalancer bool
SSEUpdateFrequency time.Duration
StaleThreshold uint
ConnectionTimeout time.Duration
NetworkPassphrase string
MaxPathLength uint
MaxAssetsPerPathRequest int
PathFinder paths.Finder
PrometheusRegistry *prometheus.Registry
CoreGetter actions.CoreStateGetter
FrontierVersion string
FriendbotURL *url.URL
HealthCheck http.Handler
EnableIngestionFiltering bool
}
type Server ¶
type Server struct {
Router *Router
Metrics *ServerMetrics
// contains filtered or unexported fields
}
Server contains the http server related fields for frontier: the Router, rate limiter, etc.
func NewServer ¶
func NewServer(serverConfig ServerConfig, routerConfig RouterConfig, ledgerState *ledger.State) (*Server, error)
func (*Server) RegisterMetrics ¶
func (s *Server) RegisterMetrics(registry *prometheus.Registry)
RegisterMetrics registers the prometheus metrics
type ServerConfig ¶
type ServerMetrics ¶
type ServerMetrics struct {
RequestDurationSummary *prometheus.SummaryVec
ReplicaLagErrorsCounter prometheus.Counter
}
type StateMiddleware ¶
type StateMiddleware struct {
FrontierSession db.SessionInterface
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 ¶
func (m *StateMiddleware) Wrap(h http.Handler) http.Handler
WrapFunc executes the middleware on a given HTTP handler function
func (*StateMiddleware) WrapFunc ¶
func (m *StateMiddleware) WrapFunc(h http.HandlerFunc) http.HandlerFunc
WrapFunc executes the middleware on a given HTTP handler function
type VaryByRemoteIP ¶
type VaryByRemoteIP struct{}