hyperlane-plugin-etag 23.3.0

An opt-in automatic ETag and HTTP conditional request plugin for the Hyperlane framework providing strong/weak XxHash3_64 entity tags, zero-allocation If-None-Match 304 Not Modified, and If-Match 412 Precondition Failed optimistic concurrency.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::*;

/// Pluggable current-version ETag lookup used to enforce `If-Match` optimistic locking on mutating requests.
pub trait EtagValidator: Send + Sync + 'static {
    /// Returns the current strong ETag for the resource identified by `request`, if it exists.
    ///
    /// # Arguments
    ///
    /// - `&Request` - Incoming mutating HTTP request carrying an `If-Match` precondition.
    ///
    /// # Returns
    ///
    /// - `Option<String>` - Current resource ETag, or `None` when the resource does not exist.
    fn current_etag(&self, request: &Request) -> Option<String>;
}