Открыть боковую панель
Баринов Сергей Владимирович
Unofficial Ydb client library written on rust
Коммиты
07eabd2d
Коммит
07eabd2d
создал
Апр 30, 2023
по автору
Баринов Сергей Владимирович
Просмотр файлов
fix some issues
владелец
7ec15af8
Изменения
2
Скрыть пробелы
Построчно
Рядом
src/client.rs
Просмотр файла @
07eabd2d
use
std
::
error
::
Error
;
use
std
::
error
::
Error
;
use
async_trait
::
async_trait
;
use
table
::
*
;
use
table
::
*
;
...
@@ -9,7 +8,6 @@ use tonic::codegen::InterceptedService;
...
@@ -9,7 +8,6 @@ use tonic::codegen::InterceptedService;
use
tonic
::
service
::
Interceptor
;
use
tonic
::
service
::
Interceptor
;
use
tonic
::
transport
::{
Endpoint
,
Channel
,
Uri
};
use
tonic
::
transport
::{
Endpoint
,
Channel
,
Uri
};
use
crate
::
client
;
use
crate
::
exper
::
YdbResponse
;
use
crate
::
exper
::
YdbResponse
;
use
crate
::
generated
::
ydb
::
discovery
::
v1
::
DiscoveryServiceClient
;
use
crate
::
generated
::
ydb
::
discovery
::
v1
::
DiscoveryServiceClient
;
use
crate
::
generated
::
ydb
::
table
::
query
::
Query
;
use
crate
::
generated
::
ydb
::
table
::
query
::
Query
;
...
@@ -17,7 +15,6 @@ use crate::generated::ydb::table::transaction_control::TxSelector;
...
@@ -17,7 +15,6 @@ use crate::generated::ydb::table::transaction_control::TxSelector;
use
crate
::
generated
::
ydb
::
table
::{
TransactionSettings
,
OnlineModeSettings
,
ExecuteDataQueryRequest
,
TransactionControl
,
self
,
CreateSessionRequest
,
DeleteSessionRequest
};
use
crate
::
generated
::
ydb
::
table
::{
TransactionSettings
,
OnlineModeSettings
,
ExecuteDataQueryRequest
,
TransactionControl
,
self
,
CreateSessionRequest
,
DeleteSessionRequest
};
use
crate
::
generated
::
ydb
::
table
::
transaction_settings
::
TxMode
;
use
crate
::
generated
::
ydb
::
table
::
transaction_settings
::
TxMode
;
use
crate
::
generated
::
ydb
::
table
::
v1
::
table_service_client
::
TableServiceClient
;
use
crate
::
generated
::
ydb
::
table
::
v1
::
table_service_client
::
TableServiceClient
;
use
crate
::
generated
::
ydb
::
table_stats
::
QueryStats
;
pub
type
AsciiValue
=
tonic
::
metadata
::
MetadataValue
<
tonic
::
metadata
::
Ascii
>
;
pub
type
AsciiValue
=
tonic
::
metadata
::
MetadataValue
<
tonic
::
metadata
::
Ascii
>
;
pub
fn
create_endpoint
(
uri
:
Uri
)
->
Endpoint
{
pub
fn
create_endpoint
(
uri
:
Uri
)
->
Endpoint
{
...
@@ -220,7 +217,7 @@ impl<'a, C: Credentials> YdbTransaction<'a, C> {
...
@@ -220,7 +217,7 @@ impl<'a, C: Credentials> YdbTransaction<'a, C> {
}
}
async
fn
rollback_inner
(
&
mut
self
)
->
Result
<
(),
YdbError
>
{
async
fn
rollback_inner
(
&
mut
self
)
->
Result
<
(),
YdbError
>
{
let
tx_id
=
self
.invoke_tx_id
();
let
tx_id
=
self
.invoke_tx_id
();
let
response
=
self
.client
.rollback_transaction
(
RollbackTransactionRequest
{
tx_id
,
..
Default
::
default
()})
.await
?
;
self
.client
.rollback_transaction
(
RollbackTransactionRequest
{
tx_id
,
..
Default
::
default
()})
.await
?
;
Ok
(())
Ok
(())
}
}
pub
async
fn
rollback
(
mut
self
)
->
(
TableClientWithSession
<
'a
,
C
>
,
Result
<
(),
YdbError
>
)
{
pub
async
fn
rollback
(
mut
self
)
->
(
TableClientWithSession
<
'a
,
C
>
,
Result
<
(),
YdbError
>
)
{
...
...
src/pool.rs
Просмотр файла @
07eabd2d
use
std
::{
vec
,
time
::
Duration
};
use
std
::{
vec
,
time
::
Duration
};
use
std
::
sync
::{
atomic
::
AtomicU32
,
Arc
};
use
deadpool
::
managed
::{
Manager
,
Pool
,
PoolBuilder
};
use
deadpool
::
managed
::{
Manager
,
Pool
,
PoolBuilder
};
use
tonic
::
transport
::{
Endpoint
,
Uri
};
use
tonic
::
transport
::{
Endpoint
,
Uri
};
use
tower
::
{
ServiceExt
}
;
use
tower
::
ServiceExt
;
use
crate
::
exper
::
YdbResponse
;
use
crate
::
exper
::
YdbResponse
;
use
crate
::
generated
::
ydb
::
discovery
::{
EndpointInfo
,
ListEndpointsRequest
};
use
crate
::
generated
::
ydb
::
discovery
::{
EndpointInfo
,
ListEndpointsRequest
};
...
@@ -14,7 +13,6 @@ use crate::client::{Credentials, YdbService, AsciiValue, YdbError};
...
@@ -14,7 +13,6 @@ use crate::client::{Credentials, YdbService, AsciiValue, YdbError};
struct
YdbEndpoint
{
struct
YdbEndpoint
{
inner
:
Endpoint
,
inner
:
Endpoint
,
load_factor
:
f32
,
load_factor
:
f32
,
connections
:
AtomicU32
,
}
}
type
YdbEndpoints
=
std
::
sync
::
RwLock
<
Vec
<
EndpointInfo
>>
;
type
YdbEndpoints
=
std
::
sync
::
RwLock
<
Vec
<
EndpointInfo
>>
;
...
@@ -35,7 +33,6 @@ impl From<&EndpointInfo> for YdbEndpoint {
...
@@ -35,7 +33,6 @@ impl From<&EndpointInfo> for YdbEndpoint {
Self
{
Self
{
inner
,
inner
,
load_factor
:
info
.load_factor
,
load_factor
:
info
.load_factor
,
connections
:
Default
::
default
(),
}
}
}
}
}
}
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать