Revert "Use Subscription Manager from jsonrpc-pubsub (#6208)" (#6252)

This reverts commit ea1eb4e57f.
This commit is contained in:
André Silva
2020-06-04 15:39:57 +01:00
committed by GitHub
parent 3fef099893
commit 8f5a52fe1a
31 changed files with 285 additions and 196 deletions
+6 -5
View File
@@ -32,8 +32,9 @@ use rpc::{
futures::{stream, Future, Sink, Stream},
};
use sc_rpc_api::Subscriptions;
use sc_client_api::{BlockchainEvents, light::{Fetcher, RemoteBlockchain}};
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId, manager::SubscriptionManager};
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use sp_rpc::{number::NumberOrHex, list::ListOrValue};
use sp_runtime::{
generic::{BlockId, SignedBlock},
@@ -56,7 +57,7 @@ trait ChainBackend<Client, Block: BlockT>: Send + Sync + 'static
fn client(&self) -> &Arc<Client>;
/// Get subscriptions reference.
fn subscriptions(&self) -> &SubscriptionManager;
fn subscriptions(&self) -> &Subscriptions;
/// Tries to unwrap passed block hash, or uses best block hash otherwise.
fn unwrap_or_best(&self, hash: Option<Block::Hash>) -> Block::Hash {
@@ -176,7 +177,7 @@ trait ChainBackend<Client, Block: BlockT>: Send + Sync + 'static
/// Create new state API that works on full node.
pub fn new_full<Block: BlockT, Client>(
client: Arc<Client>,
subscriptions: SubscriptionManager,
subscriptions: Subscriptions,
) -> Chain<Block, Client>
where
Block: BlockT + 'static,
@@ -190,7 +191,7 @@ pub fn new_full<Block: BlockT, Client>(
/// Create new state API that works on light node.
pub fn new_light<Block: BlockT, Client, F: Fetcher<Block>>(
client: Arc<Client>,
subscriptions: SubscriptionManager,
subscriptions: Subscriptions,
remote_blockchain: Arc<dyn RemoteBlockchain<Block>>,
fetcher: Arc<F>,
) -> Chain<Block, Client>
@@ -278,7 +279,7 @@ impl<Block, Client> ChainApi<NumberFor<Block>, Block::Hash, Block::Header, Signe
/// Subscribe to new headers.
fn subscribe_headers<Block, Client, F, G, S, ERR>(
client: &Arc<Client>,
subscriptions: &SubscriptionManager,
subscriptions: &Subscriptions,
subscriber: Subscriber<Block::Header>,
best_block_hash: G,
stream: F,