pub struct AugmentedMetadata {
pub identity: PluginIdentity,
pub negotiated_functions: BTreeMap<String, u32>,
pub negotiated_capabilities: BTreeSet<String>,
pub handshake_completed_at: i64,
pub self_check_passed: bool,
pub self_check_completed_at: i64,
pub expires_at: i64,
}Expand description
Augmented metadata combining plugin identity with negotiated capabilities.
This is the single source of truth for negotiated plugin capabilities and versions. It encapsulates the result of a successful handshake and self-check.
Fields§
§identity: PluginIdentityThe plugin’s identity metadata (magic, abi_envelope, name, version).
negotiated_functions: BTreeMap<String, u32>Negotiated wire function versions: function_name -> negotiated_version. Ordered via BTreeMap for deterministic serialization.
negotiated_capabilities: BTreeSet<String>Negotiated capabilities offered by the plugin. Ordered via BTreeSet for deterministic serialization.
handshake_completed_at: i64Unix timestamp (seconds) when handshake was completed.
self_check_passed: boolWhether the self-check passed successfully.
self_check_completed_at: i64Unix timestamp (seconds) when self-check was completed.
expires_at: i64Unix timestamp (seconds) when this metadata expires and re-handshake is needed.
Implementations§
Source§impl AugmentedMetadata
impl AugmentedMetadata
Sourcepub fn validate(&self) -> Result<(), AugmentedMetadataError>
pub fn validate(&self) -> Result<(), AugmentedMetadataError>
Validate this augmented metadata.
Sourcepub fn check_size_limit(&self) -> Result<(), AugmentedMetadataError>
pub fn check_size_limit(&self) -> Result<(), AugmentedMetadataError>
Check that serialized size does not exceed AUGMENTED_METADATA_MAX_BYTES.
Sourcepub fn from_handshake_and_self_check(
identity: PluginIdentity,
negotiated_functions: BTreeMap<String, u32>,
negotiated_capabilities: BTreeSet<String>,
handshake_completed_at: i64,
self_check_passed: bool,
self_check_completed_at: i64,
ttl_seconds: u64,
) -> Result<Self, AugmentedMetadataError>
pub fn from_handshake_and_self_check( identity: PluginIdentity, negotiated_functions: BTreeMap<String, u32>, negotiated_capabilities: BTreeSet<String>, handshake_completed_at: i64, self_check_passed: bool, self_check_completed_at: i64, ttl_seconds: u64, ) -> Result<Self, AugmentedMetadataError>
Create AugmentedMetadata from handshake and self-check responses.
Combines:
- Plugin identity from handshake
- Negotiated functions and capabilities from handshake
- Self-check result
§Arguments
identity- The plugin’s identity metadatanegotiated_functions- BTreeMap of function_name -> negotiated_versionnegotiated_capabilities- BTreeSet of negotiated capability nameshandshake_completed_at- Timestamp when handshake completedself_check_passed- Whether self-check passedself_check_completed_at- Timestamp when self-check completedttl_seconds- TTL for this metadata in seconds
Sourcepub fn is_expired(&self, now_timestamp: i64) -> bool
pub fn is_expired(&self, now_timestamp: i64) -> bool
Check if this metadata has expired.
Sourcepub fn ttl_seconds(&self, now_timestamp: i64) -> i64
pub fn ttl_seconds(&self, now_timestamp: i64) -> i64
Get the TTL remaining in seconds.
Trait Implementations§
Source§impl Clone for AugmentedMetadata
impl Clone for AugmentedMetadata
Source§fn clone(&self) -> AugmentedMetadata
fn clone(&self) -> AugmentedMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AugmentedMetadata
impl Debug for AugmentedMetadata
Source§impl<'de> Deserialize<'de> for AugmentedMetadata
impl<'de> Deserialize<'de> for AugmentedMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AugmentedMetadata
Source§impl PartialEq for AugmentedMetadata
impl PartialEq for AugmentedMetadata
Source§fn eq(&self, other: &AugmentedMetadata) -> bool
fn eq(&self, other: &AugmentedMetadata) -> bool
self and other values to be equal, and is used by ==.