Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/import_generation.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
32
33
2 changes: 1 addition & 1 deletion .github/last_commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8d2f0915190e981b53b115ea4b755e8dc0a9df5e
303019a794dd98ca44a77440af08bbeecf56d727
2 changes: 1 addition & 1 deletion include/ydb-cpp-sdk/client/export/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct TExportToS3Settings : public TOperationRequestSettings<TExportToS3Setting
FLUENT_SETTING_OPTIONAL(std::string, Compression);
FLUENT_SETTING_OPTIONAL(std::string, SourcePath);
FLUENT_SETTING_OPTIONAL(std::string, DestinationPrefix);
FLUENT_SETTING_DEFAULT(bool, MaterializeIndexes, false);
FLUENT_SETTING_DEFAULT(bool, IncludeIndexData, false);
FLUENT_SETTING_VECTOR(std::string, ExcludeRegexp);

TSelf& SymmetricEncryption(const std::string& algorithm, const std::string& key) {
Expand Down
4 changes: 2 additions & 2 deletions include/ydb-cpp-sdk/client/import/import.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum class EImportProgress {
Unknown = std::numeric_limits<int>::max(),
};

enum class EIndexFillingMode {
enum class EIndexPopulationMode {
Build = 0,
Import = 1,
Auto = 2,
Expand Down Expand Up @@ -71,7 +71,7 @@ struct TImportFromS3Settings : public TOperationRequestSettings<TImportFromS3Set
FLUENT_SETTING_OPTIONAL(std::string, SourcePrefix);
FLUENT_SETTING_OPTIONAL(std::string, DestinationPath);
FLUENT_SETTING_OPTIONAL(std::string, SymmetricKey);
FLUENT_SETTING_DEFAULT(EIndexFillingMode, IndexFillingMode, EIndexFillingMode::Build);
FLUENT_SETTING_DEFAULT(EIndexPopulationMode, IndexPopulationMode, EIndexPopulationMode::Build);
FLUENT_SETTING_VECTOR(std::string, ExcludeRegexp);
};

Expand Down
4 changes: 2 additions & 2 deletions include/ydb-cpp-sdk/client/proto/accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class TProtoAccessor {
static NExport::TExportToS3Settings::EStorageClass FromProto(Ydb::Export::ExportToS3Settings::StorageClass value);
static NExport::EExportProgress FromProto(Ydb::Export::ExportProgress::Progress value);
static NImport::EImportProgress FromProto(Ydb::Import::ImportProgress::Progress value);
static Ydb::Import::ImportFromS3Settings::IndexFillingMode GetProto(NImport::EIndexFillingMode value);
static NImport::EIndexFillingMode FromProto(Ydb::Import::ImportFromS3Settings::IndexFillingMode value);
static Ydb::Import::ImportFromS3Settings::IndexPopulationMode GetProto(NImport::EIndexPopulationMode value);
static NImport::EIndexPopulationMode FromProto(Ydb::Import::ImportFromS3Settings::IndexPopulationMode value);
};

} // namespace NYdb
9 changes: 9 additions & 0 deletions include/ydb-cpp-sdk/client/query/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ namespace NYdb::inline V3 {
template <typename TClient, typename TStatusType>
class TRetryContext;
} // namespace NRetry::Sync
namespace NRetry {
template <typename TClient>
class TRetryDeadlineHelper;
} // namespace NRetry
}

