diff options
author | hor911 <hor911@ydb.tech> | 2023-02-09 12:40:11 +0300 |
---|---|---|
committer | hor911 <hor911@ydb.tech> | 2023-02-09 12:40:11 +0300 |
commit | 24689527cd888aa8a640ecb5077e656b3520d373 (patch) | |
tree | a613ff4cd9567b7113e8376a17f8b85897a42790 /library/cpp/unified_agent_client/proto | |
parent | 8642d3642932f03663ba7d2d9670707c192207fd (diff) | |
download | ydb-24689527cd888aa8a640ecb5077e656b3520d373.tar.gz |
Log backend move
Diffstat (limited to 'library/cpp/unified_agent_client/proto')
5 files changed, 253 insertions, 0 deletions
diff --git a/library/cpp/unified_agent_client/proto/CMakeLists.darwin.txt b/library/cpp/unified_agent_client/proto/CMakeLists.darwin.txt new file mode 100644 index 0000000000..9642a192c4 --- /dev/null +++ b/library/cpp/unified_agent_client/proto/CMakeLists.darwin.txt @@ -0,0 +1,45 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(cpp-unified_agent_client-proto) +set_property(TARGET cpp-unified_agent_client-proto PROPERTY + PROTOC_EXTRA_OUTS .grpc.pb.cc .grpc.pb.h +) +target_link_libraries(cpp-unified_agent_client-proto PUBLIC + contrib-libs-cxxsupp + yutil + contrib-libs-grpc + tools-enum_parser-enum_serialization_runtime + contrib-libs-protobuf +) +target_proto_messages(cpp-unified_agent_client-proto PRIVATE + ${CMAKE_SOURCE_DIR}/library/cpp/unified_agent_client/proto/unified_agent.proto +) +generate_enum_serilization(cpp-unified_agent_client-proto + ${CMAKE_BINARY_DIR}/library/cpp/unified_agent_client/proto/unified_agent.pb.h + INCLUDE_HEADERS + library/cpp/unified_agent_client/proto/unified_agent.pb.h +) +target_proto_addincls(cpp-unified_agent_client-proto + ./ + ${CMAKE_SOURCE_DIR}/ + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src +) +target_proto_outs(cpp-unified_agent_client-proto + --cpp_out=${CMAKE_BINARY_DIR}/ + --cpp_styleguide_out=${CMAKE_BINARY_DIR}/ +) +target_proto_plugin(cpp-unified_agent_client-proto + grpc_cpp + grpc_cpp +) diff --git a/library/cpp/unified_agent_client/proto/CMakeLists.linux-aarch64.txt b/library/cpp/unified_agent_client/proto/CMakeLists.linux-aarch64.txt new file mode 100644 index 0000000000..da20d2e479 --- /dev/null +++ b/library/cpp/unified_agent_client/proto/CMakeLists.linux-aarch64.txt @@ -0,0 +1,46 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(cpp-unified_agent_client-proto) +set_property(TARGET cpp-unified_agent_client-proto PROPERTY + PROTOC_EXTRA_OUTS .grpc.pb.cc .grpc.pb.h +) +target_link_libraries(cpp-unified_agent_client-proto PUBLIC + contrib-libs-linux-headers + contrib-libs-cxxsupp + yutil + contrib-libs-grpc + tools-enum_parser-enum_serialization_runtime + contrib-libs-protobuf +) +target_proto_messages(cpp-unified_agent_client-proto PRIVATE + ${CMAKE_SOURCE_DIR}/library/cpp/unified_agent_client/proto/unified_agent.proto +) +generate_enum_serilization(cpp-unified_agent_client-proto + ${CMAKE_BINARY_DIR}/library/cpp/unified_agent_client/proto/unified_agent.pb.h + INCLUDE_HEADERS + library/cpp/unified_agent_client/proto/unified_agent.pb.h +) +target_proto_addincls(cpp-unified_agent_client-proto + ./ + ${CMAKE_SOURCE_DIR}/ + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src +) +target_proto_outs(cpp-unified_agent_client-proto + --cpp_out=${CMAKE_BINARY_DIR}/ + --cpp_styleguide_out=${CMAKE_BINARY_DIR}/ +) +target_proto_plugin(cpp-unified_agent_client-proto + grpc_cpp + grpc_cpp +) diff --git a/library/cpp/unified_agent_client/proto/CMakeLists.linux.txt b/library/cpp/unified_agent_client/proto/CMakeLists.linux.txt new file mode 100644 index 0000000000..da20d2e479 --- /dev/null +++ b/library/cpp/unified_agent_client/proto/CMakeLists.linux.txt @@ -0,0 +1,46 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(cpp-unified_agent_client-proto) +set_property(TARGET cpp-unified_agent_client-proto PROPERTY + PROTOC_EXTRA_OUTS .grpc.pb.cc .grpc.pb.h +) +target_link_libraries(cpp-unified_agent_client-proto PUBLIC + contrib-libs-linux-headers + contrib-libs-cxxsupp + yutil + contrib-libs-grpc + tools-enum_parser-enum_serialization_runtime + contrib-libs-protobuf +) +target_proto_messages(cpp-unified_agent_client-proto PRIVATE + ${CMAKE_SOURCE_DIR}/library/cpp/unified_agent_client/proto/unified_agent.proto +) +generate_enum_serilization(cpp-unified_agent_client-proto + ${CMAKE_BINARY_DIR}/library/cpp/unified_agent_client/proto/unified_agent.pb.h + INCLUDE_HEADERS + library/cpp/unified_agent_client/proto/unified_agent.pb.h +) +target_proto_addincls(cpp-unified_agent_client-proto + ./ + ${CMAKE_SOURCE_DIR}/ + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src +) +target_proto_outs(cpp-unified_agent_client-proto + --cpp_out=${CMAKE_BINARY_DIR}/ + --cpp_styleguide_out=${CMAKE_BINARY_DIR}/ +) +target_proto_plugin(cpp-unified_agent_client-proto + grpc_cpp + grpc_cpp +) diff --git a/library/cpp/unified_agent_client/proto/CMakeLists.txt b/library/cpp/unified_agent_client/proto/CMakeLists.txt new file mode 100644 index 0000000000..5bb4faffb4 --- /dev/null +++ b/library/cpp/unified_agent_client/proto/CMakeLists.txt @@ -0,0 +1,15 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND UNIX AND NOT APPLE AND NOT ANDROID) + include(CMakeLists.linux-aarch64.txt) +elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + include(CMakeLists.darwin.txt) +elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE AND NOT ANDROID) + include(CMakeLists.linux.txt) +endif() diff --git a/library/cpp/unified_agent_client/proto/unified_agent.proto b/library/cpp/unified_agent_client/proto/unified_agent.proto new file mode 100644 index 0000000000..68efe35747 --- /dev/null +++ b/library/cpp/unified_agent_client/proto/unified_agent.proto @@ -0,0 +1,101 @@ +syntax = "proto3"; +import "google/protobuf/descriptor.proto"; + +package NUnifiedAgentProto; + +option java_package = "com.yandex.unified_agent"; +option go_package = "a.yandex-team.ru/library/cpp/unified_agent_client/proto;unifiedagent"; + +extend google.protobuf.FileOptions { + bool GenerateYaStyle = 66777; +} + +message Request { + message SessionMetaItem { + string name = 1; + string value = 2; + } + + message Initialize { + // Session_id provided by server, use it in case of reconnects. + string session_id = 1; + + // Session metadata + repeated SessionMetaItem meta = 2; + + string shared_secret_key = 3; + } + + message MessageMetaItem { + // Arbitrary key-value pairs. Can be used by agent filters to modify/filter messages + // or to route them to target outputs. + + // Meta items of all messages should be grouped by meta key, it's expected in the 'key' field. + // Meta values should be passed in the 'value' sequence, it corresponds to the payload + // sequence from DataBatch. If some messages don't have a meta with this key, the range of such messages + // can be passed via skip_start/skip_length sequences. + // For example, [{m:v1}, {}, {}, {m: v2}, {}, {m: v3}, {}, {}] can be represented as follows: + // key: 'm' + // value: ['v1', 'v2', 'v3'] + // skip_start: [1, 4] + // skip_length: [2, 1] + + string key = 1; + repeated string value = 2; + repeated uint32 skip_start = 3; + repeated uint32 skip_length = 4; + } + + message DataBatch { + repeated uint64 seq_no = 1; + repeated uint64 timestamp = 2; //microseconds + repeated bytes payload = 100; + repeated MessageMetaItem meta = 101; + } + + oneof request { + Initialize initialize = 1; + DataBatch data_batch = 2; + } +} + +message Response { + message Initialized { + // Session identifier for log and deduplication purposes. + string session_id = 1; + + // Application can skip all formed messages by seq_no upto last_seq_no - they are consumed by server. + uint64 last_seq_no = 2; + } + + message Ack { + uint64 seq_no = 1; + } + + oneof response { + Initialized initialized = 1; + Ack ack = 2; + } +} + +service UnifiedAgentService { + rpc Session(stream Request) returns (stream Response); +} + + +// dataflow: +// Request.initialize -> UnifiedAgent; +// specify session_id when this is a retry. Сlient can already have sesison_id from previous init response, +// or it can use some pregenerated sessionId for each session. +// Response.initializeded -> client; +// Request.entry -> UnifiedAgent; +// .... +// Response.ack -> client; +// when this record is consumed by UnifiedAgent with choosen garanties UnifiedAgent will send ack to client; +// client can forget about this log record now +// +// grpc finish session -> client; +// something went wrong; client must reconnect and retry all not acknowleged records +// +// Exactly once retries - when reconnect, client must provide previous session_id and same seq_no`s +// for records - only in this case UnifiedAgent can dedup. |