From f1e0ea3a71336b92bcec253b5668d5274609ff1b Mon Sep 17 00:00:00 2001 From: dennis zhuang Date: Thu, 5 Feb 2026 10:02:37 +0800 Subject: [PATCH] feat: adds vector index meta (#307) Signed-off-by: Dennis Zhuang --- build.rs | 1 + c++/greptime/v1/index/vector_index.grpc.pb.cc | 29 + c++/greptime/v1/index/vector_index.grpc.pb.h | 52 + c++/greptime/v1/index/vector_index.pb.cc | 826 ++++++ c++/greptime/v1/index/vector_index.pb.h | 888 ++++++ go/greptime/v1/index/vector_index.pb.go | 460 +++ .../java/greptime/v1/index/VectorIndex.java | 2518 +++++++++++++++++ proto/greptime/v1/index/vector_index.proto | 73 + 8 files changed, 4847 insertions(+) create mode 100644 c++/greptime/v1/index/vector_index.grpc.pb.cc create mode 100644 c++/greptime/v1/index/vector_index.grpc.pb.h create mode 100644 c++/greptime/v1/index/vector_index.pb.cc create mode 100644 c++/greptime/v1/index/vector_index.pb.h create mode 100644 go/greptime/v1/index/vector_index.pb.go create mode 100644 java/src/main/java/greptime/v1/index/VectorIndex.java create mode 100644 proto/greptime/v1/index/vector_index.proto diff --git a/build.rs b/build.rs index e5d6214..0e34f42 100644 --- a/build.rs +++ b/build.rs @@ -70,6 +70,7 @@ fn main() { "proto/greptime/v1/frontend/server.proto", "proto/greptime/v1/index/bloom_filter.proto", "proto/greptime/v1/index/inverted_index.proto", + "proto/greptime/v1/index/vector_index.proto", "proto/prometheus/remote/remote.proto", "proto/substrait_extension/promql_plan.proto", "proto/substrait_extension/dist_plan.proto", diff --git a/c++/greptime/v1/index/vector_index.grpc.pb.cc b/c++/greptime/v1/index/vector_index.grpc.pb.cc new file mode 100644 index 0000000..69f5553 --- /dev/null +++ b/c++/greptime/v1/index/vector_index.grpc.pb.cc @@ -0,0 +1,29 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: greptime/v1/index/vector_index.proto + +#include "greptime/v1/index/vector_index.pb.h" +#include "greptime/v1/index/vector_index.grpc.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace greptime { +namespace v1 { +namespace index { + +} // namespace greptime +} // namespace v1 +} // namespace index + diff --git a/c++/greptime/v1/index/vector_index.grpc.pb.h b/c++/greptime/v1/index/vector_index.grpc.pb.h new file mode 100644 index 0000000..2a3d9b1 --- /dev/null +++ b/c++/greptime/v1/index/vector_index.grpc.pb.h @@ -0,0 +1,52 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: greptime/v1/index/vector_index.proto +// Original file comments: +// 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. +// +#ifndef GRPC_greptime_2fv1_2findex_2fvector_5findex_2eproto__INCLUDED +#define GRPC_greptime_2fv1_2findex_2fvector_5findex_2eproto__INCLUDED + +#include "greptime/v1/index/vector_index.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace greptime { +namespace v1 { +namespace index { + +} // namespace index +} // namespace v1 +} // namespace greptime + + +#endif // GRPC_greptime_2fv1_2findex_2fvector_5findex_2eproto__INCLUDED diff --git a/c++/greptime/v1/index/vector_index.pb.cc b/c++/greptime/v1/index/vector_index.pb.cc new file mode 100644 index 0000000..dbcd634 --- /dev/null +++ b/c++/greptime/v1/index/vector_index.pb.cc @@ -0,0 +1,826 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: greptime/v1/index/vector_index.proto + +#include "greptime/v1/index/vector_index.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG + +namespace _pb = ::PROTOBUF_NAMESPACE_ID; +namespace _pbi = _pb::internal; + +namespace greptime { +namespace v1 { +namespace index { +PROTOBUF_CONSTEXPR VectorIndexMeta::VectorIndexMeta( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.stats_)*/nullptr + , /*decltype(_impl_.engine_)*/0 + , /*decltype(_impl_.dim_)*/0u + , /*decltype(_impl_.metric_)*/0 + , /*decltype(_impl_.connectivity_)*/0u + , /*decltype(_impl_.expansion_add_)*/0u + , /*decltype(_impl_.expansion_search_)*/0u + , /*decltype(_impl_.index_size_)*/uint64_t{0u} + , /*decltype(_impl_.null_bitmap_size_)*/0u + , /*decltype(_impl_._cached_size_)*/{}} {} +struct VectorIndexMetaDefaultTypeInternal { + PROTOBUF_CONSTEXPR VectorIndexMetaDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~VectorIndexMetaDefaultTypeInternal() {} + union { + VectorIndexMeta _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 VectorIndexMetaDefaultTypeInternal _VectorIndexMeta_default_instance_; +PROTOBUF_CONSTEXPR VectorIndexStats::VectorIndexStats( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.total_row_count_)*/uint64_t{0u} + , /*decltype(_impl_.indexed_row_count_)*/uint64_t{0u} + , /*decltype(_impl_.null_count_)*/uint64_t{0u} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct VectorIndexStatsDefaultTypeInternal { + PROTOBUF_CONSTEXPR VectorIndexStatsDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~VectorIndexStatsDefaultTypeInternal() {} + union { + VectorIndexStats _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 VectorIndexStatsDefaultTypeInternal _VectorIndexStats_default_instance_; +} // namespace index +} // namespace v1 +} // namespace greptime +static ::_pb::Metadata file_level_metadata_greptime_2fv1_2findex_2fvector_5findex_2eproto[2]; +static const ::_pb::EnumDescriptor* file_level_enum_descriptors_greptime_2fv1_2findex_2fvector_5findex_2eproto[2]; +static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_greptime_2fv1_2findex_2fvector_5findex_2eproto = nullptr; + +const uint32_t TableStruct_greptime_2fv1_2findex_2fvector_5findex_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.engine_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.dim_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.metric_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.connectivity_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.expansion_add_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.expansion_search_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.null_bitmap_size_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.index_size_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexMeta, _impl_.stats_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexStats, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexStats, _impl_.total_row_count_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexStats, _impl_.indexed_row_count_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::index::VectorIndexStats, _impl_.null_count_), +}; +static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::greptime::v1::index::VectorIndexMeta)}, + { 15, -1, -1, sizeof(::greptime::v1::index::VectorIndexStats)}, +}; + +static const ::_pb::Message* const file_default_instances[] = { + &::greptime::v1::index::_VectorIndexMeta_default_instance_._instance, + &::greptime::v1::index::_VectorIndexStats_default_instance_._instance, +}; + +const char descriptor_table_protodef_greptime_2fv1_2findex_2fvector_5findex_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n$greptime/v1/index/vector_index.proto\022\021" + "greptime.v1.index\"\266\002\n\017VectorIndexMeta\0224\n" + "\006engine\030\001 \001(\0162$.greptime.v1.index.Vector" + "IndexEngine\022\013\n\003dim\030\002 \001(\r\0227\n\006metric\030\003 \001(\016" + "2\'.greptime.v1.index.VectorDistanceMetri" + "c\022\024\n\014connectivity\030\004 \001(\r\022\025\n\rexpansion_add" + "\030\005 \001(\r\022\030\n\020expansion_search\030\006 \001(\r\022\030\n\020null" + "_bitmap_size\030\007 \001(\r\022\022\n\nindex_size\030\010 \001(\004\0222" + "\n\005stats\030\t \001(\0132#.greptime.v1.index.Vector" + "IndexStats\"Z\n\020VectorIndexStats\022\027\n\017total_" + "row_count\030\001 \001(\004\022\031\n\021indexed_row_count\030\002 \001" + "(\004\022\022\n\nnull_count\030\003 \001(\004*4\n\021VectorIndexEng" + "ine\022\037\n\033VECTOR_INDEX_ENGINE_USEARCH\020\000*\204\001\n" + "\024VectorDistanceMetric\022\037\n\033VECTOR_DISTANCE" + "_METRIC_L2SQ\020\000\022!\n\035VECTOR_DISTANCE_METRIC" + "_COSINE\020\001\022(\n$VECTOR_DISTANCE_METRIC_INNE" + "R_PRODUCT\020\002B=Z;github.com/GreptimeTeam/g" + "reptime-proto/go/greptime/v1/indexb\006prot" + "o3" + ; +static ::_pbi::once_flag descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto_once; +const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto = { + false, false, 722, descriptor_table_protodef_greptime_2fv1_2findex_2fvector_5findex_2eproto, + "greptime/v1/index/vector_index.proto", + &descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto_once, nullptr, 0, 2, + schemas, file_default_instances, TableStruct_greptime_2fv1_2findex_2fvector_5findex_2eproto::offsets, + file_level_metadata_greptime_2fv1_2findex_2fvector_5findex_2eproto, file_level_enum_descriptors_greptime_2fv1_2findex_2fvector_5findex_2eproto, + file_level_service_descriptors_greptime_2fv1_2findex_2fvector_5findex_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto_getter() { + return &descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_greptime_2fv1_2findex_2fvector_5findex_2eproto(&descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto); +namespace greptime { +namespace v1 { +namespace index { +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* VectorIndexEngine_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto); + return file_level_enum_descriptors_greptime_2fv1_2findex_2fvector_5findex_2eproto[0]; +} +bool VectorIndexEngine_IsValid(int value) { + switch (value) { + case 0: + return true; + default: + return false; + } +} + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* VectorDistanceMetric_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto); + return file_level_enum_descriptors_greptime_2fv1_2findex_2fvector_5findex_2eproto[1]; +} +bool VectorDistanceMetric_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + + +// =================================================================== + +class VectorIndexMeta::_Internal { + public: + static const ::greptime::v1::index::VectorIndexStats& stats(const VectorIndexMeta* msg); +}; + +const ::greptime::v1::index::VectorIndexStats& +VectorIndexMeta::_Internal::stats(const VectorIndexMeta* msg) { + return *msg->_impl_.stats_; +} +VectorIndexMeta::VectorIndexMeta(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:greptime.v1.index.VectorIndexMeta) +} +VectorIndexMeta::VectorIndexMeta(const VectorIndexMeta& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + VectorIndexMeta* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.stats_){nullptr} + , decltype(_impl_.engine_){} + , decltype(_impl_.dim_){} + , decltype(_impl_.metric_){} + , decltype(_impl_.connectivity_){} + , decltype(_impl_.expansion_add_){} + , decltype(_impl_.expansion_search_){} + , decltype(_impl_.index_size_){} + , decltype(_impl_.null_bitmap_size_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + if (from._internal_has_stats()) { + _this->_impl_.stats_ = new ::greptime::v1::index::VectorIndexStats(*from._impl_.stats_); + } + ::memcpy(&_impl_.engine_, &from._impl_.engine_, + static_cast(reinterpret_cast(&_impl_.null_bitmap_size_) - + reinterpret_cast(&_impl_.engine_)) + sizeof(_impl_.null_bitmap_size_)); + // @@protoc_insertion_point(copy_constructor:greptime.v1.index.VectorIndexMeta) +} + +inline void VectorIndexMeta::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.stats_){nullptr} + , decltype(_impl_.engine_){0} + , decltype(_impl_.dim_){0u} + , decltype(_impl_.metric_){0} + , decltype(_impl_.connectivity_){0u} + , decltype(_impl_.expansion_add_){0u} + , decltype(_impl_.expansion_search_){0u} + , decltype(_impl_.index_size_){uint64_t{0u}} + , decltype(_impl_.null_bitmap_size_){0u} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +VectorIndexMeta::~VectorIndexMeta() { + // @@protoc_insertion_point(destructor:greptime.v1.index.VectorIndexMeta) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void VectorIndexMeta::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete _impl_.stats_; +} + +void VectorIndexMeta::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void VectorIndexMeta::Clear() { +// @@protoc_insertion_point(message_clear_start:greptime.v1.index.VectorIndexMeta) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (GetArenaForAllocation() == nullptr && _impl_.stats_ != nullptr) { + delete _impl_.stats_; + } + _impl_.stats_ = nullptr; + ::memset(&_impl_.engine_, 0, static_cast( + reinterpret_cast(&_impl_.null_bitmap_size_) - + reinterpret_cast(&_impl_.engine_)) + sizeof(_impl_.null_bitmap_size_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* VectorIndexMeta::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // .greptime.v1.index.VectorIndexEngine engine = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_engine(static_cast<::greptime::v1::index::VectorIndexEngine>(val)); + } else + goto handle_unusual; + continue; + // uint32 dim = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _impl_.dim_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .greptime.v1.index.VectorDistanceMetric metric = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_metric(static_cast<::greptime::v1::index::VectorDistanceMetric>(val)); + } else + goto handle_unusual; + continue; + // uint32 connectivity = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _impl_.connectivity_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 expansion_add = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _impl_.expansion_add_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 expansion_search = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + _impl_.expansion_search_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 null_bitmap_size = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + _impl_.null_bitmap_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 index_size = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 64)) { + _impl_.index_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .greptime.v1.index.VectorIndexStats stats = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) { + ptr = ctx->ParseMessage(_internal_mutable_stats(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* VectorIndexMeta::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:greptime.v1.index.VectorIndexMeta) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // .greptime.v1.index.VectorIndexEngine engine = 1; + if (this->_internal_engine() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this->_internal_engine(), target); + } + + // uint32 dim = 2; + if (this->_internal_dim() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_dim(), target); + } + + // .greptime.v1.index.VectorDistanceMetric metric = 3; + if (this->_internal_metric() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this->_internal_metric(), target); + } + + // uint32 connectivity = 4; + if (this->_internal_connectivity() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_connectivity(), target); + } + + // uint32 expansion_add = 5; + if (this->_internal_expansion_add() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(5, this->_internal_expansion_add(), target); + } + + // uint32 expansion_search = 6; + if (this->_internal_expansion_search() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(6, this->_internal_expansion_search(), target); + } + + // uint32 null_bitmap_size = 7; + if (this->_internal_null_bitmap_size() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(7, this->_internal_null_bitmap_size(), target); + } + + // uint64 index_size = 8; + if (this->_internal_index_size() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(8, this->_internal_index_size(), target); + } + + // .greptime.v1.index.VectorIndexStats stats = 9; + if (this->_internal_has_stats()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(9, _Internal::stats(this), + _Internal::stats(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:greptime.v1.index.VectorIndexMeta) + return target; +} + +size_t VectorIndexMeta::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:greptime.v1.index.VectorIndexMeta) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // .greptime.v1.index.VectorIndexStats stats = 9; + if (this->_internal_has_stats()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.stats_); + } + + // .greptime.v1.index.VectorIndexEngine engine = 1; + if (this->_internal_engine() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_engine()); + } + + // uint32 dim = 2; + if (this->_internal_dim() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_dim()); + } + + // .greptime.v1.index.VectorDistanceMetric metric = 3; + if (this->_internal_metric() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_metric()); + } + + // uint32 connectivity = 4; + if (this->_internal_connectivity() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_connectivity()); + } + + // uint32 expansion_add = 5; + if (this->_internal_expansion_add() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_expansion_add()); + } + + // uint32 expansion_search = 6; + if (this->_internal_expansion_search() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_expansion_search()); + } + + // uint64 index_size = 8; + if (this->_internal_index_size() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_index_size()); + } + + // uint32 null_bitmap_size = 7; + if (this->_internal_null_bitmap_size() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_null_bitmap_size()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData VectorIndexMeta::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + VectorIndexMeta::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*VectorIndexMeta::GetClassData() const { return &_class_data_; } + + +void VectorIndexMeta::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:greptime.v1.index.VectorIndexMeta) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_stats()) { + _this->_internal_mutable_stats()->::greptime::v1::index::VectorIndexStats::MergeFrom( + from._internal_stats()); + } + if (from._internal_engine() != 0) { + _this->_internal_set_engine(from._internal_engine()); + } + if (from._internal_dim() != 0) { + _this->_internal_set_dim(from._internal_dim()); + } + if (from._internal_metric() != 0) { + _this->_internal_set_metric(from._internal_metric()); + } + if (from._internal_connectivity() != 0) { + _this->_internal_set_connectivity(from._internal_connectivity()); + } + if (from._internal_expansion_add() != 0) { + _this->_internal_set_expansion_add(from._internal_expansion_add()); + } + if (from._internal_expansion_search() != 0) { + _this->_internal_set_expansion_search(from._internal_expansion_search()); + } + if (from._internal_index_size() != 0) { + _this->_internal_set_index_size(from._internal_index_size()); + } + if (from._internal_null_bitmap_size() != 0) { + _this->_internal_set_null_bitmap_size(from._internal_null_bitmap_size()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void VectorIndexMeta::CopyFrom(const VectorIndexMeta& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:greptime.v1.index.VectorIndexMeta) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool VectorIndexMeta::IsInitialized() const { + return true; +} + +void VectorIndexMeta::InternalSwap(VectorIndexMeta* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(VectorIndexMeta, _impl_.null_bitmap_size_) + + sizeof(VectorIndexMeta::_impl_.null_bitmap_size_) + - PROTOBUF_FIELD_OFFSET(VectorIndexMeta, _impl_.stats_)>( + reinterpret_cast(&_impl_.stats_), + reinterpret_cast(&other->_impl_.stats_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata VectorIndexMeta::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto_getter, &descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto_once, + file_level_metadata_greptime_2fv1_2findex_2fvector_5findex_2eproto[0]); +} + +// =================================================================== + +class VectorIndexStats::_Internal { + public: +}; + +VectorIndexStats::VectorIndexStats(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:greptime.v1.index.VectorIndexStats) +} +VectorIndexStats::VectorIndexStats(const VectorIndexStats& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + VectorIndexStats* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.total_row_count_){} + , decltype(_impl_.indexed_row_count_){} + , decltype(_impl_.null_count_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::memcpy(&_impl_.total_row_count_, &from._impl_.total_row_count_, + static_cast(reinterpret_cast(&_impl_.null_count_) - + reinterpret_cast(&_impl_.total_row_count_)) + sizeof(_impl_.null_count_)); + // @@protoc_insertion_point(copy_constructor:greptime.v1.index.VectorIndexStats) +} + +inline void VectorIndexStats::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.total_row_count_){uint64_t{0u}} + , decltype(_impl_.indexed_row_count_){uint64_t{0u}} + , decltype(_impl_.null_count_){uint64_t{0u}} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +VectorIndexStats::~VectorIndexStats() { + // @@protoc_insertion_point(destructor:greptime.v1.index.VectorIndexStats) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void VectorIndexStats::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void VectorIndexStats::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void VectorIndexStats::Clear() { +// @@protoc_insertion_point(message_clear_start:greptime.v1.index.VectorIndexStats) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&_impl_.total_row_count_, 0, static_cast( + reinterpret_cast(&_impl_.null_count_) - + reinterpret_cast(&_impl_.total_row_count_)) + sizeof(_impl_.null_count_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* VectorIndexStats::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint64 total_row_count = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _impl_.total_row_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 indexed_row_count = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _impl_.indexed_row_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 null_count = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _impl_.null_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* VectorIndexStats::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:greptime.v1.index.VectorIndexStats) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint64 total_row_count = 1; + if (this->_internal_total_row_count() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_total_row_count(), target); + } + + // uint64 indexed_row_count = 2; + if (this->_internal_indexed_row_count() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_indexed_row_count(), target); + } + + // uint64 null_count = 3; + if (this->_internal_null_count() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(3, this->_internal_null_count(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:greptime.v1.index.VectorIndexStats) + return target; +} + +size_t VectorIndexStats::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:greptime.v1.index.VectorIndexStats) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint64 total_row_count = 1; + if (this->_internal_total_row_count() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_total_row_count()); + } + + // uint64 indexed_row_count = 2; + if (this->_internal_indexed_row_count() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_indexed_row_count()); + } + + // uint64 null_count = 3; + if (this->_internal_null_count() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_null_count()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData VectorIndexStats::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + VectorIndexStats::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*VectorIndexStats::GetClassData() const { return &_class_data_; } + + +void VectorIndexStats::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:greptime.v1.index.VectorIndexStats) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_total_row_count() != 0) { + _this->_internal_set_total_row_count(from._internal_total_row_count()); + } + if (from._internal_indexed_row_count() != 0) { + _this->_internal_set_indexed_row_count(from._internal_indexed_row_count()); + } + if (from._internal_null_count() != 0) { + _this->_internal_set_null_count(from._internal_null_count()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void VectorIndexStats::CopyFrom(const VectorIndexStats& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:greptime.v1.index.VectorIndexStats) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool VectorIndexStats::IsInitialized() const { + return true; +} + +void VectorIndexStats::InternalSwap(VectorIndexStats* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(VectorIndexStats, _impl_.null_count_) + + sizeof(VectorIndexStats::_impl_.null_count_) + - PROTOBUF_FIELD_OFFSET(VectorIndexStats, _impl_.total_row_count_)>( + reinterpret_cast(&_impl_.total_row_count_), + reinterpret_cast(&other->_impl_.total_row_count_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata VectorIndexStats::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto_getter, &descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto_once, + file_level_metadata_greptime_2fv1_2findex_2fvector_5findex_2eproto[1]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace index +} // namespace v1 +} // namespace greptime +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::greptime::v1::index::VectorIndexMeta* +Arena::CreateMaybeMessage< ::greptime::v1::index::VectorIndexMeta >(Arena* arena) { + return Arena::CreateMessageInternal< ::greptime::v1::index::VectorIndexMeta >(arena); +} +template<> PROTOBUF_NOINLINE ::greptime::v1::index::VectorIndexStats* +Arena::CreateMaybeMessage< ::greptime::v1::index::VectorIndexStats >(Arena* arena) { + return Arena::CreateMessageInternal< ::greptime::v1::index::VectorIndexStats >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/c++/greptime/v1/index/vector_index.pb.h b/c++/greptime/v1/index/vector_index.pb.h new file mode 100644 index 0000000..b14cbf4 --- /dev/null +++ b/c++/greptime/v1/index/vector_index.pb.h @@ -0,0 +1,888 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: greptime/v1/index/vector_index.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_greptime_2fv1_2findex_2fvector_5findex_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_greptime_2fv1_2findex_2fvector_5findex_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3021006 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_greptime_2fv1_2findex_2fvector_5findex_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_greptime_2fv1_2findex_2fvector_5findex_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_greptime_2fv1_2findex_2fvector_5findex_2eproto; +namespace greptime { +namespace v1 { +namespace index { +class VectorIndexMeta; +struct VectorIndexMetaDefaultTypeInternal; +extern VectorIndexMetaDefaultTypeInternal _VectorIndexMeta_default_instance_; +class VectorIndexStats; +struct VectorIndexStatsDefaultTypeInternal; +extern VectorIndexStatsDefaultTypeInternal _VectorIndexStats_default_instance_; +} // namespace index +} // namespace v1 +} // namespace greptime +PROTOBUF_NAMESPACE_OPEN +template<> ::greptime::v1::index::VectorIndexMeta* Arena::CreateMaybeMessage<::greptime::v1::index::VectorIndexMeta>(Arena*); +template<> ::greptime::v1::index::VectorIndexStats* Arena::CreateMaybeMessage<::greptime::v1::index::VectorIndexStats>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace greptime { +namespace v1 { +namespace index { + +enum VectorIndexEngine : int { + VECTOR_INDEX_ENGINE_USEARCH = 0, + VectorIndexEngine_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), + VectorIndexEngine_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() +}; +bool VectorIndexEngine_IsValid(int value); +constexpr VectorIndexEngine VectorIndexEngine_MIN = VECTOR_INDEX_ENGINE_USEARCH; +constexpr VectorIndexEngine VectorIndexEngine_MAX = VECTOR_INDEX_ENGINE_USEARCH; +constexpr int VectorIndexEngine_ARRAYSIZE = VectorIndexEngine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* VectorIndexEngine_descriptor(); +template +inline const std::string& VectorIndexEngine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function VectorIndexEngine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + VectorIndexEngine_descriptor(), enum_t_value); +} +inline bool VectorIndexEngine_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, VectorIndexEngine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + VectorIndexEngine_descriptor(), name, value); +} +enum VectorDistanceMetric : int { + VECTOR_DISTANCE_METRIC_L2SQ = 0, + VECTOR_DISTANCE_METRIC_COSINE = 1, + VECTOR_DISTANCE_METRIC_INNER_PRODUCT = 2, + VectorDistanceMetric_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), + VectorDistanceMetric_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() +}; +bool VectorDistanceMetric_IsValid(int value); +constexpr VectorDistanceMetric VectorDistanceMetric_MIN = VECTOR_DISTANCE_METRIC_L2SQ; +constexpr VectorDistanceMetric VectorDistanceMetric_MAX = VECTOR_DISTANCE_METRIC_INNER_PRODUCT; +constexpr int VectorDistanceMetric_ARRAYSIZE = VectorDistanceMetric_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* VectorDistanceMetric_descriptor(); +template +inline const std::string& VectorDistanceMetric_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function VectorDistanceMetric_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + VectorDistanceMetric_descriptor(), enum_t_value); +} +inline bool VectorDistanceMetric_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, VectorDistanceMetric* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + VectorDistanceMetric_descriptor(), name, value); +} +// =================================================================== + +class VectorIndexMeta final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:greptime.v1.index.VectorIndexMeta) */ { + public: + inline VectorIndexMeta() : VectorIndexMeta(nullptr) {} + ~VectorIndexMeta() override; + explicit PROTOBUF_CONSTEXPR VectorIndexMeta(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + VectorIndexMeta(const VectorIndexMeta& from); + VectorIndexMeta(VectorIndexMeta&& from) noexcept + : VectorIndexMeta() { + *this = ::std::move(from); + } + + inline VectorIndexMeta& operator=(const VectorIndexMeta& from) { + CopyFrom(from); + return *this; + } + inline VectorIndexMeta& operator=(VectorIndexMeta&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const VectorIndexMeta& default_instance() { + return *internal_default_instance(); + } + static inline const VectorIndexMeta* internal_default_instance() { + return reinterpret_cast( + &_VectorIndexMeta_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(VectorIndexMeta& a, VectorIndexMeta& b) { + a.Swap(&b); + } + inline void Swap(VectorIndexMeta* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(VectorIndexMeta* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + VectorIndexMeta* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const VectorIndexMeta& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const VectorIndexMeta& from) { + VectorIndexMeta::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(VectorIndexMeta* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "greptime.v1.index.VectorIndexMeta"; + } + protected: + explicit VectorIndexMeta(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStatsFieldNumber = 9, + kEngineFieldNumber = 1, + kDimFieldNumber = 2, + kMetricFieldNumber = 3, + kConnectivityFieldNumber = 4, + kExpansionAddFieldNumber = 5, + kExpansionSearchFieldNumber = 6, + kIndexSizeFieldNumber = 8, + kNullBitmapSizeFieldNumber = 7, + }; + // .greptime.v1.index.VectorIndexStats stats = 9; + bool has_stats() const; + private: + bool _internal_has_stats() const; + public: + void clear_stats(); + const ::greptime::v1::index::VectorIndexStats& stats() const; + PROTOBUF_NODISCARD ::greptime::v1::index::VectorIndexStats* release_stats(); + ::greptime::v1::index::VectorIndexStats* mutable_stats(); + void set_allocated_stats(::greptime::v1::index::VectorIndexStats* stats); + private: + const ::greptime::v1::index::VectorIndexStats& _internal_stats() const; + ::greptime::v1::index::VectorIndexStats* _internal_mutable_stats(); + public: + void unsafe_arena_set_allocated_stats( + ::greptime::v1::index::VectorIndexStats* stats); + ::greptime::v1::index::VectorIndexStats* unsafe_arena_release_stats(); + + // .greptime.v1.index.VectorIndexEngine engine = 1; + void clear_engine(); + ::greptime::v1::index::VectorIndexEngine engine() const; + void set_engine(::greptime::v1::index::VectorIndexEngine value); + private: + ::greptime::v1::index::VectorIndexEngine _internal_engine() const; + void _internal_set_engine(::greptime::v1::index::VectorIndexEngine value); + public: + + // uint32 dim = 2; + void clear_dim(); + uint32_t dim() const; + void set_dim(uint32_t value); + private: + uint32_t _internal_dim() const; + void _internal_set_dim(uint32_t value); + public: + + // .greptime.v1.index.VectorDistanceMetric metric = 3; + void clear_metric(); + ::greptime::v1::index::VectorDistanceMetric metric() const; + void set_metric(::greptime::v1::index::VectorDistanceMetric value); + private: + ::greptime::v1::index::VectorDistanceMetric _internal_metric() const; + void _internal_set_metric(::greptime::v1::index::VectorDistanceMetric value); + public: + + // uint32 connectivity = 4; + void clear_connectivity(); + uint32_t connectivity() const; + void set_connectivity(uint32_t value); + private: + uint32_t _internal_connectivity() const; + void _internal_set_connectivity(uint32_t value); + public: + + // uint32 expansion_add = 5; + void clear_expansion_add(); + uint32_t expansion_add() const; + void set_expansion_add(uint32_t value); + private: + uint32_t _internal_expansion_add() const; + void _internal_set_expansion_add(uint32_t value); + public: + + // uint32 expansion_search = 6; + void clear_expansion_search(); + uint32_t expansion_search() const; + void set_expansion_search(uint32_t value); + private: + uint32_t _internal_expansion_search() const; + void _internal_set_expansion_search(uint32_t value); + public: + + // uint64 index_size = 8; + void clear_index_size(); + uint64_t index_size() const; + void set_index_size(uint64_t value); + private: + uint64_t _internal_index_size() const; + void _internal_set_index_size(uint64_t value); + public: + + // uint32 null_bitmap_size = 7; + void clear_null_bitmap_size(); + uint32_t null_bitmap_size() const; + void set_null_bitmap_size(uint32_t value); + private: + uint32_t _internal_null_bitmap_size() const; + void _internal_set_null_bitmap_size(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:greptime.v1.index.VectorIndexMeta) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::greptime::v1::index::VectorIndexStats* stats_; + int engine_; + uint32_t dim_; + int metric_; + uint32_t connectivity_; + uint32_t expansion_add_; + uint32_t expansion_search_; + uint64_t index_size_; + uint32_t null_bitmap_size_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_greptime_2fv1_2findex_2fvector_5findex_2eproto; +}; +// ------------------------------------------------------------------- + +class VectorIndexStats final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:greptime.v1.index.VectorIndexStats) */ { + public: + inline VectorIndexStats() : VectorIndexStats(nullptr) {} + ~VectorIndexStats() override; + explicit PROTOBUF_CONSTEXPR VectorIndexStats(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + VectorIndexStats(const VectorIndexStats& from); + VectorIndexStats(VectorIndexStats&& from) noexcept + : VectorIndexStats() { + *this = ::std::move(from); + } + + inline VectorIndexStats& operator=(const VectorIndexStats& from) { + CopyFrom(from); + return *this; + } + inline VectorIndexStats& operator=(VectorIndexStats&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const VectorIndexStats& default_instance() { + return *internal_default_instance(); + } + static inline const VectorIndexStats* internal_default_instance() { + return reinterpret_cast( + &_VectorIndexStats_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(VectorIndexStats& a, VectorIndexStats& b) { + a.Swap(&b); + } + inline void Swap(VectorIndexStats* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(VectorIndexStats* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + VectorIndexStats* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const VectorIndexStats& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const VectorIndexStats& from) { + VectorIndexStats::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(VectorIndexStats* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "greptime.v1.index.VectorIndexStats"; + } + protected: + explicit VectorIndexStats(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kTotalRowCountFieldNumber = 1, + kIndexedRowCountFieldNumber = 2, + kNullCountFieldNumber = 3, + }; + // uint64 total_row_count = 1; + void clear_total_row_count(); + uint64_t total_row_count() const; + void set_total_row_count(uint64_t value); + private: + uint64_t _internal_total_row_count() const; + void _internal_set_total_row_count(uint64_t value); + public: + + // uint64 indexed_row_count = 2; + void clear_indexed_row_count(); + uint64_t indexed_row_count() const; + void set_indexed_row_count(uint64_t value); + private: + uint64_t _internal_indexed_row_count() const; + void _internal_set_indexed_row_count(uint64_t value); + public: + + // uint64 null_count = 3; + void clear_null_count(); + uint64_t null_count() const; + void set_null_count(uint64_t value); + private: + uint64_t _internal_null_count() const; + void _internal_set_null_count(uint64_t value); + public: + + // @@protoc_insertion_point(class_scope:greptime.v1.index.VectorIndexStats) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + uint64_t total_row_count_; + uint64_t indexed_row_count_; + uint64_t null_count_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_greptime_2fv1_2findex_2fvector_5findex_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// VectorIndexMeta + +// .greptime.v1.index.VectorIndexEngine engine = 1; +inline void VectorIndexMeta::clear_engine() { + _impl_.engine_ = 0; +} +inline ::greptime::v1::index::VectorIndexEngine VectorIndexMeta::_internal_engine() const { + return static_cast< ::greptime::v1::index::VectorIndexEngine >(_impl_.engine_); +} +inline ::greptime::v1::index::VectorIndexEngine VectorIndexMeta::engine() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.engine) + return _internal_engine(); +} +inline void VectorIndexMeta::_internal_set_engine(::greptime::v1::index::VectorIndexEngine value) { + + _impl_.engine_ = value; +} +inline void VectorIndexMeta::set_engine(::greptime::v1::index::VectorIndexEngine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexMeta.engine) +} + +// uint32 dim = 2; +inline void VectorIndexMeta::clear_dim() { + _impl_.dim_ = 0u; +} +inline uint32_t VectorIndexMeta::_internal_dim() const { + return _impl_.dim_; +} +inline uint32_t VectorIndexMeta::dim() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.dim) + return _internal_dim(); +} +inline void VectorIndexMeta::_internal_set_dim(uint32_t value) { + + _impl_.dim_ = value; +} +inline void VectorIndexMeta::set_dim(uint32_t value) { + _internal_set_dim(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexMeta.dim) +} + +// .greptime.v1.index.VectorDistanceMetric metric = 3; +inline void VectorIndexMeta::clear_metric() { + _impl_.metric_ = 0; +} +inline ::greptime::v1::index::VectorDistanceMetric VectorIndexMeta::_internal_metric() const { + return static_cast< ::greptime::v1::index::VectorDistanceMetric >(_impl_.metric_); +} +inline ::greptime::v1::index::VectorDistanceMetric VectorIndexMeta::metric() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.metric) + return _internal_metric(); +} +inline void VectorIndexMeta::_internal_set_metric(::greptime::v1::index::VectorDistanceMetric value) { + + _impl_.metric_ = value; +} +inline void VectorIndexMeta::set_metric(::greptime::v1::index::VectorDistanceMetric value) { + _internal_set_metric(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexMeta.metric) +} + +// uint32 connectivity = 4; +inline void VectorIndexMeta::clear_connectivity() { + _impl_.connectivity_ = 0u; +} +inline uint32_t VectorIndexMeta::_internal_connectivity() const { + return _impl_.connectivity_; +} +inline uint32_t VectorIndexMeta::connectivity() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.connectivity) + return _internal_connectivity(); +} +inline void VectorIndexMeta::_internal_set_connectivity(uint32_t value) { + + _impl_.connectivity_ = value; +} +inline void VectorIndexMeta::set_connectivity(uint32_t value) { + _internal_set_connectivity(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexMeta.connectivity) +} + +// uint32 expansion_add = 5; +inline void VectorIndexMeta::clear_expansion_add() { + _impl_.expansion_add_ = 0u; +} +inline uint32_t VectorIndexMeta::_internal_expansion_add() const { + return _impl_.expansion_add_; +} +inline uint32_t VectorIndexMeta::expansion_add() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.expansion_add) + return _internal_expansion_add(); +} +inline void VectorIndexMeta::_internal_set_expansion_add(uint32_t value) { + + _impl_.expansion_add_ = value; +} +inline void VectorIndexMeta::set_expansion_add(uint32_t value) { + _internal_set_expansion_add(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexMeta.expansion_add) +} + +// uint32 expansion_search = 6; +inline void VectorIndexMeta::clear_expansion_search() { + _impl_.expansion_search_ = 0u; +} +inline uint32_t VectorIndexMeta::_internal_expansion_search() const { + return _impl_.expansion_search_; +} +inline uint32_t VectorIndexMeta::expansion_search() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.expansion_search) + return _internal_expansion_search(); +} +inline void VectorIndexMeta::_internal_set_expansion_search(uint32_t value) { + + _impl_.expansion_search_ = value; +} +inline void VectorIndexMeta::set_expansion_search(uint32_t value) { + _internal_set_expansion_search(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexMeta.expansion_search) +} + +// uint32 null_bitmap_size = 7; +inline void VectorIndexMeta::clear_null_bitmap_size() { + _impl_.null_bitmap_size_ = 0u; +} +inline uint32_t VectorIndexMeta::_internal_null_bitmap_size() const { + return _impl_.null_bitmap_size_; +} +inline uint32_t VectorIndexMeta::null_bitmap_size() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.null_bitmap_size) + return _internal_null_bitmap_size(); +} +inline void VectorIndexMeta::_internal_set_null_bitmap_size(uint32_t value) { + + _impl_.null_bitmap_size_ = value; +} +inline void VectorIndexMeta::set_null_bitmap_size(uint32_t value) { + _internal_set_null_bitmap_size(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexMeta.null_bitmap_size) +} + +// uint64 index_size = 8; +inline void VectorIndexMeta::clear_index_size() { + _impl_.index_size_ = uint64_t{0u}; +} +inline uint64_t VectorIndexMeta::_internal_index_size() const { + return _impl_.index_size_; +} +inline uint64_t VectorIndexMeta::index_size() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.index_size) + return _internal_index_size(); +} +inline void VectorIndexMeta::_internal_set_index_size(uint64_t value) { + + _impl_.index_size_ = value; +} +inline void VectorIndexMeta::set_index_size(uint64_t value) { + _internal_set_index_size(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexMeta.index_size) +} + +// .greptime.v1.index.VectorIndexStats stats = 9; +inline bool VectorIndexMeta::_internal_has_stats() const { + return this != internal_default_instance() && _impl_.stats_ != nullptr; +} +inline bool VectorIndexMeta::has_stats() const { + return _internal_has_stats(); +} +inline void VectorIndexMeta::clear_stats() { + if (GetArenaForAllocation() == nullptr && _impl_.stats_ != nullptr) { + delete _impl_.stats_; + } + _impl_.stats_ = nullptr; +} +inline const ::greptime::v1::index::VectorIndexStats& VectorIndexMeta::_internal_stats() const { + const ::greptime::v1::index::VectorIndexStats* p = _impl_.stats_; + return p != nullptr ? *p : reinterpret_cast( + ::greptime::v1::index::_VectorIndexStats_default_instance_); +} +inline const ::greptime::v1::index::VectorIndexStats& VectorIndexMeta::stats() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexMeta.stats) + return _internal_stats(); +} +inline void VectorIndexMeta::unsafe_arena_set_allocated_stats( + ::greptime::v1::index::VectorIndexStats* stats) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.stats_); + } + _impl_.stats_ = stats; + if (stats) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:greptime.v1.index.VectorIndexMeta.stats) +} +inline ::greptime::v1::index::VectorIndexStats* VectorIndexMeta::release_stats() { + + ::greptime::v1::index::VectorIndexStats* temp = _impl_.stats_; + _impl_.stats_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::greptime::v1::index::VectorIndexStats* VectorIndexMeta::unsafe_arena_release_stats() { + // @@protoc_insertion_point(field_release:greptime.v1.index.VectorIndexMeta.stats) + + ::greptime::v1::index::VectorIndexStats* temp = _impl_.stats_; + _impl_.stats_ = nullptr; + return temp; +} +inline ::greptime::v1::index::VectorIndexStats* VectorIndexMeta::_internal_mutable_stats() { + + if (_impl_.stats_ == nullptr) { + auto* p = CreateMaybeMessage<::greptime::v1::index::VectorIndexStats>(GetArenaForAllocation()); + _impl_.stats_ = p; + } + return _impl_.stats_; +} +inline ::greptime::v1::index::VectorIndexStats* VectorIndexMeta::mutable_stats() { + ::greptime::v1::index::VectorIndexStats* _msg = _internal_mutable_stats(); + // @@protoc_insertion_point(field_mutable:greptime.v1.index.VectorIndexMeta.stats) + return _msg; +} +inline void VectorIndexMeta::set_allocated_stats(::greptime::v1::index::VectorIndexStats* stats) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.stats_; + } + if (stats) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(stats); + if (message_arena != submessage_arena) { + stats = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, stats, submessage_arena); + } + + } else { + + } + _impl_.stats_ = stats; + // @@protoc_insertion_point(field_set_allocated:greptime.v1.index.VectorIndexMeta.stats) +} + +// ------------------------------------------------------------------- + +// VectorIndexStats + +// uint64 total_row_count = 1; +inline void VectorIndexStats::clear_total_row_count() { + _impl_.total_row_count_ = uint64_t{0u}; +} +inline uint64_t VectorIndexStats::_internal_total_row_count() const { + return _impl_.total_row_count_; +} +inline uint64_t VectorIndexStats::total_row_count() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexStats.total_row_count) + return _internal_total_row_count(); +} +inline void VectorIndexStats::_internal_set_total_row_count(uint64_t value) { + + _impl_.total_row_count_ = value; +} +inline void VectorIndexStats::set_total_row_count(uint64_t value) { + _internal_set_total_row_count(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexStats.total_row_count) +} + +// uint64 indexed_row_count = 2; +inline void VectorIndexStats::clear_indexed_row_count() { + _impl_.indexed_row_count_ = uint64_t{0u}; +} +inline uint64_t VectorIndexStats::_internal_indexed_row_count() const { + return _impl_.indexed_row_count_; +} +inline uint64_t VectorIndexStats::indexed_row_count() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexStats.indexed_row_count) + return _internal_indexed_row_count(); +} +inline void VectorIndexStats::_internal_set_indexed_row_count(uint64_t value) { + + _impl_.indexed_row_count_ = value; +} +inline void VectorIndexStats::set_indexed_row_count(uint64_t value) { + _internal_set_indexed_row_count(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexStats.indexed_row_count) +} + +// uint64 null_count = 3; +inline void VectorIndexStats::clear_null_count() { + _impl_.null_count_ = uint64_t{0u}; +} +inline uint64_t VectorIndexStats::_internal_null_count() const { + return _impl_.null_count_; +} +inline uint64_t VectorIndexStats::null_count() const { + // @@protoc_insertion_point(field_get:greptime.v1.index.VectorIndexStats.null_count) + return _internal_null_count(); +} +inline void VectorIndexStats::_internal_set_null_count(uint64_t value) { + + _impl_.null_count_ = value; +} +inline void VectorIndexStats::set_null_count(uint64_t value) { + _internal_set_null_count(value); + // @@protoc_insertion_point(field_set:greptime.v1.index.VectorIndexStats.null_count) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace index +} // namespace v1 +} // namespace greptime + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::greptime::v1::index::VectorIndexEngine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::greptime::v1::index::VectorIndexEngine>() { + return ::greptime::v1::index::VectorIndexEngine_descriptor(); +} +template <> struct is_proto_enum< ::greptime::v1::index::VectorDistanceMetric> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::greptime::v1::index::VectorDistanceMetric>() { + return ::greptime::v1::index::VectorDistanceMetric_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_greptime_2fv1_2findex_2fvector_5findex_2eproto diff --git a/go/greptime/v1/index/vector_index.pb.go b/go/greptime/v1/index/vector_index.pb.go new file mode 100644 index 0000000..823ce95 --- /dev/null +++ b/go/greptime/v1/index/vector_index.pb.go @@ -0,0 +1,460 @@ +// 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 +// source: greptime/v1/index/vector_index.proto + +package index + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Vector index engine types. +type VectorIndexEngine int32 + +const ( + VectorIndexEngine_VECTOR_INDEX_ENGINE_USEARCH VectorIndexEngine = 0 +) + +// Enum value maps for VectorIndexEngine. +var ( + VectorIndexEngine_name = map[int32]string{ + 0: "VECTOR_INDEX_ENGINE_USEARCH", + } + VectorIndexEngine_value = map[string]int32{ + "VECTOR_INDEX_ENGINE_USEARCH": 0, + } +) + +func (x VectorIndexEngine) Enum() *VectorIndexEngine { + p := new(VectorIndexEngine) + *p = x + return p +} + +func (x VectorIndexEngine) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VectorIndexEngine) Descriptor() protoreflect.EnumDescriptor { + return file_greptime_v1_index_vector_index_proto_enumTypes[0].Descriptor() +} + +func (VectorIndexEngine) Type() protoreflect.EnumType { + return &file_greptime_v1_index_vector_index_proto_enumTypes[0] +} + +func (x VectorIndexEngine) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VectorIndexEngine.Descriptor instead. +func (VectorIndexEngine) EnumDescriptor() ([]byte, []int) { + return file_greptime_v1_index_vector_index_proto_rawDescGZIP(), []int{0} +} + +// Vector distance metrics. +type VectorDistanceMetric int32 + +const ( + VectorDistanceMetric_VECTOR_DISTANCE_METRIC_L2SQ VectorDistanceMetric = 0 + VectorDistanceMetric_VECTOR_DISTANCE_METRIC_COSINE VectorDistanceMetric = 1 + VectorDistanceMetric_VECTOR_DISTANCE_METRIC_INNER_PRODUCT VectorDistanceMetric = 2 +) + +// Enum value maps for VectorDistanceMetric. +var ( + VectorDistanceMetric_name = map[int32]string{ + 0: "VECTOR_DISTANCE_METRIC_L2SQ", + 1: "VECTOR_DISTANCE_METRIC_COSINE", + 2: "VECTOR_DISTANCE_METRIC_INNER_PRODUCT", + } + VectorDistanceMetric_value = map[string]int32{ + "VECTOR_DISTANCE_METRIC_L2SQ": 0, + "VECTOR_DISTANCE_METRIC_COSINE": 1, + "VECTOR_DISTANCE_METRIC_INNER_PRODUCT": 2, + } +) + +func (x VectorDistanceMetric) Enum() *VectorDistanceMetric { + p := new(VectorDistanceMetric) + *p = x + return p +} + +func (x VectorDistanceMetric) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VectorDistanceMetric) Descriptor() protoreflect.EnumDescriptor { + return file_greptime_v1_index_vector_index_proto_enumTypes[1].Descriptor() +} + +func (VectorDistanceMetric) Type() protoreflect.EnumType { + return &file_greptime_v1_index_vector_index_proto_enumTypes[1] +} + +func (x VectorDistanceMetric) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VectorDistanceMetric.Descriptor instead. +func (VectorDistanceMetric) EnumDescriptor() ([]byte, []int) { + return file_greptime_v1_index_vector_index_proto_rawDescGZIP(), []int{1} +} + +// Metadata for a vector index blob (stored as footer). +type VectorIndexMeta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Index engine type. + Engine VectorIndexEngine `protobuf:"varint,1,opt,name=engine,proto3,enum=greptime.v1.index.VectorIndexEngine" json:"engine,omitempty"` + // Vector dimension. + Dim uint32 `protobuf:"varint,2,opt,name=dim,proto3" json:"dim,omitempty"` + // Distance metric. + Metric VectorDistanceMetric `protobuf:"varint,3,opt,name=metric,proto3,enum=greptime.v1.index.VectorDistanceMetric" json:"metric,omitempty"` + // HNSW connectivity parameter. + Connectivity uint32 `protobuf:"varint,4,opt,name=connectivity,proto3" json:"connectivity,omitempty"` + // HNSW expansion factor during index construction. + ExpansionAdd uint32 `protobuf:"varint,5,opt,name=expansion_add,json=expansionAdd,proto3" json:"expansion_add,omitempty"` + // HNSW expansion factor during search. + ExpansionSearch uint32 `protobuf:"varint,6,opt,name=expansion_search,json=expansionSearch,proto3" json:"expansion_search,omitempty"` + // Byte length of the null bitmap (RoaringBitmap serialized). + NullBitmapSize uint32 `protobuf:"varint,7,opt,name=null_bitmap_size,json=nullBitmapSize,proto3" json:"null_bitmap_size,omitempty"` + // Byte length of the vector index data (engine-specific serialized format). + IndexSize uint64 `protobuf:"varint,8,opt,name=index_size,json=indexSize,proto3" json:"index_size,omitempty"` + // Statistics about the vector index. + Stats *VectorIndexStats `protobuf:"bytes,9,opt,name=stats,proto3" json:"stats,omitempty"` +} + +func (x *VectorIndexMeta) Reset() { + *x = VectorIndexMeta{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_index_vector_index_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VectorIndexMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VectorIndexMeta) ProtoMessage() {} + +func (x *VectorIndexMeta) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_index_vector_index_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VectorIndexMeta.ProtoReflect.Descriptor instead. +func (*VectorIndexMeta) Descriptor() ([]byte, []int) { + return file_greptime_v1_index_vector_index_proto_rawDescGZIP(), []int{0} +} + +func (x *VectorIndexMeta) GetEngine() VectorIndexEngine { + if x != nil { + return x.Engine + } + return VectorIndexEngine_VECTOR_INDEX_ENGINE_USEARCH +} + +func (x *VectorIndexMeta) GetDim() uint32 { + if x != nil { + return x.Dim + } + return 0 +} + +func (x *VectorIndexMeta) GetMetric() VectorDistanceMetric { + if x != nil { + return x.Metric + } + return VectorDistanceMetric_VECTOR_DISTANCE_METRIC_L2SQ +} + +func (x *VectorIndexMeta) GetConnectivity() uint32 { + if x != nil { + return x.Connectivity + } + return 0 +} + +func (x *VectorIndexMeta) GetExpansionAdd() uint32 { + if x != nil { + return x.ExpansionAdd + } + return 0 +} + +func (x *VectorIndexMeta) GetExpansionSearch() uint32 { + if x != nil { + return x.ExpansionSearch + } + return 0 +} + +func (x *VectorIndexMeta) GetNullBitmapSize() uint32 { + if x != nil { + return x.NullBitmapSize + } + return 0 +} + +func (x *VectorIndexMeta) GetIndexSize() uint64 { + if x != nil { + return x.IndexSize + } + return 0 +} + +func (x *VectorIndexMeta) GetStats() *VectorIndexStats { + if x != nil { + return x.Stats + } + return nil +} + +// Statistics for a vector index. +type VectorIndexStats struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Total number of rows in the SST. + TotalRowCount uint64 `protobuf:"varint,1,opt,name=total_row_count,json=totalRowCount,proto3" json:"total_row_count,omitempty"` + // Number of rows with valid vectors (indexed). + IndexedRowCount uint64 `protobuf:"varint,2,opt,name=indexed_row_count,json=indexedRowCount,proto3" json:"indexed_row_count,omitempty"` + // Number of null vectors. + NullCount uint64 `protobuf:"varint,3,opt,name=null_count,json=nullCount,proto3" json:"null_count,omitempty"` +} + +func (x *VectorIndexStats) Reset() { + *x = VectorIndexStats{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_index_vector_index_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VectorIndexStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VectorIndexStats) ProtoMessage() {} + +func (x *VectorIndexStats) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_index_vector_index_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VectorIndexStats.ProtoReflect.Descriptor instead. +func (*VectorIndexStats) Descriptor() ([]byte, []int) { + return file_greptime_v1_index_vector_index_proto_rawDescGZIP(), []int{1} +} + +func (x *VectorIndexStats) GetTotalRowCount() uint64 { + if x != nil { + return x.TotalRowCount + } + return 0 +} + +func (x *VectorIndexStats) GetIndexedRowCount() uint64 { + if x != nil { + return x.IndexedRowCount + } + return 0 +} + +func (x *VectorIndexStats) GetNullCount() uint64 { + if x != nil { + return x.NullCount + } + return 0 +} + +var File_greptime_v1_index_vector_index_proto protoreflect.FileDescriptor + +var file_greptime_v1_index_vector_index_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x2f, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x9a, 0x03, 0x0a, 0x0f, 0x56, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x3c, 0x0a, + 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, + 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x45, 0x6e, 0x67, + 0x69, 0x6e, 0x65, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x64, + 0x69, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x64, 0x69, 0x6d, 0x12, 0x3f, 0x0a, + 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, + 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x22, + 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, + 0x74, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x61, 0x64, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x61, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x61, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x12, 0x28, 0x0a, 0x10, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x62, 0x69, 0x74, 0x6d, 0x61, + 0x70, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x6e, 0x75, + 0x6c, 0x6c, 0x42, 0x69, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x74, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x67, 0x72, 0x65, + 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x56, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x22, 0x85, 0x01, 0x0a, 0x10, 0x56, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x72, 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x6f, 0x77, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x5f, 0x72, + 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x34, + 0x0a, 0x11, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x45, 0x6e, 0x67, + 0x69, 0x6e, 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x56, 0x45, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x49, 0x4e, + 0x44, 0x45, 0x58, 0x5f, 0x45, 0x4e, 0x47, 0x49, 0x4e, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x41, 0x52, + 0x43, 0x48, 0x10, 0x00, 0x2a, 0x84, 0x01, 0x0a, 0x14, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x44, + 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x1f, 0x0a, + 0x1b, 0x56, 0x45, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x44, 0x49, 0x53, 0x54, 0x41, 0x4e, 0x43, 0x45, + 0x5f, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x4c, 0x32, 0x53, 0x51, 0x10, 0x00, 0x12, 0x21, + 0x0a, 0x1d, 0x56, 0x45, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x44, 0x49, 0x53, 0x54, 0x41, 0x4e, 0x43, + 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x43, 0x4f, 0x53, 0x49, 0x4e, 0x45, 0x10, + 0x01, 0x12, 0x28, 0x0a, 0x24, 0x56, 0x45, 0x43, 0x54, 0x4f, 0x52, 0x5f, 0x44, 0x49, 0x53, 0x54, + 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x49, 0x4e, 0x4e, 0x45, + 0x52, 0x5f, 0x50, 0x52, 0x4f, 0x44, 0x55, 0x43, 0x54, 0x10, 0x02, 0x42, 0x3d, 0x5a, 0x3b, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, + 0x6d, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, + 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_greptime_v1_index_vector_index_proto_rawDescOnce sync.Once + file_greptime_v1_index_vector_index_proto_rawDescData = file_greptime_v1_index_vector_index_proto_rawDesc +) + +func file_greptime_v1_index_vector_index_proto_rawDescGZIP() []byte { + file_greptime_v1_index_vector_index_proto_rawDescOnce.Do(func() { + file_greptime_v1_index_vector_index_proto_rawDescData = protoimpl.X.CompressGZIP(file_greptime_v1_index_vector_index_proto_rawDescData) + }) + return file_greptime_v1_index_vector_index_proto_rawDescData +} + +var file_greptime_v1_index_vector_index_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_greptime_v1_index_vector_index_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_greptime_v1_index_vector_index_proto_goTypes = []interface{}{ + (VectorIndexEngine)(0), // 0: greptime.v1.index.VectorIndexEngine + (VectorDistanceMetric)(0), // 1: greptime.v1.index.VectorDistanceMetric + (*VectorIndexMeta)(nil), // 2: greptime.v1.index.VectorIndexMeta + (*VectorIndexStats)(nil), // 3: greptime.v1.index.VectorIndexStats +} +var file_greptime_v1_index_vector_index_proto_depIdxs = []int32{ + 0, // 0: greptime.v1.index.VectorIndexMeta.engine:type_name -> greptime.v1.index.VectorIndexEngine + 1, // 1: greptime.v1.index.VectorIndexMeta.metric:type_name -> greptime.v1.index.VectorDistanceMetric + 3, // 2: greptime.v1.index.VectorIndexMeta.stats:type_name -> greptime.v1.index.VectorIndexStats + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_greptime_v1_index_vector_index_proto_init() } +func file_greptime_v1_index_vector_index_proto_init() { + if File_greptime_v1_index_vector_index_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_greptime_v1_index_vector_index_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VectorIndexMeta); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_index_vector_index_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VectorIndexStats); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_greptime_v1_index_vector_index_proto_rawDesc, + NumEnums: 2, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_greptime_v1_index_vector_index_proto_goTypes, + DependencyIndexes: file_greptime_v1_index_vector_index_proto_depIdxs, + EnumInfos: file_greptime_v1_index_vector_index_proto_enumTypes, + MessageInfos: file_greptime_v1_index_vector_index_proto_msgTypes, + }.Build() + File_greptime_v1_index_vector_index_proto = out.File + file_greptime_v1_index_vector_index_proto_rawDesc = nil + file_greptime_v1_index_vector_index_proto_goTypes = nil + file_greptime_v1_index_vector_index_proto_depIdxs = nil +} diff --git a/java/src/main/java/greptime/v1/index/VectorIndex.java b/java/src/main/java/greptime/v1/index/VectorIndex.java new file mode 100644 index 0000000..caf873a --- /dev/null +++ b/java/src/main/java/greptime/v1/index/VectorIndex.java @@ -0,0 +1,2518 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: greptime/v1/index/vector_index.proto + +package greptime.v1.index; + +public final class VectorIndex { + private VectorIndex() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + *
+   * Vector index engine types.
+   * 
+ * + * Protobuf enum {@code greptime.v1.index.VectorIndexEngine} + */ + public enum VectorIndexEngine + implements com.google.protobuf.ProtocolMessageEnum { + /** + * VECTOR_INDEX_ENGINE_USEARCH = 0; + */ + VECTOR_INDEX_ENGINE_USEARCH(0), + UNRECOGNIZED(-1), + ; + + /** + * VECTOR_INDEX_ENGINE_USEARCH = 0; + */ + public static final int VECTOR_INDEX_ENGINE_USEARCH_VALUE = 0; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static VectorIndexEngine valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static VectorIndexEngine forNumber(int value) { + switch (value) { + case 0: return VECTOR_INDEX_ENGINE_USEARCH; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + VectorIndexEngine> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public VectorIndexEngine findValueByNumber(int number) { + return VectorIndexEngine.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return greptime.v1.index.VectorIndex.getDescriptor().getEnumTypes().get(0); + } + + private static final VectorIndexEngine[] VALUES = values(); + + public static VectorIndexEngine valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private VectorIndexEngine(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:greptime.v1.index.VectorIndexEngine) + } + + /** + *
+   * Vector distance metrics.
+   * 
+ * + * Protobuf enum {@code greptime.v1.index.VectorDistanceMetric} + */ + public enum VectorDistanceMetric + implements com.google.protobuf.ProtocolMessageEnum { + /** + * VECTOR_DISTANCE_METRIC_L2SQ = 0; + */ + VECTOR_DISTANCE_METRIC_L2SQ(0), + /** + * VECTOR_DISTANCE_METRIC_COSINE = 1; + */ + VECTOR_DISTANCE_METRIC_COSINE(1), + /** + * VECTOR_DISTANCE_METRIC_INNER_PRODUCT = 2; + */ + VECTOR_DISTANCE_METRIC_INNER_PRODUCT(2), + UNRECOGNIZED(-1), + ; + + /** + * VECTOR_DISTANCE_METRIC_L2SQ = 0; + */ + public static final int VECTOR_DISTANCE_METRIC_L2SQ_VALUE = 0; + /** + * VECTOR_DISTANCE_METRIC_COSINE = 1; + */ + public static final int VECTOR_DISTANCE_METRIC_COSINE_VALUE = 1; + /** + * VECTOR_DISTANCE_METRIC_INNER_PRODUCT = 2; + */ + public static final int VECTOR_DISTANCE_METRIC_INNER_PRODUCT_VALUE = 2; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static VectorDistanceMetric valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static VectorDistanceMetric forNumber(int value) { + switch (value) { + case 0: return VECTOR_DISTANCE_METRIC_L2SQ; + case 1: return VECTOR_DISTANCE_METRIC_COSINE; + case 2: return VECTOR_DISTANCE_METRIC_INNER_PRODUCT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + VectorDistanceMetric> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public VectorDistanceMetric findValueByNumber(int number) { + return VectorDistanceMetric.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return greptime.v1.index.VectorIndex.getDescriptor().getEnumTypes().get(1); + } + + private static final VectorDistanceMetric[] VALUES = values(); + + public static VectorDistanceMetric valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private VectorDistanceMetric(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:greptime.v1.index.VectorDistanceMetric) + } + + public interface VectorIndexMetaOrBuilder extends + // @@protoc_insertion_point(interface_extends:greptime.v1.index.VectorIndexMeta) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * Index engine type.
+     * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @return The enum numeric value on the wire for engine. + */ + int getEngineValue(); + /** + *
+     * Index engine type.
+     * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @return The engine. + */ + greptime.v1.index.VectorIndex.VectorIndexEngine getEngine(); + + /** + *
+     * Vector dimension.
+     * 
+ * + * uint32 dim = 2; + * @return The dim. + */ + int getDim(); + + /** + *
+     * Distance metric.
+     * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @return The enum numeric value on the wire for metric. + */ + int getMetricValue(); + /** + *
+     * Distance metric.
+     * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @return The metric. + */ + greptime.v1.index.VectorIndex.VectorDistanceMetric getMetric(); + + /** + *
+     * HNSW connectivity parameter.
+     * 
+ * + * uint32 connectivity = 4; + * @return The connectivity. + */ + int getConnectivity(); + + /** + *
+     * HNSW expansion factor during index construction.
+     * 
+ * + * uint32 expansion_add = 5; + * @return The expansionAdd. + */ + int getExpansionAdd(); + + /** + *
+     * HNSW expansion factor during search.
+     * 
+ * + * uint32 expansion_search = 6; + * @return The expansionSearch. + */ + int getExpansionSearch(); + + /** + *
+     * Byte length of the null bitmap (RoaringBitmap serialized).
+     * 
+ * + * uint32 null_bitmap_size = 7; + * @return The nullBitmapSize. + */ + int getNullBitmapSize(); + + /** + *
+     * Byte length of the vector index data (engine-specific serialized format).
+     * 
+ * + * uint64 index_size = 8; + * @return The indexSize. + */ + long getIndexSize(); + + /** + *
+     * Statistics about the vector index.
+     * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + * @return Whether the stats field is set. + */ + boolean hasStats(); + /** + *
+     * Statistics about the vector index.
+     * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + * @return The stats. + */ + greptime.v1.index.VectorIndex.VectorIndexStats getStats(); + /** + *
+     * Statistics about the vector index.
+     * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + greptime.v1.index.VectorIndex.VectorIndexStatsOrBuilder getStatsOrBuilder(); + } + /** + *
+   * Metadata for a vector index blob (stored as footer).
+   * 
+ * + * Protobuf type {@code greptime.v1.index.VectorIndexMeta} + */ + public static final class VectorIndexMeta extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:greptime.v1.index.VectorIndexMeta) + VectorIndexMetaOrBuilder { + private static final long serialVersionUID = 0L; + // Use VectorIndexMeta.newBuilder() to construct. + private VectorIndexMeta(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private VectorIndexMeta() { + engine_ = 0; + metric_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new VectorIndexMeta(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private VectorIndexMeta( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int rawValue = input.readEnum(); + + engine_ = rawValue; + break; + } + case 16: { + + dim_ = input.readUInt32(); + break; + } + case 24: { + int rawValue = input.readEnum(); + + metric_ = rawValue; + break; + } + case 32: { + + connectivity_ = input.readUInt32(); + break; + } + case 40: { + + expansionAdd_ = input.readUInt32(); + break; + } + case 48: { + + expansionSearch_ = input.readUInt32(); + break; + } + case 56: { + + nullBitmapSize_ = input.readUInt32(); + break; + } + case 64: { + + indexSize_ = input.readUInt64(); + break; + } + case 74: { + greptime.v1.index.VectorIndex.VectorIndexStats.Builder subBuilder = null; + if (stats_ != null) { + subBuilder = stats_.toBuilder(); + } + stats_ = input.readMessage(greptime.v1.index.VectorIndex.VectorIndexStats.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(stats_); + stats_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexMeta_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexMeta_fieldAccessorTable + .ensureFieldAccessorsInitialized( + greptime.v1.index.VectorIndex.VectorIndexMeta.class, greptime.v1.index.VectorIndex.VectorIndexMeta.Builder.class); + } + + public static final int ENGINE_FIELD_NUMBER = 1; + private int engine_; + /** + *
+     * Index engine type.
+     * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @return The enum numeric value on the wire for engine. + */ + @java.lang.Override public int getEngineValue() { + return engine_; + } + /** + *
+     * Index engine type.
+     * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @return The engine. + */ + @java.lang.Override public greptime.v1.index.VectorIndex.VectorIndexEngine getEngine() { + @SuppressWarnings("deprecation") + greptime.v1.index.VectorIndex.VectorIndexEngine result = greptime.v1.index.VectorIndex.VectorIndexEngine.valueOf(engine_); + return result == null ? greptime.v1.index.VectorIndex.VectorIndexEngine.UNRECOGNIZED : result; + } + + public static final int DIM_FIELD_NUMBER = 2; + private int dim_; + /** + *
+     * Vector dimension.
+     * 
+ * + * uint32 dim = 2; + * @return The dim. + */ + @java.lang.Override + public int getDim() { + return dim_; + } + + public static final int METRIC_FIELD_NUMBER = 3; + private int metric_; + /** + *
+     * Distance metric.
+     * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @return The enum numeric value on the wire for metric. + */ + @java.lang.Override public int getMetricValue() { + return metric_; + } + /** + *
+     * Distance metric.
+     * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @return The metric. + */ + @java.lang.Override public greptime.v1.index.VectorIndex.VectorDistanceMetric getMetric() { + @SuppressWarnings("deprecation") + greptime.v1.index.VectorIndex.VectorDistanceMetric result = greptime.v1.index.VectorIndex.VectorDistanceMetric.valueOf(metric_); + return result == null ? greptime.v1.index.VectorIndex.VectorDistanceMetric.UNRECOGNIZED : result; + } + + public static final int CONNECTIVITY_FIELD_NUMBER = 4; + private int connectivity_; + /** + *
+     * HNSW connectivity parameter.
+     * 
+ * + * uint32 connectivity = 4; + * @return The connectivity. + */ + @java.lang.Override + public int getConnectivity() { + return connectivity_; + } + + public static final int EXPANSION_ADD_FIELD_NUMBER = 5; + private int expansionAdd_; + /** + *
+     * HNSW expansion factor during index construction.
+     * 
+ * + * uint32 expansion_add = 5; + * @return The expansionAdd. + */ + @java.lang.Override + public int getExpansionAdd() { + return expansionAdd_; + } + + public static final int EXPANSION_SEARCH_FIELD_NUMBER = 6; + private int expansionSearch_; + /** + *
+     * HNSW expansion factor during search.
+     * 
+ * + * uint32 expansion_search = 6; + * @return The expansionSearch. + */ + @java.lang.Override + public int getExpansionSearch() { + return expansionSearch_; + } + + public static final int NULL_BITMAP_SIZE_FIELD_NUMBER = 7; + private int nullBitmapSize_; + /** + *
+     * Byte length of the null bitmap (RoaringBitmap serialized).
+     * 
+ * + * uint32 null_bitmap_size = 7; + * @return The nullBitmapSize. + */ + @java.lang.Override + public int getNullBitmapSize() { + return nullBitmapSize_; + } + + public static final int INDEX_SIZE_FIELD_NUMBER = 8; + private long indexSize_; + /** + *
+     * Byte length of the vector index data (engine-specific serialized format).
+     * 
+ * + * uint64 index_size = 8; + * @return The indexSize. + */ + @java.lang.Override + public long getIndexSize() { + return indexSize_; + } + + public static final int STATS_FIELD_NUMBER = 9; + private greptime.v1.index.VectorIndex.VectorIndexStats stats_; + /** + *
+     * Statistics about the vector index.
+     * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + * @return Whether the stats field is set. + */ + @java.lang.Override + public boolean hasStats() { + return stats_ != null; + } + /** + *
+     * Statistics about the vector index.
+     * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + * @return The stats. + */ + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexStats getStats() { + return stats_ == null ? greptime.v1.index.VectorIndex.VectorIndexStats.getDefaultInstance() : stats_; + } + /** + *
+     * Statistics about the vector index.
+     * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexStatsOrBuilder getStatsOrBuilder() { + return getStats(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (engine_ != greptime.v1.index.VectorIndex.VectorIndexEngine.VECTOR_INDEX_ENGINE_USEARCH.getNumber()) { + output.writeEnum(1, engine_); + } + if (dim_ != 0) { + output.writeUInt32(2, dim_); + } + if (metric_ != greptime.v1.index.VectorIndex.VectorDistanceMetric.VECTOR_DISTANCE_METRIC_L2SQ.getNumber()) { + output.writeEnum(3, metric_); + } + if (connectivity_ != 0) { + output.writeUInt32(4, connectivity_); + } + if (expansionAdd_ != 0) { + output.writeUInt32(5, expansionAdd_); + } + if (expansionSearch_ != 0) { + output.writeUInt32(6, expansionSearch_); + } + if (nullBitmapSize_ != 0) { + output.writeUInt32(7, nullBitmapSize_); + } + if (indexSize_ != 0L) { + output.writeUInt64(8, indexSize_); + } + if (stats_ != null) { + output.writeMessage(9, getStats()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (engine_ != greptime.v1.index.VectorIndex.VectorIndexEngine.VECTOR_INDEX_ENGINE_USEARCH.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, engine_); + } + if (dim_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(2, dim_); + } + if (metric_ != greptime.v1.index.VectorIndex.VectorDistanceMetric.VECTOR_DISTANCE_METRIC_L2SQ.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, metric_); + } + if (connectivity_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(4, connectivity_); + } + if (expansionAdd_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(5, expansionAdd_); + } + if (expansionSearch_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(6, expansionSearch_); + } + if (nullBitmapSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(7, nullBitmapSize_); + } + if (indexSize_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(8, indexSize_); + } + if (stats_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(9, getStats()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof greptime.v1.index.VectorIndex.VectorIndexMeta)) { + return super.equals(obj); + } + greptime.v1.index.VectorIndex.VectorIndexMeta other = (greptime.v1.index.VectorIndex.VectorIndexMeta) obj; + + if (engine_ != other.engine_) return false; + if (getDim() + != other.getDim()) return false; + if (metric_ != other.metric_) return false; + if (getConnectivity() + != other.getConnectivity()) return false; + if (getExpansionAdd() + != other.getExpansionAdd()) return false; + if (getExpansionSearch() + != other.getExpansionSearch()) return false; + if (getNullBitmapSize() + != other.getNullBitmapSize()) return false; + if (getIndexSize() + != other.getIndexSize()) return false; + if (hasStats() != other.hasStats()) return false; + if (hasStats()) { + if (!getStats() + .equals(other.getStats())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENGINE_FIELD_NUMBER; + hash = (53 * hash) + engine_; + hash = (37 * hash) + DIM_FIELD_NUMBER; + hash = (53 * hash) + getDim(); + hash = (37 * hash) + METRIC_FIELD_NUMBER; + hash = (53 * hash) + metric_; + hash = (37 * hash) + CONNECTIVITY_FIELD_NUMBER; + hash = (53 * hash) + getConnectivity(); + hash = (37 * hash) + EXPANSION_ADD_FIELD_NUMBER; + hash = (53 * hash) + getExpansionAdd(); + hash = (37 * hash) + EXPANSION_SEARCH_FIELD_NUMBER; + hash = (53 * hash) + getExpansionSearch(); + hash = (37 * hash) + NULL_BITMAP_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getNullBitmapSize(); + hash = (37 * hash) + INDEX_SIZE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getIndexSize()); + if (hasStats()) { + hash = (37 * hash) + STATS_FIELD_NUMBER; + hash = (53 * hash) + getStats().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static greptime.v1.index.VectorIndex.VectorIndexMeta parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(greptime.v1.index.VectorIndex.VectorIndexMeta prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+     * Metadata for a vector index blob (stored as footer).
+     * 
+ * + * Protobuf type {@code greptime.v1.index.VectorIndexMeta} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:greptime.v1.index.VectorIndexMeta) + greptime.v1.index.VectorIndex.VectorIndexMetaOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexMeta_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexMeta_fieldAccessorTable + .ensureFieldAccessorsInitialized( + greptime.v1.index.VectorIndex.VectorIndexMeta.class, greptime.v1.index.VectorIndex.VectorIndexMeta.Builder.class); + } + + // Construct using greptime.v1.index.VectorIndex.VectorIndexMeta.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + engine_ = 0; + + dim_ = 0; + + metric_ = 0; + + connectivity_ = 0; + + expansionAdd_ = 0; + + expansionSearch_ = 0; + + nullBitmapSize_ = 0; + + indexSize_ = 0L; + + if (statsBuilder_ == null) { + stats_ = null; + } else { + stats_ = null; + statsBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexMeta_descriptor; + } + + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexMeta getDefaultInstanceForType() { + return greptime.v1.index.VectorIndex.VectorIndexMeta.getDefaultInstance(); + } + + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexMeta build() { + greptime.v1.index.VectorIndex.VectorIndexMeta result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexMeta buildPartial() { + greptime.v1.index.VectorIndex.VectorIndexMeta result = new greptime.v1.index.VectorIndex.VectorIndexMeta(this); + result.engine_ = engine_; + result.dim_ = dim_; + result.metric_ = metric_; + result.connectivity_ = connectivity_; + result.expansionAdd_ = expansionAdd_; + result.expansionSearch_ = expansionSearch_; + result.nullBitmapSize_ = nullBitmapSize_; + result.indexSize_ = indexSize_; + if (statsBuilder_ == null) { + result.stats_ = stats_; + } else { + result.stats_ = statsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof greptime.v1.index.VectorIndex.VectorIndexMeta) { + return mergeFrom((greptime.v1.index.VectorIndex.VectorIndexMeta)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(greptime.v1.index.VectorIndex.VectorIndexMeta other) { + if (other == greptime.v1.index.VectorIndex.VectorIndexMeta.getDefaultInstance()) return this; + if (other.engine_ != 0) { + setEngineValue(other.getEngineValue()); + } + if (other.getDim() != 0) { + setDim(other.getDim()); + } + if (other.metric_ != 0) { + setMetricValue(other.getMetricValue()); + } + if (other.getConnectivity() != 0) { + setConnectivity(other.getConnectivity()); + } + if (other.getExpansionAdd() != 0) { + setExpansionAdd(other.getExpansionAdd()); + } + if (other.getExpansionSearch() != 0) { + setExpansionSearch(other.getExpansionSearch()); + } + if (other.getNullBitmapSize() != 0) { + setNullBitmapSize(other.getNullBitmapSize()); + } + if (other.getIndexSize() != 0L) { + setIndexSize(other.getIndexSize()); + } + if (other.hasStats()) { + mergeStats(other.getStats()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + greptime.v1.index.VectorIndex.VectorIndexMeta parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (greptime.v1.index.VectorIndex.VectorIndexMeta) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int engine_ = 0; + /** + *
+       * Index engine type.
+       * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @return The enum numeric value on the wire for engine. + */ + @java.lang.Override public int getEngineValue() { + return engine_; + } + /** + *
+       * Index engine type.
+       * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @param value The enum numeric value on the wire for engine to set. + * @return This builder for chaining. + */ + public Builder setEngineValue(int value) { + + engine_ = value; + onChanged(); + return this; + } + /** + *
+       * Index engine type.
+       * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @return The engine. + */ + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexEngine getEngine() { + @SuppressWarnings("deprecation") + greptime.v1.index.VectorIndex.VectorIndexEngine result = greptime.v1.index.VectorIndex.VectorIndexEngine.valueOf(engine_); + return result == null ? greptime.v1.index.VectorIndex.VectorIndexEngine.UNRECOGNIZED : result; + } + /** + *
+       * Index engine type.
+       * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @param value The engine to set. + * @return This builder for chaining. + */ + public Builder setEngine(greptime.v1.index.VectorIndex.VectorIndexEngine value) { + if (value == null) { + throw new NullPointerException(); + } + + engine_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+       * Index engine type.
+       * 
+ * + * .greptime.v1.index.VectorIndexEngine engine = 1; + * @return This builder for chaining. + */ + public Builder clearEngine() { + + engine_ = 0; + onChanged(); + return this; + } + + private int dim_ ; + /** + *
+       * Vector dimension.
+       * 
+ * + * uint32 dim = 2; + * @return The dim. + */ + @java.lang.Override + public int getDim() { + return dim_; + } + /** + *
+       * Vector dimension.
+       * 
+ * + * uint32 dim = 2; + * @param value The dim to set. + * @return This builder for chaining. + */ + public Builder setDim(int value) { + + dim_ = value; + onChanged(); + return this; + } + /** + *
+       * Vector dimension.
+       * 
+ * + * uint32 dim = 2; + * @return This builder for chaining. + */ + public Builder clearDim() { + + dim_ = 0; + onChanged(); + return this; + } + + private int metric_ = 0; + /** + *
+       * Distance metric.
+       * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @return The enum numeric value on the wire for metric. + */ + @java.lang.Override public int getMetricValue() { + return metric_; + } + /** + *
+       * Distance metric.
+       * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @param value The enum numeric value on the wire for metric to set. + * @return This builder for chaining. + */ + public Builder setMetricValue(int value) { + + metric_ = value; + onChanged(); + return this; + } + /** + *
+       * Distance metric.
+       * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @return The metric. + */ + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorDistanceMetric getMetric() { + @SuppressWarnings("deprecation") + greptime.v1.index.VectorIndex.VectorDistanceMetric result = greptime.v1.index.VectorIndex.VectorDistanceMetric.valueOf(metric_); + return result == null ? greptime.v1.index.VectorIndex.VectorDistanceMetric.UNRECOGNIZED : result; + } + /** + *
+       * Distance metric.
+       * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @param value The metric to set. + * @return This builder for chaining. + */ + public Builder setMetric(greptime.v1.index.VectorIndex.VectorDistanceMetric value) { + if (value == null) { + throw new NullPointerException(); + } + + metric_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+       * Distance metric.
+       * 
+ * + * .greptime.v1.index.VectorDistanceMetric metric = 3; + * @return This builder for chaining. + */ + public Builder clearMetric() { + + metric_ = 0; + onChanged(); + return this; + } + + private int connectivity_ ; + /** + *
+       * HNSW connectivity parameter.
+       * 
+ * + * uint32 connectivity = 4; + * @return The connectivity. + */ + @java.lang.Override + public int getConnectivity() { + return connectivity_; + } + /** + *
+       * HNSW connectivity parameter.
+       * 
+ * + * uint32 connectivity = 4; + * @param value The connectivity to set. + * @return This builder for chaining. + */ + public Builder setConnectivity(int value) { + + connectivity_ = value; + onChanged(); + return this; + } + /** + *
+       * HNSW connectivity parameter.
+       * 
+ * + * uint32 connectivity = 4; + * @return This builder for chaining. + */ + public Builder clearConnectivity() { + + connectivity_ = 0; + onChanged(); + return this; + } + + private int expansionAdd_ ; + /** + *
+       * HNSW expansion factor during index construction.
+       * 
+ * + * uint32 expansion_add = 5; + * @return The expansionAdd. + */ + @java.lang.Override + public int getExpansionAdd() { + return expansionAdd_; + } + /** + *
+       * HNSW expansion factor during index construction.
+       * 
+ * + * uint32 expansion_add = 5; + * @param value The expansionAdd to set. + * @return This builder for chaining. + */ + public Builder setExpansionAdd(int value) { + + expansionAdd_ = value; + onChanged(); + return this; + } + /** + *
+       * HNSW expansion factor during index construction.
+       * 
+ * + * uint32 expansion_add = 5; + * @return This builder for chaining. + */ + public Builder clearExpansionAdd() { + + expansionAdd_ = 0; + onChanged(); + return this; + } + + private int expansionSearch_ ; + /** + *
+       * HNSW expansion factor during search.
+       * 
+ * + * uint32 expansion_search = 6; + * @return The expansionSearch. + */ + @java.lang.Override + public int getExpansionSearch() { + return expansionSearch_; + } + /** + *
+       * HNSW expansion factor during search.
+       * 
+ * + * uint32 expansion_search = 6; + * @param value The expansionSearch to set. + * @return This builder for chaining. + */ + public Builder setExpansionSearch(int value) { + + expansionSearch_ = value; + onChanged(); + return this; + } + /** + *
+       * HNSW expansion factor during search.
+       * 
+ * + * uint32 expansion_search = 6; + * @return This builder for chaining. + */ + public Builder clearExpansionSearch() { + + expansionSearch_ = 0; + onChanged(); + return this; + } + + private int nullBitmapSize_ ; + /** + *
+       * Byte length of the null bitmap (RoaringBitmap serialized).
+       * 
+ * + * uint32 null_bitmap_size = 7; + * @return The nullBitmapSize. + */ + @java.lang.Override + public int getNullBitmapSize() { + return nullBitmapSize_; + } + /** + *
+       * Byte length of the null bitmap (RoaringBitmap serialized).
+       * 
+ * + * uint32 null_bitmap_size = 7; + * @param value The nullBitmapSize to set. + * @return This builder for chaining. + */ + public Builder setNullBitmapSize(int value) { + + nullBitmapSize_ = value; + onChanged(); + return this; + } + /** + *
+       * Byte length of the null bitmap (RoaringBitmap serialized).
+       * 
+ * + * uint32 null_bitmap_size = 7; + * @return This builder for chaining. + */ + public Builder clearNullBitmapSize() { + + nullBitmapSize_ = 0; + onChanged(); + return this; + } + + private long indexSize_ ; + /** + *
+       * Byte length of the vector index data (engine-specific serialized format).
+       * 
+ * + * uint64 index_size = 8; + * @return The indexSize. + */ + @java.lang.Override + public long getIndexSize() { + return indexSize_; + } + /** + *
+       * Byte length of the vector index data (engine-specific serialized format).
+       * 
+ * + * uint64 index_size = 8; + * @param value The indexSize to set. + * @return This builder for chaining. + */ + public Builder setIndexSize(long value) { + + indexSize_ = value; + onChanged(); + return this; + } + /** + *
+       * Byte length of the vector index data (engine-specific serialized format).
+       * 
+ * + * uint64 index_size = 8; + * @return This builder for chaining. + */ + public Builder clearIndexSize() { + + indexSize_ = 0L; + onChanged(); + return this; + } + + private greptime.v1.index.VectorIndex.VectorIndexStats stats_; + private com.google.protobuf.SingleFieldBuilderV3< + greptime.v1.index.VectorIndex.VectorIndexStats, greptime.v1.index.VectorIndex.VectorIndexStats.Builder, greptime.v1.index.VectorIndex.VectorIndexStatsOrBuilder> statsBuilder_; + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + * @return Whether the stats field is set. + */ + public boolean hasStats() { + return statsBuilder_ != null || stats_ != null; + } + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + * @return The stats. + */ + public greptime.v1.index.VectorIndex.VectorIndexStats getStats() { + if (statsBuilder_ == null) { + return stats_ == null ? greptime.v1.index.VectorIndex.VectorIndexStats.getDefaultInstance() : stats_; + } else { + return statsBuilder_.getMessage(); + } + } + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + public Builder setStats(greptime.v1.index.VectorIndex.VectorIndexStats value) { + if (statsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + stats_ = value; + onChanged(); + } else { + statsBuilder_.setMessage(value); + } + + return this; + } + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + public Builder setStats( + greptime.v1.index.VectorIndex.VectorIndexStats.Builder builderForValue) { + if (statsBuilder_ == null) { + stats_ = builderForValue.build(); + onChanged(); + } else { + statsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + public Builder mergeStats(greptime.v1.index.VectorIndex.VectorIndexStats value) { + if (statsBuilder_ == null) { + if (stats_ != null) { + stats_ = + greptime.v1.index.VectorIndex.VectorIndexStats.newBuilder(stats_).mergeFrom(value).buildPartial(); + } else { + stats_ = value; + } + onChanged(); + } else { + statsBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + public Builder clearStats() { + if (statsBuilder_ == null) { + stats_ = null; + onChanged(); + } else { + stats_ = null; + statsBuilder_ = null; + } + + return this; + } + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + public greptime.v1.index.VectorIndex.VectorIndexStats.Builder getStatsBuilder() { + + onChanged(); + return getStatsFieldBuilder().getBuilder(); + } + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + public greptime.v1.index.VectorIndex.VectorIndexStatsOrBuilder getStatsOrBuilder() { + if (statsBuilder_ != null) { + return statsBuilder_.getMessageOrBuilder(); + } else { + return stats_ == null ? + greptime.v1.index.VectorIndex.VectorIndexStats.getDefaultInstance() : stats_; + } + } + /** + *
+       * Statistics about the vector index.
+       * 
+ * + * .greptime.v1.index.VectorIndexStats stats = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + greptime.v1.index.VectorIndex.VectorIndexStats, greptime.v1.index.VectorIndex.VectorIndexStats.Builder, greptime.v1.index.VectorIndex.VectorIndexStatsOrBuilder> + getStatsFieldBuilder() { + if (statsBuilder_ == null) { + statsBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + greptime.v1.index.VectorIndex.VectorIndexStats, greptime.v1.index.VectorIndex.VectorIndexStats.Builder, greptime.v1.index.VectorIndex.VectorIndexStatsOrBuilder>( + getStats(), + getParentForChildren(), + isClean()); + stats_ = null; + } + return statsBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:greptime.v1.index.VectorIndexMeta) + } + + // @@protoc_insertion_point(class_scope:greptime.v1.index.VectorIndexMeta) + private static final greptime.v1.index.VectorIndex.VectorIndexMeta DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new greptime.v1.index.VectorIndex.VectorIndexMeta(); + } + + public static greptime.v1.index.VectorIndex.VectorIndexMeta getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public VectorIndexMeta parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new VectorIndexMeta(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexMeta getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface VectorIndexStatsOrBuilder extends + // @@protoc_insertion_point(interface_extends:greptime.v1.index.VectorIndexStats) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * Total number of rows in the SST.
+     * 
+ * + * uint64 total_row_count = 1; + * @return The totalRowCount. + */ + long getTotalRowCount(); + + /** + *
+     * Number of rows with valid vectors (indexed).
+     * 
+ * + * uint64 indexed_row_count = 2; + * @return The indexedRowCount. + */ + long getIndexedRowCount(); + + /** + *
+     * Number of null vectors.
+     * 
+ * + * uint64 null_count = 3; + * @return The nullCount. + */ + long getNullCount(); + } + /** + *
+   * Statistics for a vector index.
+   * 
+ * + * Protobuf type {@code greptime.v1.index.VectorIndexStats} + */ + public static final class VectorIndexStats extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:greptime.v1.index.VectorIndexStats) + VectorIndexStatsOrBuilder { + private static final long serialVersionUID = 0L; + // Use VectorIndexStats.newBuilder() to construct. + private VectorIndexStats(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private VectorIndexStats() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new VectorIndexStats(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private VectorIndexStats( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + totalRowCount_ = input.readUInt64(); + break; + } + case 16: { + + indexedRowCount_ = input.readUInt64(); + break; + } + case 24: { + + nullCount_ = input.readUInt64(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexStats_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexStats_fieldAccessorTable + .ensureFieldAccessorsInitialized( + greptime.v1.index.VectorIndex.VectorIndexStats.class, greptime.v1.index.VectorIndex.VectorIndexStats.Builder.class); + } + + public static final int TOTAL_ROW_COUNT_FIELD_NUMBER = 1; + private long totalRowCount_; + /** + *
+     * Total number of rows in the SST.
+     * 
+ * + * uint64 total_row_count = 1; + * @return The totalRowCount. + */ + @java.lang.Override + public long getTotalRowCount() { + return totalRowCount_; + } + + public static final int INDEXED_ROW_COUNT_FIELD_NUMBER = 2; + private long indexedRowCount_; + /** + *
+     * Number of rows with valid vectors (indexed).
+     * 
+ * + * uint64 indexed_row_count = 2; + * @return The indexedRowCount. + */ + @java.lang.Override + public long getIndexedRowCount() { + return indexedRowCount_; + } + + public static final int NULL_COUNT_FIELD_NUMBER = 3; + private long nullCount_; + /** + *
+     * Number of null vectors.
+     * 
+ * + * uint64 null_count = 3; + * @return The nullCount. + */ + @java.lang.Override + public long getNullCount() { + return nullCount_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (totalRowCount_ != 0L) { + output.writeUInt64(1, totalRowCount_); + } + if (indexedRowCount_ != 0L) { + output.writeUInt64(2, indexedRowCount_); + } + if (nullCount_ != 0L) { + output.writeUInt64(3, nullCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (totalRowCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(1, totalRowCount_); + } + if (indexedRowCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(2, indexedRowCount_); + } + if (nullCount_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(3, nullCount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof greptime.v1.index.VectorIndex.VectorIndexStats)) { + return super.equals(obj); + } + greptime.v1.index.VectorIndex.VectorIndexStats other = (greptime.v1.index.VectorIndex.VectorIndexStats) obj; + + if (getTotalRowCount() + != other.getTotalRowCount()) return false; + if (getIndexedRowCount() + != other.getIndexedRowCount()) return false; + if (getNullCount() + != other.getNullCount()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TOTAL_ROW_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTotalRowCount()); + hash = (37 * hash) + INDEXED_ROW_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getIndexedRowCount()); + hash = (37 * hash) + NULL_COUNT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getNullCount()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static greptime.v1.index.VectorIndex.VectorIndexStats parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(greptime.v1.index.VectorIndex.VectorIndexStats prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+     * Statistics for a vector index.
+     * 
+ * + * Protobuf type {@code greptime.v1.index.VectorIndexStats} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:greptime.v1.index.VectorIndexStats) + greptime.v1.index.VectorIndex.VectorIndexStatsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexStats_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexStats_fieldAccessorTable + .ensureFieldAccessorsInitialized( + greptime.v1.index.VectorIndex.VectorIndexStats.class, greptime.v1.index.VectorIndex.VectorIndexStats.Builder.class); + } + + // Construct using greptime.v1.index.VectorIndex.VectorIndexStats.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + totalRowCount_ = 0L; + + indexedRowCount_ = 0L; + + nullCount_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return greptime.v1.index.VectorIndex.internal_static_greptime_v1_index_VectorIndexStats_descriptor; + } + + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexStats getDefaultInstanceForType() { + return greptime.v1.index.VectorIndex.VectorIndexStats.getDefaultInstance(); + } + + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexStats build() { + greptime.v1.index.VectorIndex.VectorIndexStats result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexStats buildPartial() { + greptime.v1.index.VectorIndex.VectorIndexStats result = new greptime.v1.index.VectorIndex.VectorIndexStats(this); + result.totalRowCount_ = totalRowCount_; + result.indexedRowCount_ = indexedRowCount_; + result.nullCount_ = nullCount_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof greptime.v1.index.VectorIndex.VectorIndexStats) { + return mergeFrom((greptime.v1.index.VectorIndex.VectorIndexStats)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(greptime.v1.index.VectorIndex.VectorIndexStats other) { + if (other == greptime.v1.index.VectorIndex.VectorIndexStats.getDefaultInstance()) return this; + if (other.getTotalRowCount() != 0L) { + setTotalRowCount(other.getTotalRowCount()); + } + if (other.getIndexedRowCount() != 0L) { + setIndexedRowCount(other.getIndexedRowCount()); + } + if (other.getNullCount() != 0L) { + setNullCount(other.getNullCount()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + greptime.v1.index.VectorIndex.VectorIndexStats parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (greptime.v1.index.VectorIndex.VectorIndexStats) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long totalRowCount_ ; + /** + *
+       * Total number of rows in the SST.
+       * 
+ * + * uint64 total_row_count = 1; + * @return The totalRowCount. + */ + @java.lang.Override + public long getTotalRowCount() { + return totalRowCount_; + } + /** + *
+       * Total number of rows in the SST.
+       * 
+ * + * uint64 total_row_count = 1; + * @param value The totalRowCount to set. + * @return This builder for chaining. + */ + public Builder setTotalRowCount(long value) { + + totalRowCount_ = value; + onChanged(); + return this; + } + /** + *
+       * Total number of rows in the SST.
+       * 
+ * + * uint64 total_row_count = 1; + * @return This builder for chaining. + */ + public Builder clearTotalRowCount() { + + totalRowCount_ = 0L; + onChanged(); + return this; + } + + private long indexedRowCount_ ; + /** + *
+       * Number of rows with valid vectors (indexed).
+       * 
+ * + * uint64 indexed_row_count = 2; + * @return The indexedRowCount. + */ + @java.lang.Override + public long getIndexedRowCount() { + return indexedRowCount_; + } + /** + *
+       * Number of rows with valid vectors (indexed).
+       * 
+ * + * uint64 indexed_row_count = 2; + * @param value The indexedRowCount to set. + * @return This builder for chaining. + */ + public Builder setIndexedRowCount(long value) { + + indexedRowCount_ = value; + onChanged(); + return this; + } + /** + *
+       * Number of rows with valid vectors (indexed).
+       * 
+ * + * uint64 indexed_row_count = 2; + * @return This builder for chaining. + */ + public Builder clearIndexedRowCount() { + + indexedRowCount_ = 0L; + onChanged(); + return this; + } + + private long nullCount_ ; + /** + *
+       * Number of null vectors.
+       * 
+ * + * uint64 null_count = 3; + * @return The nullCount. + */ + @java.lang.Override + public long getNullCount() { + return nullCount_; + } + /** + *
+       * Number of null vectors.
+       * 
+ * + * uint64 null_count = 3; + * @param value The nullCount to set. + * @return This builder for chaining. + */ + public Builder setNullCount(long value) { + + nullCount_ = value; + onChanged(); + return this; + } + /** + *
+       * Number of null vectors.
+       * 
+ * + * uint64 null_count = 3; + * @return This builder for chaining. + */ + public Builder clearNullCount() { + + nullCount_ = 0L; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:greptime.v1.index.VectorIndexStats) + } + + // @@protoc_insertion_point(class_scope:greptime.v1.index.VectorIndexStats) + private static final greptime.v1.index.VectorIndex.VectorIndexStats DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new greptime.v1.index.VectorIndex.VectorIndexStats(); + } + + public static greptime.v1.index.VectorIndex.VectorIndexStats getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public VectorIndexStats parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new VectorIndexStats(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public greptime.v1.index.VectorIndex.VectorIndexStats getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_greptime_v1_index_VectorIndexMeta_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_greptime_v1_index_VectorIndexMeta_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_greptime_v1_index_VectorIndexStats_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_greptime_v1_index_VectorIndexStats_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n$greptime/v1/index/vector_index.proto\022\021" + + "greptime.v1.index\"\266\002\n\017VectorIndexMeta\0224\n" + + "\006engine\030\001 \001(\0162$.greptime.v1.index.Vector" + + "IndexEngine\022\013\n\003dim\030\002 \001(\r\0227\n\006metric\030\003 \001(\016" + + "2\'.greptime.v1.index.VectorDistanceMetri" + + "c\022\024\n\014connectivity\030\004 \001(\r\022\025\n\rexpansion_add" + + "\030\005 \001(\r\022\030\n\020expansion_search\030\006 \001(\r\022\030\n\020null" + + "_bitmap_size\030\007 \001(\r\022\022\n\nindex_size\030\010 \001(\004\0222" + + "\n\005stats\030\t \001(\0132#.greptime.v1.index.Vector" + + "IndexStats\"Z\n\020VectorIndexStats\022\027\n\017total_" + + "row_count\030\001 \001(\004\022\031\n\021indexed_row_count\030\002 \001" + + "(\004\022\022\n\nnull_count\030\003 \001(\004*4\n\021VectorIndexEng" + + "ine\022\037\n\033VECTOR_INDEX_ENGINE_USEARCH\020\000*\204\001\n" + + "\024VectorDistanceMetric\022\037\n\033VECTOR_DISTANCE" + + "_METRIC_L2SQ\020\000\022!\n\035VECTOR_DISTANCE_METRIC" + + "_COSINE\020\001\022(\n$VECTOR_DISTANCE_METRIC_INNE" + + "R_PRODUCT\020\002B=Z;github.com/GreptimeTeam/g" + + "reptime-proto/go/greptime/v1/indexb\006prot" + + "o3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_greptime_v1_index_VectorIndexMeta_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_greptime_v1_index_VectorIndexMeta_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_greptime_v1_index_VectorIndexMeta_descriptor, + new java.lang.String[] { "Engine", "Dim", "Metric", "Connectivity", "ExpansionAdd", "ExpansionSearch", "NullBitmapSize", "IndexSize", "Stats", }); + internal_static_greptime_v1_index_VectorIndexStats_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_greptime_v1_index_VectorIndexStats_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_greptime_v1_index_VectorIndexStats_descriptor, + new java.lang.String[] { "TotalRowCount", "IndexedRowCount", "NullCount", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto/greptime/v1/index/vector_index.proto b/proto/greptime/v1/index/vector_index.proto new file mode 100644 index 0000000..126641c --- /dev/null +++ b/proto/greptime/v1/index/vector_index.proto @@ -0,0 +1,73 @@ +// 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. + +syntax = "proto3"; + +package greptime.v1.index; + +option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1/index"; + +// Vector index engine types. +enum VectorIndexEngine { + VECTOR_INDEX_ENGINE_USEARCH = 0; +} + +// Vector distance metrics. +enum VectorDistanceMetric { + VECTOR_DISTANCE_METRIC_L2SQ = 0; + VECTOR_DISTANCE_METRIC_COSINE = 1; + VECTOR_DISTANCE_METRIC_INNER_PRODUCT = 2; +} + +// Metadata for a vector index blob (stored as footer). +message VectorIndexMeta { + // Index engine type. + VectorIndexEngine engine = 1; + + // Vector dimension. + uint32 dim = 2; + + // Distance metric. + VectorDistanceMetric metric = 3; + + // HNSW connectivity parameter. + uint32 connectivity = 4; + + // HNSW expansion factor during index construction. + uint32 expansion_add = 5; + + // HNSW expansion factor during search. + uint32 expansion_search = 6; + + // Byte length of the null bitmap (RoaringBitmap serialized). + uint32 null_bitmap_size = 7; + + // Byte length of the vector index data (engine-specific serialized format). + uint64 index_size = 8; + + // Statistics about the vector index. + VectorIndexStats stats = 9; +} + +// Statistics for a vector index. +message VectorIndexStats { + // Total number of rows in the SST. + uint64 total_row_count = 1; + + // Number of rows with valid vectors (indexed). + uint64 indexed_row_count = 2; + + // Number of null vectors. + uint64 null_count = 3; +}