Skip to main content

Crate ydb

Crate ydb 

Source
Expand description

YDB SDK - a client for YDB.

§Example


 // create driver
 let client = ClientBuilder::new_from_connection_string("grpc://localhost:2136/local")?
    .with_credentials(AccessTokenCredentials::from("asd"))
    .client()?;

 // wait until driver background initialization finish
 client.wait().await?;

 // read query result via Query API
 let mut row = client
    .query_client()
    .query_row("SELECT 1 + 1 AS sum")
    .await?;
 let sum: i32 = row.remove_field_by_name("sum")?.try_into()?;

 // it will print "sum: 2"
 println!("sum: {}", sum);

§More examples

Examples

Modules§

traces

Macros§

closure
Constructs a DynAsyncFnMut from a closure with explicit context capturing. Think of it as an async_trait macro, but for closures instead of traits.
ydb_params
sugar for manual construct query params
ydb_struct
Sugar for manual construct structs Example:

Structs§

AccessTokenCredentials
Credentials with static token without renewing
AcquireOptions
AcquireOptionsBuilder
Builder for AcquireOptions.
AlterConsumer
AlterConsumerBuilder
Builder for AlterConsumer.
AlterTableRequest
AlterTable RPC request.
AlterTopicOptions
AlterTopicOptionsBuilder
Builder for AlterTopicOptions.
AnonymousCredentials
Bytes
CallBuilder
Client
YDB client.
ClientBuilder
ClientOneShot
One-shot [QueryClient] calls (exec, query_row, …).
Codec
ColumnDescription
Description of a table column
CommandLineCredentials
Get from stdout of command
Consumer
ConsumerBuilder
Builder for Consumer.
ConsumerDescription
CoordinationClient
CoordinationSession
CopyTableItem
CreateTableRequest
CreateTable RPC request (go-sdk: Session.CreateTable).
CreateTopicOptions
CreateTopicOptionsBuilder
Builder for CreateTopicOptions.
DescribeConsumerOptions
DescribeConsumerOptionsBuilder
Builder for DescribeConsumerOptions.
DescribeOptions
DescribeOptionsBuilder
Builder for DescribeOptions.
DescribeTopicOptions
DescribeTopicOptionsBuilder
Builder for DescribeTopicOptions.
DiscoveryState
Current discovery state
DropTableRequest
DropTable RPC request.
DynAsyncFnMut
Type-erased asynchronous function.
ExecuteScriptBuilder
ExecuteScriptOperation
Long-running script operation started by [QueryClient::execute_script].
FetchScriptResult
One page of script results from [QueryClient::fetch_script_results].
FetchScriptResultsBuilder
FromEnvCredentials
GCEMetadata
Get instance service account token from GCE instance
GrpcOptions
Common options for gRPC connections.
IndexDescription
Interactive
Calls inside [Transaction] (retry_tx callback).
Lease
LimitedRetryBudget
Fixed maximum number of retry attempts per second (token bucket).
ListOperationsRequest
Filter and pagination parameters for [OperationClient::list_operations].
ListOperationsResult
Page of operations from [OperationClient::list_operations].
MetadataUrlCredentials
Get token of service account of instance
MutWithLifetime
Marker type that represents mutable reference type parametrized by its lifetime.
NamedPolicyDescription
Named policy preset from [TableClient::describe_table_options].
NodeConfig
NodeConfigBuilder
Builder for NodeConfig.
NodeDescription
OneRow
OperationClient
OperationInfo
Long-running operation snapshot returned by Operation Service.
OperationKind
Well-known kind values for ListOperationsRequest.
OptionalRow
OwnedWithLifetime
Marker type that represents lifetime-independent type.
PartitionInfo
PartitionInfo contains info about partition.
PartitionLocation
PartitionSessionKey
PartitionStats
PartitioningSettings
PercentOfRpsRetryBudget
Retry budget as a percentage of the driver’s request rate (operations per second).
PercentRetryBudget
Probabilistic retry budget (aligned with ydb-go-sdk budget.Percent).
Query
Query object
QueryClient
QueryStats
QueryStream
Streaming query result. When obtained with [CallBuilder::with_commit(true)] inside a transaction, you must drain all result sets and call Self::close; dropping early cancels the gRPC stream and does not commit.
ReadRowsRequest
ReadRows RPC request (go-sdk: table.Client.ReadRows + options.ReadRowsOption).
RefWithLifetime
Marker type that represents reference type parametrized by its lifetime.
RenameTableItem
ResultSet
ResultSetRowsIter
RetryMetrics
Sliding-window counters used by PercentOfRpsRetryBudget.
RetryTxBuilder
Builder for QueryClient::retry_tx.
Row
SchemeClient
SchemeEntry
SchemePermissions
ServiceAccountCredentials
Get service account credentials instance service account key should be:
SessionOptions
SessionOptionsBuilder
Builder for SessionOptions.
SessionPoolSettings
Settings for the driver session pool (CreateSession + AttachSession).
SessionPoolStats
Snapshot of session pool counters (aligned with go-sdk pool.Stats).
SignedInterval
StaticCredentials
StaticDiscovery
Always discovery once static node
TableClient
Client for YDB Table service: DDL via RPC (CreateTable, …), sessionless data plane (ReadRows, BulkUpsert), describe.
TableColumn
Column specification for CreateTableRequest and AlterTableRequest.
TableDescription
TableOptionsDescription
Cluster-wide table option presets (go-sdk: options.TableOptionsDescription).
TokenInfo
TopicClient
TopicDescription
TopicDescription contains info about topic.
TopicReader
TopicReaderBatch
TopicReaderCommitMarker
TopicReaderMessage
TopicReaderOptions
TopicReaderOptionsBuilder
Use builder syntax to set the inputs and finish with build().
TopicReaderTx
TopicSelector
TopicSelectorBuilder
Use builder syntax to set the inputs and finish with build().
TopicSelectors
TopicStats
TopicWriter
TopicWriter is currently in development. It is mostly usable, but has some unimplemented features.
TopicWriterMessage
TopicWriterMessageBuilder
Use builder syntax to set the inputs and finish with build().
TopicWriterOptions
TopicWriterOptionsBuilder
Use builder syntax to set the inputs and finish with build().
TopicWriterTx
A topic writer bound to an active YDB transaction.
TopicWriterTxOptions
TopicWriterTxOptionsBuilder
Builder for TopicWriterTxOptions.
Transaction
TransactionOptions
UnknownTypeDescription
Error description of an unknown/unsupported column type
ValueList
ValueOptional
ValueStruct
WatchOptions
WatchOptionsBuilder
Builder for WatchOptions.
YdbDecimal
A decimal value with explicit YQL type parameters (precision and scale).
YdbIssue
Describe issue from server
YdbStatusError
Describe operation status from server

