Upgrade tokio to 0.3.2

Upstream changes in tokio have required several changes.
For example, `delay_until` was renamed to `sleep_until`. Similarly,
`notify` was renamed to `notify_one`.
Also, in tdb-macros, the `runtime::Builder::new()` line was changed into
`runtime::Builder::new_multi_thread()` due to changes upstream

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
next
Sayan Nandan 4 years ago
parent 71e020db59
commit bc1a6fd456
No known key found for this signature in database
GPG Key ID: C31EFD7DDA12AEE0

162
Cargo.lock generated

@ -15,7 +15,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -32,7 +32,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -69,6 +69,12 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
[[package]]
name = "bytes"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16"
[[package]]
name = "cc"
version = "1.0.59"
@ -91,7 +97,7 @@ dependencies = [
"num-integer",
"num-traits",
"time",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -150,22 +156,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
dependencies = [
"bitflags",
"fuchsia-zircon-sys",
]
[[package]]
name = "fuchsia-zircon-sys"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "futures-core"
version = "0.3.5"
@ -204,15 +194,6 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485"
[[package]]
name = "iovec"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
dependencies = [
"libc",
]
[[package]]
name = "jemalloc-sys"
version = "0.3.2"
@ -234,16 +215,6 @@ dependencies = [
"libc",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -260,7 +231,7 @@ checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
name = "libtdb"
version = "0.4.5-alpha.2"
dependencies = [
"bytes",
"bytes 0.5.6",
"lazy_static",
"termcolor",
]
@ -291,56 +262,15 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]]
name = "mio"
version = "0.6.22"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"
checksum = "f8f1c83949125de4a582aa2da15ae6324d91cf6a58a70ea407643941ff98f558"
dependencies = [
"cfg-if",
"fuchsia-zircon",
"fuchsia-zircon-sys",
"iovec",
"kernel32-sys",
"libc",
"log",
"miow 0.2.1",
"net2",
"slab",
"winapi 0.2.8",
]
[[package]]
name = "mio-named-pipes"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656"
dependencies = [
"log",
"mio",
"miow 0.3.5",
"winapi 0.3.9",
]
[[package]]
name = "mio-uds"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
dependencies = [
"iovec",
"libc",
"mio",
]
[[package]]
name = "miow"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
dependencies = [
"kernel32-sys",
"net2",
"winapi 0.2.8",
"ws2_32-sys",
"miow",
"ntapi",
"winapi",
]
[[package]]
@ -350,18 +280,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e"
dependencies = [
"socket2",
"winapi 0.3.9",
"winapi",
]
[[package]]
name = "net2"
version = "0.2.34"
name = "ntapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
dependencies = [
"cfg-if",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -416,7 +344,7 @@ dependencies = [
"libc",
"redox_syscall",
"smallvec",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -571,7 +499,7 @@ dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -596,7 +524,7 @@ name = "tdb"
version = "0.4.5-alpha.2"
dependencies = [
"bincode",
"bytes",
"bytes 0.6.0",
"chrono",
"clap",
"env_logger",
@ -667,38 +595,36 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi 0.3.9",
"winapi",
]
[[package]]
name = "tokio"
version = "0.2.22"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd"
checksum = "71f1b20504fd0aa9dab3ae17e8c4dd9431e5e08fd6921689f9745a4004883a17"
dependencies = [
"bytes",
"bytes 0.6.0",
"fnv",
"futures-core",
"iovec",
"lazy_static",
"libc",
"memchr",
"mio",
"mio-named-pipes",
"mio-uds",
"num_cpus",
"parking_lot",
"pin-project-lite",
"signal-hook-registry",
"slab",
"tokio-macros",
"winapi 0.3.9",
"winapi",
]
[[package]]
name = "tokio-macros"
version = "0.2.5"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389"
checksum = "21d30fdbb5dc2d8f91049691aa1a9d4d4ae422a21c334ce8936e5886d30c5c45"
dependencies = [
"proc-macro2",
"quote",
@ -718,7 +644,7 @@ dependencies = [
name = "tsh"
version = "0.4.5-alpha.2"
dependencies = [
"bytes",
"bytes 0.6.0",
"lazy_static",
"libtdb",
"regex",
@ -755,12 +681,6 @@ version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
version = "0.3.9"
@ -771,12 +691,6 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@ -789,7 +703,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -798,16 +712,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "yaml-rust"
version = "0.3.5"

@ -8,7 +8,7 @@ edition = "2018"
[dependencies]
libtdb = {path = "../libtdb"}
tokio = {version = "0.2.22", features = ["full"]}
bytes = "0.5.6"
regex = "1.3.9"
tokio = {version = "0.3.2", features = ["full"]}
bytes = "0.6.0"
regex = "1.4.1"
lazy_static = "1.4.0"

@ -7,8 +7,8 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "0.2.22", features = ["full"] }
bytes = "0.5.6"
tokio = { version = "0.3.2", features = ["full"] }
bytes = "0.6.0"
libtdb = {path ="../libtdb"}
bincode = "1.3.1"
parking_lot = "0.11.0"
@ -27,4 +27,4 @@ tdb_macros = {path="../tdb-macros"}
jemallocator = "0.3.2"
[dev-dependencies]
tokio = { version = "0.2.22", features = ["test-util"] }
tokio = { version = "0.3.2", features = ["test-util"] }

@ -369,6 +369,7 @@ pub enum ConfigType<T> {
Custom(T),
}
#[derive(Debug)]
/// Type of configuration error:
/// - The config file was not found (`OSError`)
/// - The config file was invalid (`SyntaxError`)

@ -343,8 +343,8 @@ impl Drop for CoreDB {
// to get a read lock
drop(coretable);
// Notify the background tasks to quit
self.shared.bgsave_task.notify();
self.shared.snapshot_service.notify();
self.shared.bgsave_task.notify_one();
self.shared.snapshot_service.notify_one();
}
}
}

@ -125,7 +125,7 @@ impl Listener {
}
}
// Wait for the `backoff` duration
time::delay_for(Duration::from_secs(backoff)).await;
time::sleep(Duration::from_secs(backoff)).await;
// We're using exponential backoff
backoff *= 2;
}

@ -108,7 +108,7 @@ pub async fn bgsave_scheduler(handle: coredb::CoreDB, bgsave_cfg: BGSave) {
if handle.shared.run_bgsave() {
tokio::select! {
// Sleep until `duration` from the current time instant
_ = time::delay_until(time::Instant::now() + duration) => {}
_ = time::sleep_until(time::Instant::now() + duration) => {}
// Otherwise wait for a notification
_ = handle.shared.bgsave_task.notified() => {}
}

@ -297,7 +297,7 @@ pub async fn snapshot_service(handle: CoreDB, ss_config: SnapshotConfig) {
while !handle.shared.is_termsig() {
if sengine.mksnap().is_some() {
tokio::select! {
_ = time::delay_until(time::Instant::now() + duration) => {},
_ = time::sleep_until(time::Instant::now() + duration) => {},
_ = handle.shared.bgsave_task.notified() => {}
}
} else {

@ -74,9 +74,8 @@ fn parse_dbtest(mut input: syn::ItemFn, rand: u16) -> Result<TokenStream, syn::E
#header
#(#attrs)*
#vis #sig {
tokio::runtime::Builder::new()
.threaded_scheduler()
.core_threads(4)
tokio::runtime::Builder::new_multi_thread()
.worker_threads(4)
.thread_name(#fname)
.thread_stack_size(3 * 1024 * 1024)
.enable_all()

Loading…
Cancel
Save