Drop feature, move to nonblocking mod
This commit is contained in:
parent
a6a8a712e5
commit
8c376f58cb
|
@ -4752,6 +4752,7 @@ dependencies = [
|
|||
name = "solana-client-test"
|
||||
version = "1.10.0"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"serde_json",
|
||||
"serial_test",
|
||||
"solana-client",
|
||||
|
|
|
@ -10,6 +10,7 @@ documentation = "https://docs.rs/solana-client-test"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
futures-util = "0.3.19"
|
||||
serde_json = "1.0.78"
|
||||
serial_test = "0.5.1"
|
||||
solana-client = { path = "../client", version = "=1.10.0" }
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use {
|
||||
futures_util::StreamExt,
|
||||
serde_json::{json, Value},
|
||||
serial_test::serial,
|
||||
solana_client::{
|
||||
nonblocking,
|
||||
pubsub_client::PubsubClient,
|
||||
rpc_client::RpcClient,
|
||||
rpc_config::{
|
||||
|
@ -518,8 +520,6 @@ fn test_slot_subscription() {
|
|||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn test_slot_subscription_async() {
|
||||
use {futures_util::StreamExt, solana_client::pubsub_client_async::PubsubClient};
|
||||
|
||||
let sync_service = Arc::new(AtomicU64::new(0));
|
||||
let sync_client = Arc::clone(&sync_service);
|
||||
fn wait_until(atomic: &Arc<AtomicU64>, value: u64) {
|
||||
|
@ -569,7 +569,9 @@ async fn test_slot_subscription_async() {
|
|||
|
||||
wait_until(&sync_client, 1);
|
||||
let url = format!("ws://0.0.0.0:{}/", pubsub_addr.port());
|
||||
let pubsub_client = PubsubClient::connect(&url).await.unwrap();
|
||||
let pubsub_client = nonblocking::pubsub_client::PubsubClient::new(&url)
|
||||
.await
|
||||
.unwrap();
|
||||
let (mut notifications, unsubscribe) = pubsub_client.slot_subscribe().await.unwrap();
|
||||
sync_client.store(2, Ordering::Relaxed);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ bincode = "1.3.3"
|
|||
bs58 = "0.4.0"
|
||||
clap = "2.33.0"
|
||||
crossbeam-channel = "0.5"
|
||||
futures-util = { version = "0.3.19", optional = true }
|
||||
futures-util = "0.3.19"
|
||||
indicatif = "0.16.2"
|
||||
jsonrpc-core = "18.0.0"
|
||||
log = "0.4.14"
|
||||
|
@ -37,8 +37,8 @@ solana-version = { path = "../version", version = "=1.10.0" }
|
|||
solana-vote-program = { path = "../programs/vote", version = "=1.10.0" }
|
||||
thiserror = "1.0"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tokio-stream = { version = "0.1.8", optional = true }
|
||||
tokio-tungstenite = { version = "0.16.0", features = ["rustls-tls-webpki-roots"], optional = true }
|
||||
tokio-stream = "0.1.8"
|
||||
tokio-tungstenite = { version = "0.16.0", features = ["rustls-tls-webpki-roots"] }
|
||||
tungstenite = { version = "0.16.0", features = ["rustls-tls-webpki-roots"] }
|
||||
url = "2.2.2"
|
||||
|
||||
|
@ -49,7 +49,3 @@ solana-logger = { path = "../logger", version = "=1.10.0" }
|
|||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[features]
|
||||
default = ["async"]
|
||||
async = ["futures-util", "tokio-stream", "tokio-tungstenite"]
|
||||
|
|
|
@ -10,8 +10,6 @@ pub mod nonblocking;
|
|||
pub mod nonce_utils;
|
||||
pub mod perf_utils;
|
||||
pub mod pubsub_client;
|
||||
#[cfg(feature = "async")]
|
||||
pub mod pubsub_client_async;
|
||||
pub mod rpc_cache;
|
||||
pub mod rpc_client;
|
||||
pub mod rpc_config;
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
pub mod pubsub_client;
|
||||
pub mod rpc_client;
|
||||
|
|
|
@ -48,13 +48,16 @@ pub enum PubsubClientError {
|
|||
|
||||
#[error("unable to connect to server")]
|
||||
ConnectionError(tokio_tungstenite::tungstenite::Error),
|
||||
|
||||
#[error("websocket error")]
|
||||
WsError(#[from] tokio_tungstenite::tungstenite::Error),
|
||||
|
||||
#[error("connection closed")]
|
||||
ConnectionClosed,
|
||||
|
||||
#[error("json parse error")]
|
||||
JsonParseError(#[from] serde_json::error::Error),
|
||||
|
||||
#[error("subscribe failed: {reason}")]
|
||||
SubscribeFailed {
|
||||
reason: &'static str,
|
||||
|
@ -75,7 +78,7 @@ pub struct PubsubClient {
|
|||
}
|
||||
|
||||
impl PubsubClient {
|
||||
pub async fn connect(url: &str) -> PubsubClientResult<Self> {
|
||||
pub async fn new(url: &str) -> PubsubClientResult<Self> {
|
||||
let url = Url::parse(url)?;
|
||||
let (ws, _response) = connect_async(url)
|
||||
.await
|
Loading…
Reference in New Issue