Skip to content

Commit

Permalink
Merge pull request #203 update rust new version to 1.79
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby authored Jun 20, 2024
2 parents e159036 + 4a46bd4 commit a4a175d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-crate.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish rust crate to crates.io
env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.78.0
RUST_VERSION: 1.79.0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUST_VERSION_OLD: "1.60.0"
RUST_VERSION_NEW: "1.78.0"
RUST_VERSION_NEW: "1.79.0"

jobs:
tests:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions ydb/src/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ impl MetadataUrlCredentials {
}
}



/// Create GCEMetadata with custom url (may need for debug or spec infrastructure with non standard metadata)
///
/// Example:
Expand All @@ -84,6 +86,12 @@ impl MetadataUrlCredentials {
}
}

impl Default for MetadataUrlCredentials {
fn default() -> Self {
Self::new()
}
}

impl Credentials for MetadataUrlCredentials {
fn create_token(&self) -> YdbResult<TokenInfo> {
self.inner.create_token()
Expand All @@ -102,6 +110,12 @@ impl AnonymousCredentials {
}
}

impl Default for AnonymousCredentials {
fn default() -> Self {
Self::new()
}
}

impl Credentials for AnonymousCredentials {
fn create_token(&self) -> YdbResult<TokenInfo> {
self.inner.create_token()
Expand Down Expand Up @@ -152,7 +166,7 @@ fn get_credentials_from_env() -> YdbResult<Box<dyn Credentials>> {
return Ok(Box::new(AccessTokenCredentials::from(token)));
}

return Ok(Box::new(MetadataUrlCredentials::new()));
Ok(Box::new(MetadataUrlCredentials::new()))
}

/// Credentials with static token without renewing
Expand Down Expand Up @@ -409,8 +423,8 @@ impl ServiceAccountCredentials {
let duration = time - chrono::Utc::now();
let seconds = (0.1 * duration.num_seconds() as f64) as u64;
trace!("renew in: {}", seconds);
let instant = Instant::now() + Duration::from_secs(seconds);
instant

Instant::now() + Duration::from_secs(seconds)
}
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/src/grpc_wrapper/raw_table_service/value/value_ydb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl TryFrom<RawTypedValue> for Value {
let int_val = merge_parts(high, low) as i128;

let value =
decimal_rs::Decimal::from_parts(int_val.abs() as u128, t.scale, int_val < 0)
decimal_rs::Decimal::from_parts(int_val.unsigned_abs(), t.scale, int_val < 0)
.map_err(|e| RawError::decode_error(e.to_string()))?;
return Ok(Value::Decimal(value));
}
Expand Down
8 changes: 0 additions & 8 deletions ydb/src/session_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const DEFAULT_SIZE: usize = 1000;
#[async_trait]
pub(crate) trait SessionFabric: Send + Sync {
async fn create_session(&self, timeouts: TimeoutSettings) -> YdbResult<Session>;
fn clone_box(&self) -> Box<dyn SessionFabric>;
}

#[async_trait]
Expand All @@ -29,9 +28,6 @@ impl SessionFabric for GrpcConnectionManager {
let session = Session::new(session_res.id, self.clone(), TimeoutSettings::default());
return Ok(session);
}
fn clone_box(&self) -> Box<dyn SessionFabric> {
Box::new(self.clone())
}
}

type IdleSessions = Arc<Mutex<VecDeque<IdleSessionItem>>>;
Expand Down Expand Up @@ -179,10 +175,6 @@ mod test {
timeouts,
))
}

fn clone_box(&self) -> Box<dyn SessionFabric> {
Box::new(SessionClientMock {})
}
}

struct TableChannelPoolMock {}
Expand Down
2 changes: 1 addition & 1 deletion ydb/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ impl Value {
r#type: Some(ydb_proto::Type {
r#type: Some(ydb_proto::r#type::Type::DecimalType(
ydb_proto::DecimalType {
precision: val.precision().try_into()?,
precision: val.precision().into(),
scale: val.scale().try_into()?,
},
)),
Expand Down

0 comments on commit a4a175d

Please sign in to comment.