Enums§

ConsistencyMode
ExecCall
IndexStatus
IndexType
MeteringMode
OneResultSet
PartitioningStrategy
RateLimiterCountersMode
RetryBudgetError
Error returned when RetryBudget::acquire cannot grant a retry slot.
SchemeEntryType
Sign
StoreType
Streamed
TxMode
Query Service transaction isolation mode.
Value
Internal represent database value for send to or received from database.
WatchMode
YdbError
Error which can be returned from the crate.
YdbIssueSeverity
Severity of issue
YdbOrCustomerError
Error for wrap user errors while return it from callback

Traits§

AsyncFnMut
AsyncFnMut equivalent with type-erased future that can be implemented for different types and allows to avoid problems with lifetime binders and asynchronous closures and unstable parts of AsyncFn* traits.
CompressionDecoder
Decodes topic message payloads for one codec.
CompressionEncoder
Encodes topic message payloads for one codec.
Credentials
Discovery
Discovery YDB endpoints
Executor
FromYdbRow
Row-to-struct mapping (the sqlx FromRow analogue).
HasGrpcOptions
Helper trait for types that has configurable gRPC options.
QueryExecutor
Query execution entry points for QueryClient and Transaction.
RetryBudget
Limits how many client-side retries may proceed across all SDK retriers on one driver.
RetryTxAttempt
Auxiliary trait for closures that can be passed into QueryClient::retry_tx.
Waiter
WithLifetime
The trait that allows to express lifetime-parametrized types as plain types.

Type Aliases§

CommandLineYcTokenDeprecated
ExecBuilder
OptionalRowBuilder
QueryRowBuilder
QueryStreamBuilder
ResultSetBuilder
StaticCredentialsAuthDeprecated
StaticTokenDeprecated
YandexMetadataDeprecated
YdbResult
T result or YdbError as Error
YdbResultWithCustomerErr
T result or YdbOrCustomerError as Error