diff --git a/build.rs b/build.rs index edb4e39..e767631 100644 --- a/build.rs +++ b/build.rs @@ -26,6 +26,7 @@ fn main() { &[ "proto/greptime/v1/database.proto", "proto/greptime/v1/health.proto", + "proto/greptime/v1/wal.proto", "proto/greptime/v1/meta/common.proto", "proto/greptime/v1/meta/heartbeat.proto", "proto/greptime/v1/meta/route.proto", diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt deleted file mode 100644 index 5a2e8b9..0000000 --- a/c++/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -project(greptime_proto_cpp_lib) - -file(GLOB_RECURSE OUTPUT_SOURCES "*.h" "*.cc") - -add_library(${PROJECT_NAME} ${OUTPUT_SOURCES}) - -target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/c++/greptime/v1/wal.grpc.pb.cc b/c++/greptime/v1/wal.grpc.pb.cc new file mode 100644 index 0000000..fa8f135 --- /dev/null +++ b/c++/greptime/v1/wal.grpc.pb.cc @@ -0,0 +1,27 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: greptime/v1/wal.proto + +#include "greptime/v1/wal.pb.h" +#include "greptime/v1/wal.grpc.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace greptime { +namespace v1 { + +} // namespace greptime +} // namespace v1 + diff --git a/c++/greptime/v1/wal.grpc.pb.h b/c++/greptime/v1/wal.grpc.pb.h new file mode 100644 index 0000000..9e9a101 --- /dev/null +++ b/c++/greptime/v1/wal.grpc.pb.h @@ -0,0 +1,50 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: greptime/v1/wal.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_2fwal_2eproto__INCLUDED +#define GRPC_greptime_2fv1_2fwal_2eproto__INCLUDED + +#include "greptime/v1/wal.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 v1 +} // namespace greptime + + +#endif // GRPC_greptime_2fv1_2fwal_2eproto__INCLUDED diff --git a/c++/greptime/v1/wal.pb.cc b/c++/greptime/v1/wal.pb.cc new file mode 100644 index 0000000..2a97cff --- /dev/null +++ b/c++/greptime/v1/wal.pb.cc @@ -0,0 +1,593 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: greptime/v1/wal.proto + +#include "greptime/v1/wal.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 { +PROTOBUF_CONSTEXPR Mutation::Mutation( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.rows_)*/nullptr + , /*decltype(_impl_.sequence_)*/uint64_t{0u} + , /*decltype(_impl_.op_type_)*/0 + , /*decltype(_impl_._cached_size_)*/{}} {} +struct MutationDefaultTypeInternal { + PROTOBUF_CONSTEXPR MutationDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~MutationDefaultTypeInternal() {} + union { + Mutation _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MutationDefaultTypeInternal _Mutation_default_instance_; +PROTOBUF_CONSTEXPR WalEntry::WalEntry( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.mutations_)*/{} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct WalEntryDefaultTypeInternal { + PROTOBUF_CONSTEXPR WalEntryDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~WalEntryDefaultTypeInternal() {} + union { + WalEntry _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 WalEntryDefaultTypeInternal _WalEntry_default_instance_; +} // namespace v1 +} // namespace greptime +static ::_pb::Metadata file_level_metadata_greptime_2fv1_2fwal_2eproto[2]; +static const ::_pb::EnumDescriptor* file_level_enum_descriptors_greptime_2fv1_2fwal_2eproto[1]; +static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_greptime_2fv1_2fwal_2eproto = nullptr; + +const uint32_t TableStruct_greptime_2fv1_2fwal_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::greptime::v1::Mutation, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::greptime::v1::Mutation, _impl_.op_type_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::Mutation, _impl_.sequence_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::Mutation, _impl_.rows_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::greptime::v1::WalEntry, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::greptime::v1::WalEntry, _impl_.mutations_), +}; +static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::greptime::v1::Mutation)}, + { 9, -1, -1, sizeof(::greptime::v1::WalEntry)}, +}; + +static const ::_pb::Message* const file_default_instances[] = { + &::greptime::v1::_Mutation_default_instance_._instance, + &::greptime::v1::_WalEntry_default_instance_._instance, +}; + +const char descriptor_table_protodef_greptime_2fv1_2fwal_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\025greptime/v1/wal.proto\022\013greptime.v1\032\025gr" + "eptime/v1/row.proto\"c\n\010Mutation\022$\n\007op_ty" + "pe\030\001 \001(\0162\023.greptime.v1.OpType\022\020\n\010sequenc" + "e\030\002 \001(\004\022\037\n\004rows\030\003 \001(\0132\021.greptime.v1.Rows" + "\"4\n\010WalEntry\022(\n\tmutations\030\001 \003(\0132\025.grepti" + "me.v1.Mutation*\035\n\006OpType\022\n\n\006DELETE\020\000\022\007\n\003" + "PUT\020\001B7Z5github.com/GreptimeTeam/greptim" + "e-proto/go/greptime/v1b\006proto3" + ; +static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2fwal_2eproto_deps[1] = { + &::descriptor_table_greptime_2fv1_2frow_2eproto, +}; +static ::_pbi::once_flag descriptor_table_greptime_2fv1_2fwal_2eproto_once; +const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2fwal_2eproto = { + false, false, 310, descriptor_table_protodef_greptime_2fv1_2fwal_2eproto, + "greptime/v1/wal.proto", + &descriptor_table_greptime_2fv1_2fwal_2eproto_once, descriptor_table_greptime_2fv1_2fwal_2eproto_deps, 1, 2, + schemas, file_default_instances, TableStruct_greptime_2fv1_2fwal_2eproto::offsets, + file_level_metadata_greptime_2fv1_2fwal_2eproto, file_level_enum_descriptors_greptime_2fv1_2fwal_2eproto, + file_level_service_descriptors_greptime_2fv1_2fwal_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_greptime_2fv1_2fwal_2eproto_getter() { + return &descriptor_table_greptime_2fv1_2fwal_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_greptime_2fv1_2fwal_2eproto(&descriptor_table_greptime_2fv1_2fwal_2eproto); +namespace greptime { +namespace v1 { +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* OpType_descriptor() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_greptime_2fv1_2fwal_2eproto); + return file_level_enum_descriptors_greptime_2fv1_2fwal_2eproto[0]; +} +bool OpType_IsValid(int value) { + switch (value) { + case 0: + case 1: + return true; + default: + return false; + } +} + + +// =================================================================== + +class Mutation::_Internal { + public: + static const ::greptime::v1::Rows& rows(const Mutation* msg); +}; + +const ::greptime::v1::Rows& +Mutation::_Internal::rows(const Mutation* msg) { + return *msg->_impl_.rows_; +} +void Mutation::clear_rows() { + if (GetArenaForAllocation() == nullptr && _impl_.rows_ != nullptr) { + delete _impl_.rows_; + } + _impl_.rows_ = nullptr; +} +Mutation::Mutation(::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.Mutation) +} +Mutation::Mutation(const Mutation& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + Mutation* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.rows_){nullptr} + , decltype(_impl_.sequence_){} + , decltype(_impl_.op_type_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + if (from._internal_has_rows()) { + _this->_impl_.rows_ = new ::greptime::v1::Rows(*from._impl_.rows_); + } + ::memcpy(&_impl_.sequence_, &from._impl_.sequence_, + static_cast(reinterpret_cast(&_impl_.op_type_) - + reinterpret_cast(&_impl_.sequence_)) + sizeof(_impl_.op_type_)); + // @@protoc_insertion_point(copy_constructor:greptime.v1.Mutation) +} + +inline void Mutation::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.rows_){nullptr} + , decltype(_impl_.sequence_){uint64_t{0u}} + , decltype(_impl_.op_type_){0} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +Mutation::~Mutation() { + // @@protoc_insertion_point(destructor:greptime.v1.Mutation) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void Mutation::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete _impl_.rows_; +} + +void Mutation::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void Mutation::Clear() { +// @@protoc_insertion_point(message_clear_start:greptime.v1.Mutation) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (GetArenaForAllocation() == nullptr && _impl_.rows_ != nullptr) { + delete _impl_.rows_; + } + _impl_.rows_ = nullptr; + ::memset(&_impl_.sequence_, 0, static_cast( + reinterpret_cast(&_impl_.op_type_) - + reinterpret_cast(&_impl_.sequence_)) + sizeof(_impl_.op_type_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* Mutation::_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.OpType op_type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + _internal_set_op_type(static_cast<::greptime::v1::OpType>(val)); + } else + goto handle_unusual; + continue; + // uint64 sequence = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _impl_.sequence_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .greptime.v1.Rows rows = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_rows(), 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* Mutation::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:greptime.v1.Mutation) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // .greptime.v1.OpType op_type = 1; + if (this->_internal_op_type() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this->_internal_op_type(), target); + } + + // uint64 sequence = 2; + if (this->_internal_sequence() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_sequence(), target); + } + + // .greptime.v1.Rows rows = 3; + if (this->_internal_has_rows()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(3, _Internal::rows(this), + _Internal::rows(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.Mutation) + return target; +} + +size_t Mutation::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:greptime.v1.Mutation) + 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.Rows rows = 3; + if (this->_internal_has_rows()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.rows_); + } + + // uint64 sequence = 2; + if (this->_internal_sequence() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_sequence()); + } + + // .greptime.v1.OpType op_type = 1; + if (this->_internal_op_type() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_op_type()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Mutation::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + Mutation::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Mutation::GetClassData() const { return &_class_data_; } + + +void Mutation::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.Mutation) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_rows()) { + _this->_internal_mutable_rows()->::greptime::v1::Rows::MergeFrom( + from._internal_rows()); + } + if (from._internal_sequence() != 0) { + _this->_internal_set_sequence(from._internal_sequence()); + } + if (from._internal_op_type() != 0) { + _this->_internal_set_op_type(from._internal_op_type()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void Mutation::CopyFrom(const Mutation& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:greptime.v1.Mutation) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Mutation::IsInitialized() const { + return true; +} + +void Mutation::InternalSwap(Mutation* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(Mutation, _impl_.op_type_) + + sizeof(Mutation::_impl_.op_type_) + - PROTOBUF_FIELD_OFFSET(Mutation, _impl_.rows_)>( + reinterpret_cast(&_impl_.rows_), + reinterpret_cast(&other->_impl_.rows_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Mutation::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_greptime_2fv1_2fwal_2eproto_getter, &descriptor_table_greptime_2fv1_2fwal_2eproto_once, + file_level_metadata_greptime_2fv1_2fwal_2eproto[0]); +} + +// =================================================================== + +class WalEntry::_Internal { + public: +}; + +WalEntry::WalEntry(::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.WalEntry) +} +WalEntry::WalEntry(const WalEntry& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + WalEntry* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.mutations_){from._impl_.mutations_} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:greptime.v1.WalEntry) +} + +inline void WalEntry::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.mutations_){arena} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +WalEntry::~WalEntry() { + // @@protoc_insertion_point(destructor:greptime.v1.WalEntry) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void WalEntry::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.mutations_.~RepeatedPtrField(); +} + +void WalEntry::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void WalEntry::Clear() { +// @@protoc_insertion_point(message_clear_start:greptime.v1.WalEntry) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.mutations_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* WalEntry::_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) { + // repeated .greptime.v1.Mutation mutations = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_mutations(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(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* WalEntry::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:greptime.v1.WalEntry) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .greptime.v1.Mutation mutations = 1; + for (unsigned i = 0, + n = static_cast(this->_internal_mutations_size()); i < n; i++) { + const auto& repfield = this->_internal_mutations(i); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, repfield, repfield.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.WalEntry) + return target; +} + +size_t WalEntry::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:greptime.v1.WalEntry) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .greptime.v1.Mutation mutations = 1; + total_size += 1UL * this->_internal_mutations_size(); + for (const auto& msg : this->_impl_.mutations_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData WalEntry::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + WalEntry::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*WalEntry::GetClassData() const { return &_class_data_; } + + +void WalEntry::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.WalEntry) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.mutations_.MergeFrom(from._impl_.mutations_); + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void WalEntry::CopyFrom(const WalEntry& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:greptime.v1.WalEntry) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool WalEntry::IsInitialized() const { + return true; +} + +void WalEntry::InternalSwap(WalEntry* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.mutations_.InternalSwap(&other->_impl_.mutations_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata WalEntry::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_greptime_2fv1_2fwal_2eproto_getter, &descriptor_table_greptime_2fv1_2fwal_2eproto_once, + file_level_metadata_greptime_2fv1_2fwal_2eproto[1]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace v1 +} // namespace greptime +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::greptime::v1::Mutation* +Arena::CreateMaybeMessage< ::greptime::v1::Mutation >(Arena* arena) { + return Arena::CreateMessageInternal< ::greptime::v1::Mutation >(arena); +} +template<> PROTOBUF_NOINLINE ::greptime::v1::WalEntry* +Arena::CreateMaybeMessage< ::greptime::v1::WalEntry >(Arena* arena) { + return Arena::CreateMessageInternal< ::greptime::v1::WalEntry >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/c++/greptime/v1/wal.pb.h b/c++/greptime/v1/wal.pb.h new file mode 100644 index 0000000..302a085 --- /dev/null +++ b/c++/greptime/v1/wal.pb.h @@ -0,0 +1,631 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: greptime/v1/wal.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_greptime_2fv1_2fwal_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_greptime_2fv1_2fwal_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 +#include "greptime/v1/row.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_greptime_2fv1_2fwal_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_2fwal_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_greptime_2fv1_2fwal_2eproto; +namespace greptime { +namespace v1 { +class Mutation; +struct MutationDefaultTypeInternal; +extern MutationDefaultTypeInternal _Mutation_default_instance_; +class WalEntry; +struct WalEntryDefaultTypeInternal; +extern WalEntryDefaultTypeInternal _WalEntry_default_instance_; +} // namespace v1 +} // namespace greptime +PROTOBUF_NAMESPACE_OPEN +template<> ::greptime::v1::Mutation* Arena::CreateMaybeMessage<::greptime::v1::Mutation>(Arena*); +template<> ::greptime::v1::WalEntry* Arena::CreateMaybeMessage<::greptime::v1::WalEntry>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace greptime { +namespace v1 { + +enum OpType : int { + DELETE = 0, + PUT = 1, + OpType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), + OpType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() +}; +bool OpType_IsValid(int value); +constexpr OpType OpType_MIN = DELETE; +constexpr OpType OpType_MAX = PUT; +constexpr int OpType_ARRAYSIZE = OpType_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* OpType_descriptor(); +template +inline const std::string& OpType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function OpType_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + OpType_descriptor(), enum_t_value); +} +inline bool OpType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OpType* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + OpType_descriptor(), name, value); +} +// =================================================================== + +class Mutation final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:greptime.v1.Mutation) */ { + public: + inline Mutation() : Mutation(nullptr) {} + ~Mutation() override; + explicit PROTOBUF_CONSTEXPR Mutation(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + Mutation(const Mutation& from); + Mutation(Mutation&& from) noexcept + : Mutation() { + *this = ::std::move(from); + } + + inline Mutation& operator=(const Mutation& from) { + CopyFrom(from); + return *this; + } + inline Mutation& operator=(Mutation&& 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 Mutation& default_instance() { + return *internal_default_instance(); + } + static inline const Mutation* internal_default_instance() { + return reinterpret_cast( + &_Mutation_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(Mutation& a, Mutation& b) { + a.Swap(&b); + } + inline void Swap(Mutation* 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(Mutation* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + Mutation* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const Mutation& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const Mutation& from) { + Mutation::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(Mutation* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "greptime.v1.Mutation"; + } + protected: + explicit Mutation(::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 { + kRowsFieldNumber = 3, + kSequenceFieldNumber = 2, + kOpTypeFieldNumber = 1, + }; + // .greptime.v1.Rows rows = 3; + bool has_rows() const; + private: + bool _internal_has_rows() const; + public: + void clear_rows(); + const ::greptime::v1::Rows& rows() const; + PROTOBUF_NODISCARD ::greptime::v1::Rows* release_rows(); + ::greptime::v1::Rows* mutable_rows(); + void set_allocated_rows(::greptime::v1::Rows* rows); + private: + const ::greptime::v1::Rows& _internal_rows() const; + ::greptime::v1::Rows* _internal_mutable_rows(); + public: + void unsafe_arena_set_allocated_rows( + ::greptime::v1::Rows* rows); + ::greptime::v1::Rows* unsafe_arena_release_rows(); + + // uint64 sequence = 2; + void clear_sequence(); + uint64_t sequence() const; + void set_sequence(uint64_t value); + private: + uint64_t _internal_sequence() const; + void _internal_set_sequence(uint64_t value); + public: + + // .greptime.v1.OpType op_type = 1; + void clear_op_type(); + ::greptime::v1::OpType op_type() const; + void set_op_type(::greptime::v1::OpType value); + private: + ::greptime::v1::OpType _internal_op_type() const; + void _internal_set_op_type(::greptime::v1::OpType value); + public: + + // @@protoc_insertion_point(class_scope:greptime.v1.Mutation) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::greptime::v1::Rows* rows_; + uint64_t sequence_; + int op_type_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_greptime_2fv1_2fwal_2eproto; +}; +// ------------------------------------------------------------------- + +class WalEntry final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:greptime.v1.WalEntry) */ { + public: + inline WalEntry() : WalEntry(nullptr) {} + ~WalEntry() override; + explicit PROTOBUF_CONSTEXPR WalEntry(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + WalEntry(const WalEntry& from); + WalEntry(WalEntry&& from) noexcept + : WalEntry() { + *this = ::std::move(from); + } + + inline WalEntry& operator=(const WalEntry& from) { + CopyFrom(from); + return *this; + } + inline WalEntry& operator=(WalEntry&& 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 WalEntry& default_instance() { + return *internal_default_instance(); + } + static inline const WalEntry* internal_default_instance() { + return reinterpret_cast( + &_WalEntry_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(WalEntry& a, WalEntry& b) { + a.Swap(&b); + } + inline void Swap(WalEntry* 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(WalEntry* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + WalEntry* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const WalEntry& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const WalEntry& from) { + WalEntry::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(WalEntry* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "greptime.v1.WalEntry"; + } + protected: + explicit WalEntry(::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 { + kMutationsFieldNumber = 1, + }; + // repeated .greptime.v1.Mutation mutations = 1; + int mutations_size() const; + private: + int _internal_mutations_size() const; + public: + void clear_mutations(); + ::greptime::v1::Mutation* mutable_mutations(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::greptime::v1::Mutation >* + mutable_mutations(); + private: + const ::greptime::v1::Mutation& _internal_mutations(int index) const; + ::greptime::v1::Mutation* _internal_add_mutations(); + public: + const ::greptime::v1::Mutation& mutations(int index) const; + ::greptime::v1::Mutation* add_mutations(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::greptime::v1::Mutation >& + mutations() const; + + // @@protoc_insertion_point(class_scope:greptime.v1.WalEntry) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::greptime::v1::Mutation > mutations_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_greptime_2fv1_2fwal_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// Mutation + +// .greptime.v1.OpType op_type = 1; +inline void Mutation::clear_op_type() { + _impl_.op_type_ = 0; +} +inline ::greptime::v1::OpType Mutation::_internal_op_type() const { + return static_cast< ::greptime::v1::OpType >(_impl_.op_type_); +} +inline ::greptime::v1::OpType Mutation::op_type() const { + // @@protoc_insertion_point(field_get:greptime.v1.Mutation.op_type) + return _internal_op_type(); +} +inline void Mutation::_internal_set_op_type(::greptime::v1::OpType value) { + + _impl_.op_type_ = value; +} +inline void Mutation::set_op_type(::greptime::v1::OpType value) { + _internal_set_op_type(value); + // @@protoc_insertion_point(field_set:greptime.v1.Mutation.op_type) +} + +// uint64 sequence = 2; +inline void Mutation::clear_sequence() { + _impl_.sequence_ = uint64_t{0u}; +} +inline uint64_t Mutation::_internal_sequence() const { + return _impl_.sequence_; +} +inline uint64_t Mutation::sequence() const { + // @@protoc_insertion_point(field_get:greptime.v1.Mutation.sequence) + return _internal_sequence(); +} +inline void Mutation::_internal_set_sequence(uint64_t value) { + + _impl_.sequence_ = value; +} +inline void Mutation::set_sequence(uint64_t value) { + _internal_set_sequence(value); + // @@protoc_insertion_point(field_set:greptime.v1.Mutation.sequence) +} + +// .greptime.v1.Rows rows = 3; +inline bool Mutation::_internal_has_rows() const { + return this != internal_default_instance() && _impl_.rows_ != nullptr; +} +inline bool Mutation::has_rows() const { + return _internal_has_rows(); +} +inline const ::greptime::v1::Rows& Mutation::_internal_rows() const { + const ::greptime::v1::Rows* p = _impl_.rows_; + return p != nullptr ? *p : reinterpret_cast( + ::greptime::v1::_Rows_default_instance_); +} +inline const ::greptime::v1::Rows& Mutation::rows() const { + // @@protoc_insertion_point(field_get:greptime.v1.Mutation.rows) + return _internal_rows(); +} +inline void Mutation::unsafe_arena_set_allocated_rows( + ::greptime::v1::Rows* rows) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.rows_); + } + _impl_.rows_ = rows; + if (rows) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:greptime.v1.Mutation.rows) +} +inline ::greptime::v1::Rows* Mutation::release_rows() { + + ::greptime::v1::Rows* temp = _impl_.rows_; + _impl_.rows_ = 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::Rows* Mutation::unsafe_arena_release_rows() { + // @@protoc_insertion_point(field_release:greptime.v1.Mutation.rows) + + ::greptime::v1::Rows* temp = _impl_.rows_; + _impl_.rows_ = nullptr; + return temp; +} +inline ::greptime::v1::Rows* Mutation::_internal_mutable_rows() { + + if (_impl_.rows_ == nullptr) { + auto* p = CreateMaybeMessage<::greptime::v1::Rows>(GetArenaForAllocation()); + _impl_.rows_ = p; + } + return _impl_.rows_; +} +inline ::greptime::v1::Rows* Mutation::mutable_rows() { + ::greptime::v1::Rows* _msg = _internal_mutable_rows(); + // @@protoc_insertion_point(field_mutable:greptime.v1.Mutation.rows) + return _msg; +} +inline void Mutation::set_allocated_rows(::greptime::v1::Rows* rows) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.rows_); + } + if (rows) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(rows)); + if (message_arena != submessage_arena) { + rows = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, rows, submessage_arena); + } + + } else { + + } + _impl_.rows_ = rows; + // @@protoc_insertion_point(field_set_allocated:greptime.v1.Mutation.rows) +} + +// ------------------------------------------------------------------- + +// WalEntry + +// repeated .greptime.v1.Mutation mutations = 1; +inline int WalEntry::_internal_mutations_size() const { + return _impl_.mutations_.size(); +} +inline int WalEntry::mutations_size() const { + return _internal_mutations_size(); +} +inline void WalEntry::clear_mutations() { + _impl_.mutations_.Clear(); +} +inline ::greptime::v1::Mutation* WalEntry::mutable_mutations(int index) { + // @@protoc_insertion_point(field_mutable:greptime.v1.WalEntry.mutations) + return _impl_.mutations_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::greptime::v1::Mutation >* +WalEntry::mutable_mutations() { + // @@protoc_insertion_point(field_mutable_list:greptime.v1.WalEntry.mutations) + return &_impl_.mutations_; +} +inline const ::greptime::v1::Mutation& WalEntry::_internal_mutations(int index) const { + return _impl_.mutations_.Get(index); +} +inline const ::greptime::v1::Mutation& WalEntry::mutations(int index) const { + // @@protoc_insertion_point(field_get:greptime.v1.WalEntry.mutations) + return _internal_mutations(index); +} +inline ::greptime::v1::Mutation* WalEntry::_internal_add_mutations() { + return _impl_.mutations_.Add(); +} +inline ::greptime::v1::Mutation* WalEntry::add_mutations() { + ::greptime::v1::Mutation* _add = _internal_add_mutations(); + // @@protoc_insertion_point(field_add:greptime.v1.WalEntry.mutations) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::greptime::v1::Mutation >& +WalEntry::mutations() const { + // @@protoc_insertion_point(field_list:greptime.v1.WalEntry.mutations) + return _impl_.mutations_; +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace v1 +} // namespace greptime + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::greptime::v1::OpType> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::greptime::v1::OpType>() { + return ::greptime::v1::OpType_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_greptime_2fv1_2fwal_2eproto diff --git a/go/greptime/v1/wal.pb.go b/go/greptime/v1/wal.pb.go new file mode 100644 index 0000000..4243c8b --- /dev/null +++ b/go/greptime/v1/wal.pb.go @@ -0,0 +1,311 @@ +// 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/wal.proto + +package v1 + +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) +) + +// Type of operation to rows. +type OpType int32 + +const ( + // Delete rows. + OpType_DELETE OpType = 0 + // Put rows. + OpType_PUT OpType = 1 +) + +// Enum value maps for OpType. +var ( + OpType_name = map[int32]string{ + 0: "DELETE", + 1: "PUT", + } + OpType_value = map[string]int32{ + "DELETE": 0, + "PUT": 1, + } +) + +func (x OpType) Enum() *OpType { + p := new(OpType) + *p = x + return p +} + +func (x OpType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OpType) Descriptor() protoreflect.EnumDescriptor { + return file_greptime_v1_wal_proto_enumTypes[0].Descriptor() +} + +func (OpType) Type() protoreflect.EnumType { + return &file_greptime_v1_wal_proto_enumTypes[0] +} + +func (x OpType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OpType.Descriptor instead. +func (OpType) EnumDescriptor() ([]byte, []int) { + return file_greptime_v1_wal_proto_rawDescGZIP(), []int{0} +} + +// Mutation contains updates to a set of rows. +type Mutation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Type of this mutation. + OpType OpType `protobuf:"varint,1,opt,name=op_type,json=opType,proto3,enum=greptime.v1.OpType" json:"op_type,omitempty"` + // Start WAL sequence of this mutation. + Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` + // Row updates to write to the WAL. + Rows *Rows `protobuf:"bytes,3,opt,name=rows,proto3" json:"rows,omitempty"` +} + +func (x *Mutation) Reset() { + *x = Mutation{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_wal_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Mutation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Mutation) ProtoMessage() {} + +func (x *Mutation) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_wal_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 Mutation.ProtoReflect.Descriptor instead. +func (*Mutation) Descriptor() ([]byte, []int) { + return file_greptime_v1_wal_proto_rawDescGZIP(), []int{0} +} + +func (x *Mutation) GetOpType() OpType { + if x != nil { + return x.OpType + } + return OpType_DELETE +} + +func (x *Mutation) GetSequence() uint64 { + if x != nil { + return x.Sequence + } + return 0 +} + +func (x *Mutation) GetRows() *Rows { + if x != nil { + return x.Rows + } + return nil +} + +// A WAL entry contains a list of mutations for a region to write. +type WalEntry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // List of mutations for a region. + Mutations []*Mutation `protobuf:"bytes,1,rep,name=mutations,proto3" json:"mutations,omitempty"` +} + +func (x *WalEntry) Reset() { + *x = WalEntry{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_wal_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WalEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WalEntry) ProtoMessage() {} + +func (x *WalEntry) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_wal_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 WalEntry.ProtoReflect.Descriptor instead. +func (*WalEntry) Descriptor() ([]byte, []int) { + return file_greptime_v1_wal_proto_rawDescGZIP(), []int{1} +} + +func (x *WalEntry) GetMutations() []*Mutation { + if x != nil { + return x.Mutations + } + return nil +} + +var File_greptime_v1_wal_proto protoreflect.FileDescriptor + +var file_greptime_v1_wal_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, + 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x15, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, + 0x31, 0x2f, 0x72, 0x6f, 0x77, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7b, 0x0a, 0x08, 0x4d, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x07, 0x6f, 0x70, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, + 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x06, 0x6f, + 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x12, 0x25, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x11, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, + 0x77, 0x73, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x22, 0x3f, 0x0a, 0x08, 0x57, 0x61, 0x6c, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x33, 0x0a, 0x09, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, + 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, + 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2a, 0x1d, 0x0a, 0x06, 0x4f, 0x70, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x00, 0x12, + 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x42, 0x37, 0x5a, 0x35, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_greptime_v1_wal_proto_rawDescOnce sync.Once + file_greptime_v1_wal_proto_rawDescData = file_greptime_v1_wal_proto_rawDesc +) + +func file_greptime_v1_wal_proto_rawDescGZIP() []byte { + file_greptime_v1_wal_proto_rawDescOnce.Do(func() { + file_greptime_v1_wal_proto_rawDescData = protoimpl.X.CompressGZIP(file_greptime_v1_wal_proto_rawDescData) + }) + return file_greptime_v1_wal_proto_rawDescData +} + +var file_greptime_v1_wal_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_greptime_v1_wal_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_greptime_v1_wal_proto_goTypes = []interface{}{ + (OpType)(0), // 0: greptime.v1.OpType + (*Mutation)(nil), // 1: greptime.v1.Mutation + (*WalEntry)(nil), // 2: greptime.v1.WalEntry + (*Rows)(nil), // 3: greptime.v1.Rows +} +var file_greptime_v1_wal_proto_depIdxs = []int32{ + 0, // 0: greptime.v1.Mutation.op_type:type_name -> greptime.v1.OpType + 3, // 1: greptime.v1.Mutation.rows:type_name -> greptime.v1.Rows + 1, // 2: greptime.v1.WalEntry.mutations:type_name -> greptime.v1.Mutation + 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_wal_proto_init() } +func file_greptime_v1_wal_proto_init() { + if File_greptime_v1_wal_proto != nil { + return + } + file_greptime_v1_row_proto_init() + if !protoimpl.UnsafeEnabled { + file_greptime_v1_wal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Mutation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_wal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WalEntry); 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_wal_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_greptime_v1_wal_proto_goTypes, + DependencyIndexes: file_greptime_v1_wal_proto_depIdxs, + EnumInfos: file_greptime_v1_wal_proto_enumTypes, + MessageInfos: file_greptime_v1_wal_proto_msgTypes, + }.Build() + File_greptime_v1_wal_proto = out.File + file_greptime_v1_wal_proto_rawDesc = nil + file_greptime_v1_wal_proto_goTypes = nil + file_greptime_v1_wal_proto_depIdxs = nil +} diff --git a/java/src/main/java/greptime/v1/Wal.java b/java/src/main/java/greptime/v1/Wal.java new file mode 100644 index 0000000..1ec61be --- /dev/null +++ b/java/src/main/java/greptime/v1/Wal.java @@ -0,0 +1,2034 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: greptime/v1/wal.proto + +package greptime.v1; + +public final class Wal { + private Wal() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + *
+   * Type of operation to rows.
+   * 
+ * + * Protobuf enum {@code greptime.v1.OpType} + */ + public enum OpType + implements com.google.protobuf.ProtocolMessageEnum { + /** + *
+     * Delete rows.
+     * 
+ * + * DELETE = 0; + */ + DELETE(0), + /** + *
+     * Put rows.
+     * 
+ * + * PUT = 1; + */ + PUT(1), + UNRECOGNIZED(-1), + ; + + /** + *
+     * Delete rows.
+     * 
+ * + * DELETE = 0; + */ + public static final int DELETE_VALUE = 0; + /** + *
+     * Put rows.
+     * 
+ * + * PUT = 1; + */ + public static final int PUT_VALUE = 1; + + + 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 OpType 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 OpType forNumber(int value) { + switch (value) { + case 0: return DELETE; + case 1: return PUT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + OpType> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public OpType findValueByNumber(int number) { + return OpType.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.Wal.getDescriptor().getEnumTypes().get(0); + } + + private static final OpType[] VALUES = values(); + + public static OpType 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 OpType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:greptime.v1.OpType) + } + + public interface MutationOrBuilder extends + // @@protoc_insertion_point(interface_extends:greptime.v1.Mutation) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * Type of this mutation.
+     * 
+ * + * .greptime.v1.OpType op_type = 1; + * @return The enum numeric value on the wire for opType. + */ + int getOpTypeValue(); + /** + *
+     * Type of this mutation.
+     * 
+ * + * .greptime.v1.OpType op_type = 1; + * @return The opType. + */ + greptime.v1.Wal.OpType getOpType(); + + /** + *
+     * Start WAL sequence of this mutation.
+     * 
+ * + * uint64 sequence = 2; + * @return The sequence. + */ + long getSequence(); + + /** + *
+     * Row updates to write to the WAL.
+     * 
+ * + * .greptime.v1.Rows rows = 3; + * @return Whether the rows field is set. + */ + boolean hasRows(); + /** + *
+     * Row updates to write to the WAL.
+     * 
+ * + * .greptime.v1.Rows rows = 3; + * @return The rows. + */ + io.greptime.v1.RowData.Rows getRows(); + /** + *
+     * Row updates to write to the WAL.
+     * 
+ * + * .greptime.v1.Rows rows = 3; + */ + io.greptime.v1.RowData.RowsOrBuilder getRowsOrBuilder(); + } + /** + *
+   * Mutation contains updates to a set of rows.
+   * 
+ * + * Protobuf type {@code greptime.v1.Mutation} + */ + public static final class Mutation extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:greptime.v1.Mutation) + MutationOrBuilder { + private static final long serialVersionUID = 0L; + // Use Mutation.newBuilder() to construct. + private Mutation(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Mutation() { + opType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Mutation(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Mutation( + 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(); + + opType_ = rawValue; + break; + } + case 16: { + + sequence_ = input.readUInt64(); + break; + } + case 26: { + io.greptime.v1.RowData.Rows.Builder subBuilder = null; + if (rows_ != null) { + subBuilder = rows_.toBuilder(); + } + rows_ = input.readMessage(io.greptime.v1.RowData.Rows.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(rows_); + rows_ = 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.Wal.internal_static_greptime_v1_Mutation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return greptime.v1.Wal.internal_static_greptime_v1_Mutation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + greptime.v1.Wal.Mutation.class, greptime.v1.Wal.Mutation.Builder.class); + } + + public static final int OP_TYPE_FIELD_NUMBER = 1; + private int opType_; + /** + *
+     * Type of this mutation.
+     * 
+ * + * .greptime.v1.OpType op_type = 1; + * @return The enum numeric value on the wire for opType. + */ + @java.lang.Override public int getOpTypeValue() { + return opType_; + } + /** + *
+     * Type of this mutation.
+     * 
+ * + * .greptime.v1.OpType op_type = 1; + * @return The opType. + */ + @java.lang.Override public greptime.v1.Wal.OpType getOpType() { + @SuppressWarnings("deprecation") + greptime.v1.Wal.OpType result = greptime.v1.Wal.OpType.valueOf(opType_); + return result == null ? greptime.v1.Wal.OpType.UNRECOGNIZED : result; + } + + public static final int SEQUENCE_FIELD_NUMBER = 2; + private long sequence_; + /** + *
+     * Start WAL sequence of this mutation.
+     * 
+ * + * uint64 sequence = 2; + * @return The sequence. + */ + @java.lang.Override + public long getSequence() { + return sequence_; + } + + public static final int ROWS_FIELD_NUMBER = 3; + private io.greptime.v1.RowData.Rows rows_; + /** + *
+     * Row updates to write to the WAL.
+     * 
+ * + * .greptime.v1.Rows rows = 3; + * @return Whether the rows field is set. + */ + @java.lang.Override + public boolean hasRows() { + return rows_ != null; + } + /** + *
+     * Row updates to write to the WAL.
+     * 
+ * + * .greptime.v1.Rows rows = 3; + * @return The rows. + */ + @java.lang.Override + public io.greptime.v1.RowData.Rows getRows() { + return rows_ == null ? io.greptime.v1.RowData.Rows.getDefaultInstance() : rows_; + } + /** + *
+     * Row updates to write to the WAL.
+     * 
+ * + * .greptime.v1.Rows rows = 3; + */ + @java.lang.Override + public io.greptime.v1.RowData.RowsOrBuilder getRowsOrBuilder() { + return getRows(); + } + + 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 (opType_ != greptime.v1.Wal.OpType.DELETE.getNumber()) { + output.writeEnum(1, opType_); + } + if (sequence_ != 0L) { + output.writeUInt64(2, sequence_); + } + if (rows_ != null) { + output.writeMessage(3, getRows()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (opType_ != greptime.v1.Wal.OpType.DELETE.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, opType_); + } + if (sequence_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(2, sequence_); + } + if (rows_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getRows()); + } + 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.Wal.Mutation)) { + return super.equals(obj); + } + greptime.v1.Wal.Mutation other = (greptime.v1.Wal.Mutation) obj; + + if (opType_ != other.opType_) return false; + if (getSequence() + != other.getSequence()) return false; + if (hasRows() != other.hasRows()) return false; + if (hasRows()) { + if (!getRows() + .equals(other.getRows())) 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) + OP_TYPE_FIELD_NUMBER; + hash = (53 * hash) + opType_; + hash = (37 * hash) + SEQUENCE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getSequence()); + if (hasRows()) { + hash = (37 * hash) + ROWS_FIELD_NUMBER; + hash = (53 * hash) + getRows().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static greptime.v1.Wal.Mutation parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.Wal.Mutation parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.Wal.Mutation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.Wal.Mutation 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.Wal.Mutation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.Wal.Mutation parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.Wal.Mutation parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static greptime.v1.Wal.Mutation 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.Wal.Mutation parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static greptime.v1.Wal.Mutation 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.Wal.Mutation parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static greptime.v1.Wal.Mutation 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.Wal.Mutation 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; + } + /** + *
+     * Mutation contains updates to a set of rows.
+     * 
+ * + * Protobuf type {@code greptime.v1.Mutation} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:greptime.v1.Mutation) + greptime.v1.Wal.MutationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return greptime.v1.Wal.internal_static_greptime_v1_Mutation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return greptime.v1.Wal.internal_static_greptime_v1_Mutation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + greptime.v1.Wal.Mutation.class, greptime.v1.Wal.Mutation.Builder.class); + } + + // Construct using greptime.v1.Wal.Mutation.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(); + opType_ = 0; + + sequence_ = 0L; + + if (rowsBuilder_ == null) { + rows_ = null; + } else { + rows_ = null; + rowsBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return greptime.v1.Wal.internal_static_greptime_v1_Mutation_descriptor; + } + + @java.lang.Override + public greptime.v1.Wal.Mutation getDefaultInstanceForType() { + return greptime.v1.Wal.Mutation.getDefaultInstance(); + } + + @java.lang.Override + public greptime.v1.Wal.Mutation build() { + greptime.v1.Wal.Mutation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public greptime.v1.Wal.Mutation buildPartial() { + greptime.v1.Wal.Mutation result = new greptime.v1.Wal.Mutation(this); + result.opType_ = opType_; + result.sequence_ = sequence_; + if (rowsBuilder_ == null) { + result.rows_ = rows_; + } else { + result.rows_ = rowsBuilder_.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.Wal.Mutation) { + return mergeFrom((greptime.v1.Wal.Mutation)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(greptime.v1.Wal.Mutation other) { + if (other == greptime.v1.Wal.Mutation.getDefaultInstance()) return this; + if (other.opType_ != 0) { + setOpTypeValue(other.getOpTypeValue()); + } + if (other.getSequence() != 0L) { + setSequence(other.getSequence()); + } + if (other.hasRows()) { + mergeRows(other.getRows()); + } + 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.Wal.Mutation parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (greptime.v1.Wal.Mutation) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int opType_ = 0; + /** + *
+       * Type of this mutation.
+       * 
+ * + * .greptime.v1.OpType op_type = 1; + * @return The enum numeric value on the wire for opType. + */ + @java.lang.Override public int getOpTypeValue() { + return opType_; + } + /** + *
+       * Type of this mutation.
+       * 
+ * + * .greptime.v1.OpType op_type = 1; + * @param value The enum numeric value on the wire for opType to set. + * @return This builder for chaining. + */ + public Builder setOpTypeValue(int value) { + + opType_ = value; + onChanged(); + return this; + } + /** + *
+       * Type of this mutation.
+       * 
+ * + * .greptime.v1.OpType op_type = 1; + * @return The opType. + */ + @java.lang.Override + public greptime.v1.Wal.OpType getOpType() { + @SuppressWarnings("deprecation") + greptime.v1.Wal.OpType result = greptime.v1.Wal.OpType.valueOf(opType_); + return result == null ? greptime.v1.Wal.OpType.UNRECOGNIZED : result; + } + /** + *
+       * Type of this mutation.
+       * 
+ * + * .greptime.v1.OpType op_type = 1; + * @param value The opType to set. + * @return This builder for chaining. + */ + public Builder setOpType(greptime.v1.Wal.OpType value) { + if (value == null) { + throw new NullPointerException(); + } + + opType_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+       * Type of this mutation.
+       * 
+ * + * .greptime.v1.OpType op_type = 1; + * @return This builder for chaining. + */ + public Builder clearOpType() { + + opType_ = 0; + onChanged(); + return this; + } + + private long sequence_ ; + /** + *
+       * Start WAL sequence of this mutation.
+       * 
+ * + * uint64 sequence = 2; + * @return The sequence. + */ + @java.lang.Override + public long getSequence() { + return sequence_; + } + /** + *
+       * Start WAL sequence of this mutation.
+       * 
+ * + * uint64 sequence = 2; + * @param value The sequence to set. + * @return This builder for chaining. + */ + public Builder setSequence(long value) { + + sequence_ = value; + onChanged(); + return this; + } + /** + *
+       * Start WAL sequence of this mutation.
+       * 
+ * + * uint64 sequence = 2; + * @return This builder for chaining. + */ + public Builder clearSequence() { + + sequence_ = 0L; + onChanged(); + return this; + } + + private io.greptime.v1.RowData.Rows rows_; + private com.google.protobuf.SingleFieldBuilderV3< + io.greptime.v1.RowData.Rows, io.greptime.v1.RowData.Rows.Builder, io.greptime.v1.RowData.RowsOrBuilder> rowsBuilder_; + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + * @return Whether the rows field is set. + */ + public boolean hasRows() { + return rowsBuilder_ != null || rows_ != null; + } + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + * @return The rows. + */ + public io.greptime.v1.RowData.Rows getRows() { + if (rowsBuilder_ == null) { + return rows_ == null ? io.greptime.v1.RowData.Rows.getDefaultInstance() : rows_; + } else { + return rowsBuilder_.getMessage(); + } + } + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + */ + public Builder setRows(io.greptime.v1.RowData.Rows value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + rows_ = value; + onChanged(); + } else { + rowsBuilder_.setMessage(value); + } + + return this; + } + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + */ + public Builder setRows( + io.greptime.v1.RowData.Rows.Builder builderForValue) { + if (rowsBuilder_ == null) { + rows_ = builderForValue.build(); + onChanged(); + } else { + rowsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + */ + public Builder mergeRows(io.greptime.v1.RowData.Rows value) { + if (rowsBuilder_ == null) { + if (rows_ != null) { + rows_ = + io.greptime.v1.RowData.Rows.newBuilder(rows_).mergeFrom(value).buildPartial(); + } else { + rows_ = value; + } + onChanged(); + } else { + rowsBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + */ + public Builder clearRows() { + if (rowsBuilder_ == null) { + rows_ = null; + onChanged(); + } else { + rows_ = null; + rowsBuilder_ = null; + } + + return this; + } + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + */ + public io.greptime.v1.RowData.Rows.Builder getRowsBuilder() { + + onChanged(); + return getRowsFieldBuilder().getBuilder(); + } + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + */ + public io.greptime.v1.RowData.RowsOrBuilder getRowsOrBuilder() { + if (rowsBuilder_ != null) { + return rowsBuilder_.getMessageOrBuilder(); + } else { + return rows_ == null ? + io.greptime.v1.RowData.Rows.getDefaultInstance() : rows_; + } + } + /** + *
+       * Row updates to write to the WAL.
+       * 
+ * + * .greptime.v1.Rows rows = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.greptime.v1.RowData.Rows, io.greptime.v1.RowData.Rows.Builder, io.greptime.v1.RowData.RowsOrBuilder> + getRowsFieldBuilder() { + if (rowsBuilder_ == null) { + rowsBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.greptime.v1.RowData.Rows, io.greptime.v1.RowData.Rows.Builder, io.greptime.v1.RowData.RowsOrBuilder>( + getRows(), + getParentForChildren(), + isClean()); + rows_ = null; + } + return rowsBuilder_; + } + @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.Mutation) + } + + // @@protoc_insertion_point(class_scope:greptime.v1.Mutation) + private static final greptime.v1.Wal.Mutation DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new greptime.v1.Wal.Mutation(); + } + + public static greptime.v1.Wal.Mutation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Mutation parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Mutation(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.Wal.Mutation getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface WalEntryOrBuilder extends + // @@protoc_insertion_point(interface_extends:greptime.v1.WalEntry) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + java.util.List + getMutationsList(); + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + greptime.v1.Wal.Mutation getMutations(int index); + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + int getMutationsCount(); + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + java.util.List + getMutationsOrBuilderList(); + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + greptime.v1.Wal.MutationOrBuilder getMutationsOrBuilder( + int index); + } + /** + *
+   * A WAL entry contains a list of mutations for a region to write.
+   * 
+ * + * Protobuf type {@code greptime.v1.WalEntry} + */ + public static final class WalEntry extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:greptime.v1.WalEntry) + WalEntryOrBuilder { + private static final long serialVersionUID = 0L; + // Use WalEntry.newBuilder() to construct. + private WalEntry(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private WalEntry() { + mutations_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new WalEntry(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private WalEntry( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + 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 10: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + mutations_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + mutations_.add( + input.readMessage(greptime.v1.Wal.Mutation.parser(), extensionRegistry)); + 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 { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + mutations_ = java.util.Collections.unmodifiableList(mutations_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return greptime.v1.Wal.internal_static_greptime_v1_WalEntry_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return greptime.v1.Wal.internal_static_greptime_v1_WalEntry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + greptime.v1.Wal.WalEntry.class, greptime.v1.Wal.WalEntry.Builder.class); + } + + public static final int MUTATIONS_FIELD_NUMBER = 1; + private java.util.List mutations_; + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + @java.lang.Override + public java.util.List getMutationsList() { + return mutations_; + } + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + @java.lang.Override + public java.util.List + getMutationsOrBuilderList() { + return mutations_; + } + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + @java.lang.Override + public int getMutationsCount() { + return mutations_.size(); + } + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + @java.lang.Override + public greptime.v1.Wal.Mutation getMutations(int index) { + return mutations_.get(index); + } + /** + *
+     * List of mutations for a region.
+     * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + @java.lang.Override + public greptime.v1.Wal.MutationOrBuilder getMutationsOrBuilder( + int index) { + return mutations_.get(index); + } + + 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 { + for (int i = 0; i < mutations_.size(); i++) { + output.writeMessage(1, mutations_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < mutations_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, mutations_.get(i)); + } + 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.Wal.WalEntry)) { + return super.equals(obj); + } + greptime.v1.Wal.WalEntry other = (greptime.v1.Wal.WalEntry) obj; + + if (!getMutationsList() + .equals(other.getMutationsList())) 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(); + if (getMutationsCount() > 0) { + hash = (37 * hash) + MUTATIONS_FIELD_NUMBER; + hash = (53 * hash) + getMutationsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static greptime.v1.Wal.WalEntry parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.Wal.WalEntry parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.Wal.WalEntry parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.Wal.WalEntry 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.Wal.WalEntry parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static greptime.v1.Wal.WalEntry parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static greptime.v1.Wal.WalEntry parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static greptime.v1.Wal.WalEntry 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.Wal.WalEntry parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static greptime.v1.Wal.WalEntry 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.Wal.WalEntry parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static greptime.v1.Wal.WalEntry 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.Wal.WalEntry 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; + } + /** + *
+     * A WAL entry contains a list of mutations for a region to write.
+     * 
+ * + * Protobuf type {@code greptime.v1.WalEntry} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:greptime.v1.WalEntry) + greptime.v1.Wal.WalEntryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return greptime.v1.Wal.internal_static_greptime_v1_WalEntry_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return greptime.v1.Wal.internal_static_greptime_v1_WalEntry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + greptime.v1.Wal.WalEntry.class, greptime.v1.Wal.WalEntry.Builder.class); + } + + // Construct using greptime.v1.Wal.WalEntry.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getMutationsFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (mutationsBuilder_ == null) { + mutations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + mutationsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return greptime.v1.Wal.internal_static_greptime_v1_WalEntry_descriptor; + } + + @java.lang.Override + public greptime.v1.Wal.WalEntry getDefaultInstanceForType() { + return greptime.v1.Wal.WalEntry.getDefaultInstance(); + } + + @java.lang.Override + public greptime.v1.Wal.WalEntry build() { + greptime.v1.Wal.WalEntry result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public greptime.v1.Wal.WalEntry buildPartial() { + greptime.v1.Wal.WalEntry result = new greptime.v1.Wal.WalEntry(this); + int from_bitField0_ = bitField0_; + if (mutationsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + mutations_ = java.util.Collections.unmodifiableList(mutations_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.mutations_ = mutations_; + } else { + result.mutations_ = mutationsBuilder_.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.Wal.WalEntry) { + return mergeFrom((greptime.v1.Wal.WalEntry)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(greptime.v1.Wal.WalEntry other) { + if (other == greptime.v1.Wal.WalEntry.getDefaultInstance()) return this; + if (mutationsBuilder_ == null) { + if (!other.mutations_.isEmpty()) { + if (mutations_.isEmpty()) { + mutations_ = other.mutations_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureMutationsIsMutable(); + mutations_.addAll(other.mutations_); + } + onChanged(); + } + } else { + if (!other.mutations_.isEmpty()) { + if (mutationsBuilder_.isEmpty()) { + mutationsBuilder_.dispose(); + mutationsBuilder_ = null; + mutations_ = other.mutations_; + bitField0_ = (bitField0_ & ~0x00000001); + mutationsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getMutationsFieldBuilder() : null; + } else { + mutationsBuilder_.addAllMessages(other.mutations_); + } + } + } + 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.Wal.WalEntry parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (greptime.v1.Wal.WalEntry) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List mutations_ = + java.util.Collections.emptyList(); + private void ensureMutationsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + mutations_ = new java.util.ArrayList(mutations_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + greptime.v1.Wal.Mutation, greptime.v1.Wal.Mutation.Builder, greptime.v1.Wal.MutationOrBuilder> mutationsBuilder_; + + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public java.util.List getMutationsList() { + if (mutationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(mutations_); + } else { + return mutationsBuilder_.getMessageList(); + } + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public int getMutationsCount() { + if (mutationsBuilder_ == null) { + return mutations_.size(); + } else { + return mutationsBuilder_.getCount(); + } + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public greptime.v1.Wal.Mutation getMutations(int index) { + if (mutationsBuilder_ == null) { + return mutations_.get(index); + } else { + return mutationsBuilder_.getMessage(index); + } + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder setMutations( + int index, greptime.v1.Wal.Mutation value) { + if (mutationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMutationsIsMutable(); + mutations_.set(index, value); + onChanged(); + } else { + mutationsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder setMutations( + int index, greptime.v1.Wal.Mutation.Builder builderForValue) { + if (mutationsBuilder_ == null) { + ensureMutationsIsMutable(); + mutations_.set(index, builderForValue.build()); + onChanged(); + } else { + mutationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder addMutations(greptime.v1.Wal.Mutation value) { + if (mutationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMutationsIsMutable(); + mutations_.add(value); + onChanged(); + } else { + mutationsBuilder_.addMessage(value); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder addMutations( + int index, greptime.v1.Wal.Mutation value) { + if (mutationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMutationsIsMutable(); + mutations_.add(index, value); + onChanged(); + } else { + mutationsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder addMutations( + greptime.v1.Wal.Mutation.Builder builderForValue) { + if (mutationsBuilder_ == null) { + ensureMutationsIsMutable(); + mutations_.add(builderForValue.build()); + onChanged(); + } else { + mutationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder addMutations( + int index, greptime.v1.Wal.Mutation.Builder builderForValue) { + if (mutationsBuilder_ == null) { + ensureMutationsIsMutable(); + mutations_.add(index, builderForValue.build()); + onChanged(); + } else { + mutationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder addAllMutations( + java.lang.Iterable values) { + if (mutationsBuilder_ == null) { + ensureMutationsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, mutations_); + onChanged(); + } else { + mutationsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder clearMutations() { + if (mutationsBuilder_ == null) { + mutations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + mutationsBuilder_.clear(); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public Builder removeMutations(int index) { + if (mutationsBuilder_ == null) { + ensureMutationsIsMutable(); + mutations_.remove(index); + onChanged(); + } else { + mutationsBuilder_.remove(index); + } + return this; + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public greptime.v1.Wal.Mutation.Builder getMutationsBuilder( + int index) { + return getMutationsFieldBuilder().getBuilder(index); + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public greptime.v1.Wal.MutationOrBuilder getMutationsOrBuilder( + int index) { + if (mutationsBuilder_ == null) { + return mutations_.get(index); } else { + return mutationsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public java.util.List + getMutationsOrBuilderList() { + if (mutationsBuilder_ != null) { + return mutationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(mutations_); + } + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public greptime.v1.Wal.Mutation.Builder addMutationsBuilder() { + return getMutationsFieldBuilder().addBuilder( + greptime.v1.Wal.Mutation.getDefaultInstance()); + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public greptime.v1.Wal.Mutation.Builder addMutationsBuilder( + int index) { + return getMutationsFieldBuilder().addBuilder( + index, greptime.v1.Wal.Mutation.getDefaultInstance()); + } + /** + *
+       * List of mutations for a region.
+       * 
+ * + * repeated .greptime.v1.Mutation mutations = 1; + */ + public java.util.List + getMutationsBuilderList() { + return getMutationsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + greptime.v1.Wal.Mutation, greptime.v1.Wal.Mutation.Builder, greptime.v1.Wal.MutationOrBuilder> + getMutationsFieldBuilder() { + if (mutationsBuilder_ == null) { + mutationsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + greptime.v1.Wal.Mutation, greptime.v1.Wal.Mutation.Builder, greptime.v1.Wal.MutationOrBuilder>( + mutations_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + mutations_ = null; + } + return mutationsBuilder_; + } + @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.WalEntry) + } + + // @@protoc_insertion_point(class_scope:greptime.v1.WalEntry) + private static final greptime.v1.Wal.WalEntry DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new greptime.v1.Wal.WalEntry(); + } + + public static greptime.v1.Wal.WalEntry getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public WalEntry parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new WalEntry(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.Wal.WalEntry getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_greptime_v1_Mutation_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_greptime_v1_Mutation_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_greptime_v1_WalEntry_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_greptime_v1_WalEntry_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\025greptime/v1/wal.proto\022\013greptime.v1\032\025gr" + + "eptime/v1/row.proto\"c\n\010Mutation\022$\n\007op_ty" + + "pe\030\001 \001(\0162\023.greptime.v1.OpType\022\020\n\010sequenc" + + "e\030\002 \001(\004\022\037\n\004rows\030\003 \001(\0132\021.greptime.v1.Rows" + + "\"4\n\010WalEntry\022(\n\tmutations\030\001 \003(\0132\025.grepti" + + "me.v1.Mutation*\035\n\006OpType\022\n\n\006DELETE\020\000\022\007\n\003" + + "PUT\020\001B7Z5github.com/GreptimeTeam/greptim" + + "e-proto/go/greptime/v1b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + io.greptime.v1.RowData.getDescriptor(), + }); + internal_static_greptime_v1_Mutation_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_greptime_v1_Mutation_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_greptime_v1_Mutation_descriptor, + new java.lang.String[] { "OpType", "Sequence", "Rows", }); + internal_static_greptime_v1_WalEntry_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_greptime_v1_WalEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_greptime_v1_WalEntry_descriptor, + new java.lang.String[] { "Mutations", }); + io.greptime.v1.RowData.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto/greptime/v1/wal.proto b/proto/greptime/v1/wal.proto new file mode 100644 index 0000000..1ca9d39 --- /dev/null +++ b/proto/greptime/v1/wal.proto @@ -0,0 +1,45 @@ +// 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; + +option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1"; + +import "greptime/v1/row.proto"; + +// Type of operation to rows. +enum OpType { + // Delete rows. + DELETE = 0; + // Put rows. + PUT = 1; +} + +// Mutation contains updates to a set of rows. +message Mutation { + // Type of this mutation. + OpType op_type = 1; + // Start WAL sequence of this mutation. + uint64 sequence = 2; + // Row updates to write to the WAL. + Rows rows = 3; +} + +// A WAL entry contains a list of mutations for a region to write. +message WalEntry { + // List of mutations for a region. + repeated Mutation mutations = 1; +}