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
Modules§
Macros§
- closure
- Constructs a
DynAsyncFnMutfrom a closure with explicit context capturing. Think of it as anasync_traitmacro, but for closures instead of traits. - ydb_
params - sugar for manual construct query params
- ydb_
struct - Sugar for manual construct structs Example:
Structs§
- Access
Token Credentials - Credentials with static token without renewing
- Acquire
Options - Acquire
Options Builder - Builder for
AcquireOptions. - Alter
Consumer - Alter
Consumer Builder - Builder for
AlterConsumer. - Alter
Table Request - AlterTable RPC request.
- Alter
Topic Options - Alter
Topic Options Builder - Builder for
AlterTopicOptions. - Anonymous
Credentials - Bytes
- Call
Builder - Client
- YDB client.
- Client
Builder - Client
OneShot - One-shot [
QueryClient] calls (exec,query_row, …). - Codec
- Column
Description - Description of a table column
- Command
Line Credentials - Get from stdout of command
- Consumer
- Consumer
Builder - Builder for
Consumer. - Consumer
Description - Coordination
Client - Coordination
Session - Copy
Table Item - Create
Table Request - CreateTable RPC request (go-sdk:
Session.CreateTable). - Create
Topic Options - Create
Topic Options Builder - Builder for
CreateTopicOptions. - Describe
Consumer Options - Describe
Consumer Options Builder - Builder for
DescribeConsumerOptions. - Describe
Options - Describe
Options Builder - Builder for
DescribeOptions. - Describe
Topic Options - Describe
Topic Options Builder - Builder for
DescribeTopicOptions. - Discovery
State - Current discovery state
- Drop
Table Request - DropTable RPC request.
- DynAsync
FnMut - Type-erased asynchronous function.
- Execute
Script Builder - Execute
Script Operation - Long-running script operation started by [
QueryClient::execute_script]. - Fetch
Script Result - One page of script results from [
QueryClient::fetch_script_results]. - Fetch
Script Results Builder - From
EnvCredentials - GCEMetadata
- Get instance service account token from GCE instance
- Grpc
Options - Common options for gRPC connections.
- Index
Description - Interactive
- Calls inside [
Transaction] (retry_txcallback). - Lease
- Limited
Retry Budget - Fixed maximum number of retry attempts per second (token bucket).
- List
Operations Request - Filter and pagination parameters for [
OperationClient::list_operations]. - List
Operations Result - Page of operations from [
OperationClient::list_operations]. - Metadata
UrlCredentials - Get token of service account of instance
- MutWith
Lifetime - Marker type that represents mutable reference type parametrized by its lifetime.
- Named
Policy Description - Named policy preset from [
TableClient::describe_table_options]. - Node
Config - Node
Config Builder - Builder for
NodeConfig. - Node
Description - OneRow
- Operation
Client - Operation
Info - Long-running operation snapshot returned by Operation Service.
- Operation
Kind - Well-known
kindvalues forListOperationsRequest. - Optional
Row - Owned
With Lifetime - Marker type that represents lifetime-independent type.
- Partition
Info - PartitionInfo contains info about partition.
- Partition
Location - Partition
Session Key - Partition
Stats - Partitioning
Settings - Percent
OfRps Retry Budget - Retry budget as a percentage of the driver’s request rate (operations per second).
- Percent
Retry Budget - Probabilistic retry budget (aligned with ydb-go-sdk
budget.Percent). - Query
- Query object
- Query
Client - Query
Stats - Query
Stream - Streaming query result. When obtained with [
CallBuilder::with_commit(true)] inside a transaction, you must drain all result sets and callSelf::close; dropping early cancels the gRPC stream and does not commit. - Read
Rows Request - ReadRows RPC request (go-sdk:
table.Client.ReadRows+options.ReadRowsOption). - RefWith
Lifetime - Marker type that represents reference type parametrized by its lifetime.
- Rename
Table Item - Result
Set - Result
SetRows Iter - Retry
Metrics - Sliding-window counters used by
PercentOfRpsRetryBudget. - Retry
TxBuilder - Builder for
QueryClient::retry_tx. - Row
- Scheme
Client - Scheme
Entry - Scheme
Permissions - Service
Account Credentials - Get service account credentials instance service account key should be:
- Session
Options - Session
Options Builder - Builder for
SessionOptions. - Session
Pool Settings - Settings for the driver session pool (CreateSession + AttachSession).
- Session
Pool Stats - Snapshot of session pool counters (aligned with go-sdk
pool.Stats). - Signed
Interval - Static
Credentials - Static
Discovery - Always discovery once static node
- Table
Client - Client for YDB Table service: DDL via RPC (
CreateTable, …), sessionless data plane (ReadRows,BulkUpsert), describe. - Table
Column - Column specification for
CreateTableRequestandAlterTableRequest. - Table
Description - Table
Options Description - Cluster-wide table option presets (go-sdk:
options.TableOptionsDescription). - Token
Info - Topic
Client - Topic
Description - TopicDescription contains info about topic.
- Topic
Reader - Topic
Reader Batch - Topic
Reader Commit Marker - Topic
Reader Message - Topic
Reader Options - Topic
Reader Options Builder - Use builder syntax to set the inputs and finish with
build(). - Topic
Reader Tx - Topic
Selector - Topic
Selector Builder - Use builder syntax to set the inputs and finish with
build(). - Topic
Selectors - Topic
Stats - Topic
Writer - TopicWriter is currently in development. It is mostly usable, but has some unimplemented features.
- Topic
Writer Message - Topic
Writer Message Builder - Use builder syntax to set the inputs and finish with
build(). - Topic
Writer Options - Topic
Writer Options Builder - Use builder syntax to set the inputs and finish with
build(). - Topic
Writer Tx - A topic writer bound to an active YDB transaction.
- Topic
Writer TxOptions - Topic
Writer TxOptions Builder - Builder for
TopicWriterTxOptions. - Transaction
- Transaction
Options - Unknown
Type Description - Error description of an unknown/unsupported column type
- Value
List - Value
Optional - Value
Struct - Watch
Options - Watch
Options Builder - Builder for
WatchOptions. - YdbDecimal
- A decimal value with explicit YQL type parameters (precision and scale).
- YdbIssue
- Describe issue from server
- YdbStatus
Error - Describe operation status from server
Enums§
- Consistency
Mode - Exec
Call - Index
Status - Index
Type - Metering
Mode - OneResult
Set - Partitioning
Strategy - Rate
Limiter Counters Mode - Retry
Budget Error - Error returned when
RetryBudget::acquirecannot grant a retry slot. - Scheme
Entry Type - Sign
- Store
Type - Streamed
- TxMode
- Query Service transaction isolation mode.
- Value
- Internal represent database value for send to or received from database.
- Watch
Mode - YdbError
- Error which can be returned from the crate.
- YdbIssue
Severity - Severity of issue
- YdbOr
Customer Error - Error for wrap user errors while return it from callback
Traits§
- Async
FnMut AsyncFnMutequivalent 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 ofAsyncFn*traits.- Compression
Decoder - Decodes topic message payloads for one codec.
- Compression
Encoder - Encodes topic message payloads for one codec.
- Credentials
- Discovery
- Discovery YDB endpoints
- Executor
- From
YdbRow - Row-to-struct mapping (the sqlx
FromRowanalogue). - HasGrpc
Options - Helper trait for types that has configurable gRPC options.
- Query
Executor - Query execution entry points for
QueryClientandTransaction. - Retry
Budget - Limits how many client-side retries may proceed across all SDK retriers on one driver.
- Retry
TxAttempt - Auxiliary trait for closures that can be passed into
QueryClient::retry_tx. - Waiter
- With
Lifetime - The trait that allows to express lifetime-parametrized types as plain types.
Type Aliases§
- Command
Line YcToken Deprecated - Exec
Builder - Optional
RowBuilder - Query
RowBuilder - Query
Stream Builder - Result
SetBuilder - Static
Credentials Auth Deprecated - Static
Token Deprecated - Yandex
Metadata Deprecated - YdbResult
- T result or YdbError as Error
- YdbResult
With Customer Err - T result or YdbOrCustomerError as Error