namespace NYdb::inline V3::NQuery {
Expand Down Expand Up @@ -129,9 +133,12 @@ class TSession {
friend class TQueryClient;
friend class TTransaction;
friend class TExecuteQueryIterator;
friend class NRetry::TRetryDeadlineHelper<TQueryClient>;
public:
const std::string& GetId() const;

const std::optional<TDeadline>& GetPropagatedDeadline() const;

TAsyncExecuteQueryResult ExecuteQuery(const std::string& query, const TTxControl& txControl,
const TExecuteQuerySettings& settings = TExecuteQuerySettings());

Expand All @@ -153,6 +160,8 @@ class TSession {
TSession(std::shared_ptr<TQueryClient::TImpl> client); // Create broken session
TSession(std::shared_ptr<TQueryClient::TImpl> client, TSession::TImpl* sessionImpl);

void SetPropagatedDeadline(const TDeadline& deadline);

std::shared_ptr<TQueryClient::TImpl> Client_;
std::shared_ptr<TSession::TImpl> SessionImpl_;
};
Expand Down
10 changes: 10 additions & 0 deletions include/ydb-cpp-sdk/client/table/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ template <typename TClient, typename TStatusType>
class TRetryContext;
} // namespace NRetry::Sync

namespace NRetry {
template <typename TClient>
class TRetryDeadlineHelper;
} // namespace NRetry

namespace NScheme {
struct TPermissions;
} // namespace NScheme
Expand Down Expand Up @@ -1857,6 +1862,7 @@ class TSession {
friend class TDataQuery;
friend class TTransaction;
friend class TSessionPool;
friend class NRetry::TRetryDeadlineHelper<TTableClient>;

public:
//! The following methods perform corresponding calls.
Expand Down Expand Up @@ -1931,11 +1937,15 @@ class TSession {
//! Returns session id
const std::string& GetId() const;

const std::optional<TDeadline>& GetPropagatedDeadline() const;

class TImpl;
private:
TSession(std::shared_ptr<TTableClient::TImpl> client, const std::string& sessionId, const std::string& endpointId, bool isOwnedBySessionPool);
TSession(std::shared_ptr<TTableClient::TImpl> client, std::shared_ptr<TSession::TImpl> SessionImpl_);

void SetPropagatedDeadline(const TDeadline& deadline);

std::shared_ptr<TTableClient::TImpl> Client_;
std::shared_ptr<TSession::TImpl> SessionImpl_;
};
Expand Down
11 changes: 8 additions & 3 deletions include/ydb-cpp-sdk/client/types/request_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "fluent_settings_helpers.h"

#include <ydb-cpp-sdk/library/time/time.h>

#include <util/datetime/base.h>

#include <vector>
Expand All @@ -17,20 +19,23 @@ struct TRequestSettings {
using TSelf = TDerived;
using THeader = std::vector<std::pair<std::string, std::string>>;

FLUENT_SETTING_DEFAULT(TDuration, ClientTimeout, TDuration::Max());
FLUENT_SETTING_DEFAULT(TDeadline, Deadline, TDeadline::Max());

FLUENT_SETTING(std::string, TraceId);
FLUENT_SETTING(std::string, RequestType);
FLUENT_SETTING(THeader, Header);
FLUENT_SETTING_DEFAULT(TDuration, ClientTimeout, TDuration::Max());
FLUENT_SETTING(std::string, TraceParent);

TRequestSettings() = default;

template <typename T>
explicit TRequestSettings(const TRequestSettings<T>& other)
: TraceId_(other.TraceId_)
: ClientTimeout_(other.ClientTimeout_)
, Deadline_(other.Deadline_)
, TraceId_(other.TraceId_)
, RequestType_(other.RequestType_)
, Header_(other.Header_)
, ClientTimeout_(other.ClientTimeout_)
, TraceParent_(other.TraceParent_)
{}
};
Expand Down
File renamed without changes.
35 changes: 35 additions & 0 deletions src/api/grpc/ydb_keyvalue_v2.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
syntax = "proto3";

package Ydb.KeyValue.V2;

option java_package = "com.yandex.ydb.keyvalue.v2";
option java_outer_classname = "KeyValueGrpc";
option java_multiple_files = true;

import "src/api/protos/ydb_keyvalue.proto";

// KeyValue tablets provide a simple key-value storage in a low-overhead and easy-to-shoot-your-leg manner.
// To use KeyValue tablets in an efficient way one must be familiar with the design of both the KeyValue tablet
// and the Distributed Storage underneath it.

service KeyValueService {

// Acquire an exclusive lock for the partition.
rpc AcquireLock(KeyValue.AcquireLockRequest) returns (KeyValue.AcquireLockResult);

// Perform list of commands to modify the state of the partition as an atomic transaction.
rpc ExecuteTransaction(KeyValue.ExecuteTransactionRequest) returns (KeyValue.ExecuteTransactionResult);

// Read the value stored in the item with the key specified.
rpc Read(KeyValue.ReadRequest) returns (KeyValue.ReadResult);

// Read items with keys in the specified range.
rpc ReadRange(KeyValue.ReadRangeRequest) returns (KeyValue.ReadRangeResult);

// List keys and metadata of items with keys in the specified range.
rpc ListRange(KeyValue.ListRangeRequest) returns (KeyValue.ListRangeResult);

// Get storage channel status of the partition.
rpc GetStorageChannelStatus(KeyValue.GetStorageChannelStatusRequest) returns (KeyValue.GetStorageChannelStatusResult);

}
6 changes: 3 additions & 3 deletions src/api/protos/ydb_export.proto
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ message ExportToS3Settings {
// the resulting data will not be encrypted.
EncryptionSettings encryption_settings = 15;

// Materialization of index table data.
// Include index data or not.
// By default, only index metadata is uploaded and indexes are built during import — it saves space
// and reduces export time, but it can potentially increase the import time.
// Indexes can be materialized, then their data will be uploaded during export and downloaded during import.
bool materialize_indexes = 16;
// Index data can be uploaded and downloaded back during import.
bool include_index_data = 16;

// Patterns (PCRE) for paths excluded from export operation.
// - Patterns are matched against the object path relative to the export's source_path.
Expand Down
14 changes: 7 additions & 7 deletions src/api/protos/ydb_import.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ message ImportFromS3Settings {
string destination_path = 2;
}

enum IndexFillingMode {
enum IndexPopulationMode {
// If unspecified, use default - Build
INDEX_FILLING_MODE_UNSPECIFIED = 0;
INDEX_POPULATION_MODE_UNSPECIFIED = 0;
// Build index
INDEX_FILLING_MODE_BUILD = 1;
INDEX_POPULATION_MODE_BUILD = 1;
// Import materialized index
INDEX_FILLING_MODE_IMPORT = 2;
INDEX_POPULATION_MODE_IMPORT = 2;
// Try to import materialized index, build otherwise
INDEX_FILLING_MODE_AUTO = 3;
INDEX_POPULATION_MODE_AUTO = 3;
}

string endpoint = 1 [(required) = true];
Expand Down Expand Up @@ -112,9 +112,9 @@ message ImportFromS3Settings {
// the resulting data is considered not encrypted.
Ydb.Export.EncryptionSettings encryption_settings = 15;

// Index filling mode.
// Index population mode.
// If not specified, indexes will be built.
IndexFillingMode index_filling_mode = 16;
IndexPopulationMode index_population_mode = 16;

// Patterns (PCRE) for paths excluded from import operation.
// - Patterns are matched against the database object names stored in the backup listing.
Expand Down
26 changes: 26 additions & 0 deletions src/api/protos/ydb_keyvalue.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ option java_outer_classname = "KeyValueProtos";
option java_multiple_files = true;

import "src/api/protos/ydb_operation.proto";
import "src/api/protos/ydb_status_codes.proto";
import "src/api/protos/ydb_issue_message.proto";

//
// KeyValue API.
Expand Down Expand Up @@ -109,6 +111,10 @@ message AcquireLockResult {

// Contains 0 if the request was sent to the node of the partition, node ID of the partition otherwise.
uint32 node_id = 2;

// Response status, use in V2.
StatusIds.StatusCode status = 16;
repeated Ydb.Issue.IssueMessage issues = 17;
}

message ExecuteTransactionRequest {
Expand Down Expand Up @@ -234,6 +240,10 @@ message ExecuteTransactionResult {

// Contains 0 if the request was sent to the node of the partition, node ID of the partition otherwise.
uint32 node_id = 2;

// Response status, use in V2.
StatusIds.StatusCode status = 16;
repeated Ydb.Issue.IssueMessage issues = 17;
}

message ReadRequest {
Expand Down Expand Up @@ -290,6 +300,10 @@ message ReadResult {

// Contains 0 if the request was sent to the node of the partition, node ID of the partition otherwise.
uint32 node_id = 6;

// Response status, use in V2.
StatusIds.StatusCode status = 16;
repeated Ydb.Issue.IssueMessage issues = 17;
}

message ReadRangeRequest {
Expand Down Expand Up @@ -354,6 +368,10 @@ message ReadRangeResult {

// Contains 0 if the request was sent to the node of the partition, node ID of the partition otherwise.
uint32 node_id = 3;

// Response status, use in V2.
StatusIds.StatusCode status = 16;
repeated Ydb.Issue.IssueMessage issues = 17;
}

message ListRangeRequest {
Expand Down Expand Up @@ -407,6 +425,10 @@ message ListRangeResult {

// Contains 0 if the request was sent to the node of the partition, node ID of the partition otherwise.
uint32 node_id = 3;

// Response status, use in V2.
StatusIds.StatusCode status = 16;
repeated Ydb.Issue.IssueMessage issues = 17;
}

message GetStorageChannelStatusRequest {
Expand Down Expand Up @@ -435,6 +457,10 @@ message GetStorageChannelStatusResult {

// Contains 0 if the request was sent to the node of the partition, node ID of the partition otherwise.
uint32 node_id = 2;

// Response status, use in V2.
StatusIds.StatusCode status = 16;
repeated Ydb.Issue.IssueMessage issues = 17;
}

message CreateVolumeRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/client/common_client/impl/iface.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <src/library/time/time.h>
#include <ydb-cpp-sdk/library/time/time.h>

#include <functional>

Expand Down
4 changes: 2 additions & 2 deletions src/client/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ TExportToS3Response::TExportToS3Response(TStatus&& status, Ydb::Operations::Oper

Metadata_.Settings.Description(metadata.settings().description());
Metadata_.Settings.NumberOfRetries(metadata.settings().number_of_retries());
Metadata_.Settings.MaterializeIndexes(metadata.settings().materialize_indexes());
Metadata_.Settings.IncludeIndexData(metadata.settings().include_index_data());

if (!metadata.settings().compression().empty()) {
Metadata_.Settings.Compression(metadata.settings().compression());
Expand Down Expand Up @@ -252,7 +252,7 @@ TFuture<TExportToS3Response> TExportClient::ExportToS3(const TExportToS3Settings
}

request.mutable_settings()->set_disable_virtual_addressing(!settings.UseVirtualAddressing_);
request.mutable_settings()->set_materialize_indexes(settings.MaterializeIndexes_);
request.mutable_settings()->set_include_index_data(settings.IncludeIndexData_);

if (settings.EncryptionAlgorithm_.empty() != settings.SymmetricKey_.empty()) {
throw TContractViolation("Encryption algorithm and symmetric key must be set together");
Expand Down
10 changes: 10 additions & 0 deletions src/client/impl/internal/retry/retry.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <ydb-cpp-sdk/client/types/fluent_settings_helpers.h>
#include <ydb-cpp-sdk/client/types/status/status.h>

#include <ydb-cpp-sdk/library/time/time.h>

#include <library/cpp/threading/future/core/fwd.h>
#include <util/datetime/base.h>
#include <util/generic/ptr.h>
Expand Down Expand Up @@ -111,4 +113,12 @@ class TRetryContextBase : TNonCopyable {
}
};

template<typename TClient>
class TRetryDeadlineHelper {
public:
static void SetDeadline(TClient::TSession& session, const TDeadline& deadline) {
session.SetPropagatedDeadline(deadline);
}
};

} // namespace NYdb::NRetry
Loading
Loading