// 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 <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

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<size_t>(reinterpret_cast<char*>(&_impl_.null_bitmap_size_) -
    reinterpret_cast<char*>(&_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<size_t>(
      reinterpret_cast<char*>(&_impl_.null_bitmap_size_) -
      reinterpret_cast<char*>(&_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<uint8_t>(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<uint8_t>(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<uint8_t>(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<uint8_t>(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<uint8_t>(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<uint8_t>(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<uint8_t>(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<uint8_t>(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<uint8_t>(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<VectorIndexMeta*>(&to_msg);
  auto& from = static_cast<const VectorIndexMeta&>(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<char*>(&_impl_.stats_),
          reinterpret_cast<char*>(&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<size_t>(reinterpret_cast<char*>(&_impl_.null_count_) -
    reinterpret_cast<char*>(&_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<size_t>(
      reinterpret_cast<char*>(&_impl_.null_count_) -
      reinterpret_cast<char*>(&_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<uint8_t>(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<uint8_t>(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<uint8_t>(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<VectorIndexStats*>(&to_msg);
  auto& from = static_cast<const VectorIndexStats&>(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<char*>(&_impl_.total_row_count_),
          reinterpret_cast<char*>(&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 <google/protobuf/port_undef.inc>
