opensearch-client 0.3.2

Strongly typed OpenSearch Client
Documentation
/*
 * opensearch-client
 *
 * Rust Client for OpenSearch
 *
 * The version of the OpenAPI document: 3.1.0
 * Contact: alberto.paro@gmail.com
 * Generated by Paro OpenAPI Generator
 */

use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct QueryCacheStats {
    /// The total number of hits and misses stored in the query cache across all shards assigned to the selected nodes.
    #[serde(rename = "total_count")]
    pub total_count: u32,
    /// The total number of entries currently stored in the query cache across all shards assigned to the selected nodes.
    #[serde(rename = "cache_size")]
    pub cache_size: u32,
    #[serde(
        rename = "memory_size",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub memory_size: Option<String>,
    /// The total number of query cache hits across all shards assigned to the selected nodes.
    #[serde(rename = "hit_count")]
    pub hit_count: u32,
    /// The total number of entries added to the query cache across all shards assigned to the selected nodes.
    /// This number includes all current and evicted entries.
    #[serde(rename = "cache_count")]
    pub cache_count: u32,
    /// The total number of query cache misses across all shards assigned to the selected nodes.
    #[serde(rename = "miss_count")]
    pub miss_count: u32,
    /// The total number of query cache evictions across all shards assigned to the selected nodes.
    #[serde(rename = "evictions")]
    pub evictions: u32,
    #[serde(rename = "memory_size_in_bytes")]
    pub memory_size_in_bytes: u32,
}

impl QueryCacheStats {
    pub fn new(
        total_count: u32,
        cache_size: u32,
        hit_count: u32,
        cache_count: u32,
        miss_count: u32,
        evictions: u32,
        memory_size_in_bytes: u32,
    ) -> QueryCacheStats {
        QueryCacheStats {
            total_count,
            cache_size,
            memory_size: None,
            hit_count,
            cache_count,
            miss_count,
            evictions,
            memory_size_in_bytes,
        }
    }
}