Skip to main content

Crate pingap_core

Crate pingap_core 

Source

Structs§

BackgroundTaskService
A unified background service runner that can handle one or more named tasks.
CacheInfo
All cache-related configuration and statistics for a request.
CompressionStat
Statistics about response compression operations.
ConnectionInfo
Information about a single client connection.
Ctx
Represents the state of a request/response cycle, tracking various metrics and properties including connection details, caching information, and upstream server interactions.
DigestDetail
Helper struct to store connection timing and TLS details
Features
Optional features like tracing, plugins, and response modifications.
Guard
A Guard is returned when an Inflight key is incremented via Inflight::incr.
HttpChunkResponse
Represents a chunked HTTP response for streaming large bodies of data.
HttpResponse
Represents a complete HTTP response, including status, headers, and a body. This struct is used for responses where the entire body is known upfront.
HttpResponseBuilder
A builder for creating HttpResponse instances fluently using the builder pattern.
Inflight
An Inflight type tracks the frequency of actions that are actively occurring. When the value is dropped from scope, the count will automatically decrease.
NotificationData
Rate
A stable rate estimator that reports the rate of events per period of interval time.
RateComponents
Input struct to custom functions for calculating rate. Includes the counts from the current interval, previous interval, the configured duration of an interval, and the fraction into the current interval that the sample was taken.
RequestState
State related to the current request being processed.
Timing
All timing-related metrics for the request lifecycle.
TinyUfo
TinyUfo cache
TtlLruLimit
UpstreamInfo
Information about the upstream (backend) server.

Enums§

Error
ModifiedMode
NotificationLevel
PluginStep
RequestPluginResult
A more expressive return type for handle_request. It clearly states the plugin’s decision.
ResponseBodyPluginResult
ResponsePluginResult
Represents the action a plugin takes on a response.

Constants§

HOST_NAME_TAG

Statics§

HTTP_HEADER_CONTENT_HTML
HTTP_HEADER_CONTENT_JSON
HTTP_HEADER_CONTENT_TEXT
HTTP_HEADER_NAME_X_REQUEST_ID
HTTP_HEADER_NO_CACHE
HTTP_HEADER_NO_STORE
HTTP_HEADER_TRANSFER_CHUNKED
PROPORTIONAL_RATE_ESTIMATE_CALC_FN
A rate calculation function which uses a good estimate of the rate of events over the past interval time.

Traits§

BackgroundTask
A unified trait for any task that can be run in the background.
LocationInstance
Trait for location instance
ModifyResponseBody
Trait for modifying the response body.
Notification
Trait for sending notifications
Plugin
Core trait that defines the interface all plugins must implement.
PluginProvider
Plugin provider trait
UpstreamInstance
Trait for upstream instance, used to handle the upstream instance lifecycle.

Functions§

convert_header
Converts a single string in “name: value” format into an HttpHeader tuple.
convert_header_value
Processes a HeaderValue that may contain a special dynamic variable (e.g., $host). It replaces the variable with its corresponding runtime value.
convert_headers
Converts a slice of strings into a Vec of HttpHeaders.
format_duration
Format the duration in human readable format, checking smaller units first. e.g., ms, s, m, h.
get_cache_key
Generates a cache key from the request method, URI and state context. The key includes an optional namespace and other key components if configured in the context.
get_client_ip
Gets the client’s IP address by checking proxy headers first, then the direct connection address.
get_cookie_value
Parses the “Cookie” header to find the value of a specific cookie.
get_digest_detail
Extracts timing and TLS information from connection digest. Used for metrics and logging connection details.
get_host
Gets the request host by checking the URI first, then falling back to the “Host” header.
get_hostname
Returns the system hostname.
get_query_value
Gets the value of a specific query parameter from the request URI.
get_remote_addr
Gets the remote address (IP and port) from the session.
get_req_header_value
A convenient helper to get a header value as a &str from a RequestHeader.
get_super_ts
Returns the number of seconds elapsed since SUPER_TIMESTAMP Returns 0 if the current time is before SUPER_TIMESTAMP
new_internal_error
Creates a new internal error
now_ms
Returns the number of milliseconds since the epoch
now_sec
Returns the number of seconds since the epoch
real_now_ms
Returns the number of milliseconds since the epoch This is the real time, not the coarse time
remove_query_from_header
Removes a specific query parameter from the request header’s URI.

Type Aliases§

HttpHeader
A type alias for a tuple representing an HTTP header.
NotificationSender
Type alias for a boxed Notification trait object that can be shared between threads
Plugins