Migrate to `localtime` from `nakamoto`
The only thing we needed nakamoto for was `LocalTime`. Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
parent
d25c47ad0e
commit
3bc07195f5
|
|
@ -1570,6 +1570,12 @@ version = "0.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
|
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "localtime"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b58b1a2626b0920eec1d591e94c4feb3d1353695faad25c38f2a3c3efaf3db19"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.17"
|
version = "0.4.17"
|
||||||
|
|
@ -1645,17 +1651,6 @@ dependencies = [
|
||||||
"data-encoding-macro",
|
"data-encoding-macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nakamoto-net"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "git+https://github.com/cloudhead/nakamoto?rev=90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb#90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-channel",
|
|
||||||
"fastrand",
|
|
||||||
"log",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "netservices"
|
name = "netservices"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -2290,8 +2285,8 @@ dependencies = [
|
||||||
"git-ref-format",
|
"git-ref-format",
|
||||||
"io-reactor",
|
"io-reactor",
|
||||||
"lexopt",
|
"lexopt",
|
||||||
|
"localtime",
|
||||||
"log",
|
"log",
|
||||||
"nakamoto-net",
|
|
||||||
"netservices",
|
"netservices",
|
||||||
"nonempty 0.8.1",
|
"nonempty 0.8.1",
|
||||||
"qcheck",
|
"qcheck",
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,6 @@ inherits = "release"
|
||||||
debug = true
|
debug = true
|
||||||
incremental = false
|
incremental = false
|
||||||
|
|
||||||
[patch.crates-io.nakamoto-net]
|
|
||||||
git = "https://github.com/cloudhead/nakamoto"
|
|
||||||
rev = "90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
|
|
||||||
version = "0.3.0"
|
|
||||||
|
|
||||||
[patch.crates-io.io-reactor]
|
[patch.crates-io.io-reactor]
|
||||||
git = "https://github.com/rust-amplify/io-reactor"
|
git = "https://github.com/rust-amplify/io-reactor"
|
||||||
rev = "6148aec926c82f08373687d1a9da07a2bca67ea3"
|
rev = "6148aec926c82f08373687d1a9da07a2bca67ea3"
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ fastrand = { version = "1.8.0" }
|
||||||
git-ref-format = { version = "0", features = ["serde", "macro"] }
|
git-ref-format = { version = "0", features = ["serde", "macro"] }
|
||||||
lexopt = { version = "0.2.1" }
|
lexopt = { version = "0.2.1" }
|
||||||
log = { version = "0.4.17", features = ["std"] }
|
log = { version = "0.4.17", features = ["std"] }
|
||||||
nakamoto-net = { version = "0.3.0" }
|
localtime = { version = "1" }
|
||||||
netservices = { version = "0", features = ["io-reactor", "socket2", "log"] }
|
netservices = { version = "0", features = ["io-reactor", "socket2", "log"] }
|
||||||
nonempty = { version = "0.8.1", features = ["serialize"] }
|
nonempty = { version = "0.8.1", features = ["serialize"] }
|
||||||
io-reactor = { version = "0", features = ["popol", "socket2"] }
|
io-reactor = { version = "0", features = ["popol", "socket2"] }
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,6 @@ pub enum Error {
|
||||||
/// An I/O error.
|
/// An I/O error.
|
||||||
#[error("i/o error: {0}")]
|
#[error("i/o error: {0}")]
|
||||||
Io(#[from] io::Error),
|
Io(#[from] io::Error),
|
||||||
/// A networking error.
|
|
||||||
#[error("network error: {0}")]
|
|
||||||
Net(#[from] nakamoto_net::error::Error),
|
|
||||||
/// A control socket error.
|
/// A control socket error.
|
||||||
#[error("control socket error: {0}")]
|
#[error("control socket error: {0}")]
|
||||||
Control(#[from] control::Error),
|
Control(#[from] control::Error),
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ pub mod tests;
|
||||||
pub mod wire;
|
pub mod wire;
|
||||||
pub mod worker;
|
pub mod worker;
|
||||||
|
|
||||||
pub use nakamoto_net::{Io, LocalDuration, LocalTime};
|
pub use localtime::{LocalDuration, LocalTime};
|
||||||
pub use netservices::LinkDirection as Link;
|
pub use netservices::LinkDirection as Link;
|
||||||
pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};
|
pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::{env, net, process};
|
||||||
|
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
use cyphernet::addr::PeerAddr;
|
use cyphernet::addr::PeerAddr;
|
||||||
use nakamoto_net::LocalDuration;
|
use localtime::LocalDuration;
|
||||||
|
|
||||||
use radicle::profile;
|
use radicle::profile;
|
||||||
use radicle_node::client::Runtime;
|
use radicle_node::client::Runtime;
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,8 @@ use std::{fmt, io, net, str};
|
||||||
|
|
||||||
use crossbeam_channel as chan;
|
use crossbeam_channel as chan;
|
||||||
use fastrand::Rng;
|
use fastrand::Rng;
|
||||||
|
use localtime::{LocalDuration, LocalTime};
|
||||||
use log::*;
|
use log::*;
|
||||||
use nakamoto::{LocalDuration, LocalTime};
|
|
||||||
use nakamoto_net as nakamoto;
|
|
||||||
use nonempty::NonEmpty;
|
use nonempty::NonEmpty;
|
||||||
use radicle::node::{Address, Features};
|
use radicle::node::{Address, Features};
|
||||||
use radicle::storage::{Namespaces, ReadStorage};
|
use radicle::storage::{Namespaces, ReadStorage};
|
||||||
|
|
@ -395,7 +394,7 @@ where
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tick(&mut self, now: nakamoto::LocalTime) {
|
pub fn tick(&mut self, now: LocalTime) {
|
||||||
trace!("Tick +{}", now - self.start_time);
|
trace!("Tick +{}", now - self.start_time);
|
||||||
|
|
||||||
self.clock = now;
|
self.clock = now;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use super::nakamoto::LocalDuration;
|
use localtime::LocalDuration;
|
||||||
|
|
||||||
use radicle::node::Address;
|
use radicle::node::Address;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ impl Store for Table {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use nakamoto_net::LocalTime;
|
use localtime::LocalTime;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test::arbitrary;
|
use crate::test::arbitrary;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
|
|
||||||
|
use localtime::{LocalDuration, LocalTime};
|
||||||
use log::*;
|
use log::*;
|
||||||
use nakamoto_net::{LocalDuration, LocalTime};
|
|
||||||
|
|
||||||
use crate::crypto::Signer;
|
use crate::crypto::Signer;
|
||||||
use crate::prelude::Address;
|
use crate::prelude::Address;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use std::{fmt, io, net};
|
||||||
use amplify::Wrapper as _;
|
use amplify::Wrapper as _;
|
||||||
use crossbeam_channel as chan;
|
use crossbeam_channel as chan;
|
||||||
use cyphernet::{Cert, Digest, EcSign, Sha256};
|
use cyphernet::{Cert, Digest, EcSign, Sha256};
|
||||||
use nakamoto_net::LocalTime;
|
use localtime::LocalTime;
|
||||||
use netservices::resource::{ListenerEvent, NetAccept, NetTransport, SessionEvent};
|
use netservices::resource::{ListenerEvent, NetAccept, NetTransport, SessionEvent};
|
||||||
use netservices::session::ProtocolArtifact;
|
use netservices::session::ProtocolArtifact;
|
||||||
use netservices::session::{CypherReader, CypherSession, CypherWriter};
|
use netservices::session::{CypherReader, CypherSession, CypherWriter};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue