Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Aug 7, 2024
1 parent 4913e57 commit 423bf25
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
42 changes: 26 additions & 16 deletions connector/src/bin/chaindata_standalone/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
mod router_impl;
use std::sync::{Arc, RwLock};
use std::thread::sleep;

Check warning on line 3 in connector/src/bin/chaindata_standalone/main.rs

View workflow job for this annotation

GitHub Actions / test

Diff in /home/runner/work/mango-feeds/mango-feeds/connector/src/bin/chaindata_standalone/main.rs
use tokio::sync::broadcast;

use std::sync::{Arc, RwLock, RwLockWriteGuard};
use mango_feeds_connector::chain_data::{ChainData, SlotData};
use mango_feeds_connector::{AccountWrite, SlotUpdate};
use mango_feeds_connector::chain_data::ChainData;

mod router_impl;

pub type ChainDataArcRw = Arc<RwLock<ChainData>>;

Check warning on line 11 in connector/src/bin/chaindata_standalone/main.rs

View workflow job for this annotation

GitHub Actions / test

Diff in /home/runner/work/mango-feeds/mango-feeds/connector/src/bin/chaindata_standalone/main.rs

Expand All @@ -10,19 +15,24 @@ pub fn main() {
"info,mango_feeds_connector::grpc_plugin_source=debug",
);

// let chain_data = Arc::new(RwLock::new(ChainData::new()));
// chain_data.clone(),
// account_write_receiver,
// slot_receiver,
// account_update_sender.clone(),
// exit_sender.subscribe(),
// );
// chain_data.write().unwrap().update_slot(SlotData {
// slot: 1,
// parent: None,
// status: chain_data::SlotStatus::Processed,
// chain: 0,
// });
let (exit_sender, _) = broadcast::channel(1);

let (account_write_sender, account_write_receiver) = async_channel::unbounded::<AccountWrite>();
let (slot_sender, slot_receiver) = async_channel::unbounded::<SlotUpdate>();

Check warning on line 21 in connector/src/bin/chaindata_standalone/main.rs

View workflow job for this annotation

GitHub Actions / test

Diff in /home/runner/work/mango-feeds/mango-feeds/connector/src/bin/chaindata_standalone/main.rs
let (account_update_sender, _) = broadcast::channel(524288); // TODO this is huge, nut init snapshot will completely spam this


let chain_data = Arc::new(RwLock::new(ChainData::new()));
router_impl::start_chaindata_updating(
chain_data.clone(),
account_write_receiver,
slot_receiver,
account_update_sender.clone(),
exit_sender.subscribe(),

Check warning on line 31 in connector/src/bin/chaindata_standalone/main.rs

View workflow job for this annotation

GitHub Actions / test

Diff in /home/runner/work/mango-feeds/mango-feeds/connector/src/bin/chaindata_standalone/main.rs
);


sleep(std::time::Duration::from_secs(10));

}

6 changes: 3 additions & 3 deletions connector/src/bin/chaindata_standalone/router_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use std::sync::{Arc, RwLock, RwLockWriteGuard};
use std::time::{Duration, Instant};
use log::{info, warn};
use solana_sdk::pubkey::Pubkey;
use mango_feeds_connector::{AccountWrite, chain_data, SlotUpdate};
use mango_feeds_connector::chain_data::{ChainData, SlotData};
use mango_feeds_connector::{AccountWrite, SlotUpdate};
use mango_feeds_connector::chain_data::{ChainData};
use tokio::sync::broadcast;
use tokio::task::JoinHandle;

pub type ChainDataArcRw = Arc<RwLock<ChainData>>;

Check warning on line 10 in connector/src/bin/chaindata_standalone/router_impl.rs

View workflow job for this annotation

GitHub Actions / test

Diff in /home/runner/work/mango-feeds/mango-feeds/connector/src/bin/chaindata_standalone/router_impl.rs


// from router project
fn start_chaindata_updating(
pub fn start_chaindata_updating(
chain_data: ChainDataArcRw,
account_writes: async_channel::Receiver<AccountWrite>,
slot_updates: async_channel::Receiver<SlotUpdate>,
Expand Down

0 comments on commit 423bf25

Please sign in to comment.