greptime-proto 0.1.0

Rust protobuf bindings for GreptimeDB APIs.
Documentation
// Copyright 2023 Greptime Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file is @generated by prost-build.
/// BloomFilterMeta defines the metadata for a bloom filter.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BloomFilterMeta {
    /// The number of rows per segment.
    #[prost(uint64, tag = "1")]
    pub rows_per_segment: u64,
    /// The number of segments.
    #[prost(uint64, tag = "2")]
    pub segment_count: u64,
    /// The number of total rows.
    #[prost(uint64, tag = "3")]
    pub row_count: u64,
    /// The size of the bloom filter in bytes excluding the metadata.
    #[prost(uint64, tag = "4")]
    pub bloom_filter_size: u64,
    /// The indices to the bloom filter location of each segment.
    #[prost(uint64, repeated, tag = "5")]
    pub segment_loc_indices: ::prost::alloc::vec::Vec<u64>,
    /// The bloom filter locations.
    #[prost(message, repeated, tag = "6")]
    pub bloom_filter_locs: ::prost::alloc::vec::Vec<BloomFilterLoc>,
}
/// BloomFilterLoc defines the location of a bloom filter.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BloomFilterLoc {
    /// The byte offset of the bloom filter data.
    #[prost(uint64, tag = "1")]
    pub offset: u64,
    /// The size of the bloom filter data.
    #[prost(uint64, tag = "2")]
    pub size: u64,
    /// The number of elements in the bloom filter.
    #[prost(uint64, tag = "3")]
    pub element_count: u64,
}
/// InvertedIndexMetas defines the metadata for an inverted index
/// within an inverted index blob.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InvertedIndexMetas {
    /// A map of tag names to their respective metadata corresponding to an individual
    /// inverted index within the inverted index blob.
    #[prost(map = "string, message", tag = "1")]
    pub metas: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        InvertedIndexMeta,
    >,
    /// The total count of rows within the inverted index blob.
    /// This is used to determine the number of segments within the bitmap.
    #[prost(uint64, tag = "2")]
    pub total_row_count: u64,
    /// The number of rows per group for bitmap indexing which determines how rows are
    /// batched for indexing. Each batch corresponds to a segment in the bitmap and allows
    /// for efficient retrieval during queries by reducing the search space.
    #[prost(uint64, tag = "3")]
    pub segment_row_count: u64,
}
/// InvertedIndexMeta contains the metadata for a specific tag's inverted index.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InvertedIndexMeta {
    /// Name of the tag associated with the inverted index.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// The base byte offset for this tag's inverted index data within the blob.
    /// Other offsets in this message are relative to this base offset.
    #[prost(uint64, tag = "2")]
    pub base_offset: u64,
    /// The total size in bytes of this tag's inverted index data, including bitmaps,
    /// FST data.
    #[prost(uint64, tag = "3")]
    pub inverted_index_size: u64,
    /// The byte offset of the Finite State Transducer (FST) data relative to the `base_offset`.
    #[prost(uint32, tag = "4")]
    pub relative_fst_offset: u32,
    /// The size in bytes of the FST data.
    #[prost(uint32, tag = "5")]
    pub fst_size: u32,
    /// The byte offset relative to the `base_offset` where the null bitmap for this tag
    /// starts.
    #[prost(uint32, tag = "6")]
    pub relative_null_bitmap_offset: u32,
    /// The size in bytes of the null bitmap.
    #[prost(uint32, tag = "7")]
    pub null_bitmap_size: u32,
    /// Statistical information about the tag's inverted index.
    #[prost(message, optional, tag = "8")]
    pub stats: ::core::option::Option<InvertedIndexStats>,
    /// The type of bitmap used for indexing.
    #[prost(enumeration = "BitmapType", tag = "9")]
    pub bitmap_type: i32,
}
/// InvertedIndexStats provides statistical data on a tag's inverted index.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InvertedIndexStats {
    /// The count of null entries within the tag's column.
    #[prost(uint64, tag = "1")]
    pub null_count: u64,
    /// The number of distinct values within the tag's column.
    #[prost(uint64, tag = "2")]
    pub distinct_count: u64,
    /// The minimum value found within the tag's column, encoded as bytes.
    #[prost(bytes = "vec", tag = "3")]
    pub min_value: ::prost::alloc::vec::Vec<u8>,
    /// The maximum value found within the tag's column, encoded as bytes.
    #[prost(bytes = "vec", tag = "4")]
    pub max_value: ::prost::alloc::vec::Vec<u8>,
}
/// BitmapType defines the type of bitmap used for indexing.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum BitmapType {
    BitVec = 0,
    Roaring = 1,
}
impl BitmapType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::BitVec => "BitVec",
            Self::Roaring => "Roaring",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "BitVec" => Some(Self::BitVec),
            "Roaring" => Some(Self::Roaring),
            _ => None,
        }
    }
}
/// Metadata for a vector index blob (stored as footer).
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct VectorIndexMeta {
    /// Index engine type.
    #[prost(enumeration = "VectorIndexEngine", tag = "1")]
    pub engine: i32,
    /// Vector dimension.
    #[prost(uint32, tag = "2")]
    pub dim: u32,
    /// Distance metric.
    #[prost(enumeration = "VectorDistanceMetric", tag = "3")]
    pub metric: i32,
    /// HNSW connectivity parameter.
    #[prost(uint32, tag = "4")]
    pub connectivity: u32,
    /// HNSW expansion factor during index construction.
    #[prost(uint32, tag = "5")]
    pub expansion_add: u32,
    /// HNSW expansion factor during search.
    #[prost(uint32, tag = "6")]
    pub expansion_search: u32,
    /// Byte length of the null bitmap (RoaringBitmap serialized).
    #[prost(uint32, tag = "7")]
    pub null_bitmap_size: u32,
    /// Byte length of the vector index data (engine-specific serialized format).
    #[prost(uint64, tag = "8")]
    pub index_size: u64,
    /// Statistics about the vector index.
    #[prost(message, optional, tag = "9")]
    pub stats: ::core::option::Option<VectorIndexStats>,
}
/// Statistics for a vector index.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct VectorIndexStats {
    /// Total number of rows in the SST.
    #[prost(uint64, tag = "1")]
    pub total_row_count: u64,
    /// Number of rows with valid vectors (indexed).
    #[prost(uint64, tag = "2")]
    pub indexed_row_count: u64,
    /// Number of null vectors.
    #[prost(uint64, tag = "3")]
    pub null_count: u64,
}
/// Vector index engine types.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum VectorIndexEngine {
    Usearch = 0,
}
impl VectorIndexEngine {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Usearch => "VECTOR_INDEX_ENGINE_USEARCH",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "VECTOR_INDEX_ENGINE_USEARCH" => Some(Self::Usearch),
            _ => None,
        }
    }
}
/// Vector distance metrics.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum VectorDistanceMetric {
    L2sq = 0,
    Cosine = 1,
    InnerProduct = 2,
}
impl VectorDistanceMetric {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::L2sq => "VECTOR_DISTANCE_METRIC_L2SQ",
            Self::Cosine => "VECTOR_DISTANCE_METRIC_COSINE",
            Self::InnerProduct => "VECTOR_DISTANCE_METRIC_INNER_PRODUCT",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "VECTOR_DISTANCE_METRIC_L2SQ" => Some(Self::L2sq),
            "VECTOR_DISTANCE_METRIC_COSINE" => Some(Self::Cosine),
            "VECTOR_DISTANCE_METRIC_INNER_PRODUCT" => Some(Self::InnerProduct),
            _ => None,
        }
    }
}