mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
Update crc 1.8.1 -> 2.0.0 (#1256)
This commit is contained in:
parent
8204989191
commit
0abbcc510f
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -346,12 +346,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "build_const"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.6.1"
|
||||
@ -523,13 +517,19 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
version = "1.8.1"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
|
||||
checksum = "10c2722795460108a7872e1cd933a85d6ec38abc4baecad51028f702da28889f"
|
||||
dependencies = [
|
||||
"build_const",
|
||||
"crc-catalog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc-catalog"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403"
|
||||
|
||||
[[package]]
|
||||
name = "criterion"
|
||||
version = "0.3.4"
|
||||
|
||||
@ -109,7 +109,7 @@ bitflags = { version = "1.2.1", default-features = false }
|
||||
bytes = "1.0.0"
|
||||
byteorder = { version = "1.3.4", default-features = false, features = ["std"] }
|
||||
chrono = { version = "0.4.11", default-features = false, features = ["clock"], optional = true }
|
||||
crc = { version = "1.8.1", optional = true }
|
||||
crc = { version = "2.0.0", optional = true }
|
||||
crossbeam-queue = "0.3.1"
|
||||
crossbeam-channel = "0.5.0"
|
||||
crossbeam-utils = { version = "0.8.1", default-features = false }
|
||||
|
||||
@ -8,7 +8,6 @@ use crate::mysql::{MySql, MySqlConnectOptions, MySqlConnection};
|
||||
use crate::query::query;
|
||||
use crate::query_as::query_as;
|
||||
use crate::query_scalar::query_scalar;
|
||||
use crc::crc32;
|
||||
use futures_core::future::BoxFuture;
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
@ -266,9 +265,10 @@ async fn current_database(conn: &mut MySqlConnection) -> Result<String, MigrateE
|
||||
|
||||
// inspired from rails: https://github.com/rails/rails/blob/6e49cc77ab3d16c06e12f93158eaf3e507d4120e/activerecord/lib/active_record/migration.rb#L1308
|
||||
fn generate_lock_id(database_name: &str) -> String {
|
||||
const CRC_IEEE: crc::Crc<u32> = crc::Crc::<u32>::new(&crc::CRC_32_ISO_HDLC);
|
||||
// 0x3d32ad9e chosen by fair dice roll
|
||||
format!(
|
||||
"{:x}",
|
||||
0x3d32ad9e * (crc32::checksum_ieee(database_name.as_bytes()) as i64)
|
||||
0x3d32ad9e * (CRC_IEEE.checksum(database_name.as_bytes()) as i64)
|
||||
)
|
||||
}
|
||||
|
||||
@ -8,7 +8,6 @@ use crate::postgres::{PgConnectOptions, PgConnection, Postgres};
|
||||
use crate::query::query;
|
||||
use crate::query_as::query_as;
|
||||
use crate::query_scalar::query_scalar;
|
||||
use crc::crc32;
|
||||
use futures_core::future::BoxFuture;
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
@ -281,6 +280,7 @@ async fn current_database(conn: &mut PgConnection) -> Result<String, MigrateErro
|
||||
|
||||
// inspired from rails: https://github.com/rails/rails/blob/6e49cc77ab3d16c06e12f93158eaf3e507d4120e/activerecord/lib/active_record/migration.rb#L1308
|
||||
fn generate_lock_id(database_name: &str) -> i64 {
|
||||
const CRC_IEEE: crc::Crc<u32> = crc::Crc::<u32>::new(&crc::CRC_32_ISO_HDLC);
|
||||
// 0x3d32ad9e chosen by fair dice roll
|
||||
0x3d32ad9e * (crc32::checksum_ieee(database_name.as_bytes()) as i64)
|
||||
0x3d32ad9e * (CRC_IEEE.checksum(database_name.as_bytes()) as i64)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user