chore: add conns as Arc Mutex AppDataConn in DataDBs and clean unused code
This commit is contained in:
parent
a353559890
commit
2574068505
39
src/defs.rs
39
src/defs.rs
@ -4,27 +4,25 @@ use app_auth::{AuthStore};
|
|||||||
use kloud::{defs::KloudStore, datacontext::DataContext};
|
use kloud::{defs::KloudStore, datacontext::DataContext};
|
||||||
use kloud::utils::load_from_module;
|
use kloud::utils::load_from_module;
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
use tokio::sync::Mutex;
|
||||||
|
use connectors::defs::{AppDataConn};
|
||||||
|
|
||||||
use clds::clouds::defs::{
|
use clds::clouds::defs::{
|
||||||
CloudEnv,
|
CloudEnv,
|
||||||
Cloud,
|
Cloud,
|
||||||
};
|
};
|
||||||
use kloud::kloud::Kloud;
|
use kloud::kloud::Kloud;
|
||||||
//use topographic_anatomy::TopographicAnatomy;
|
|
||||||
//use tracking_point::TrackingPoint;
|
|
||||||
|
|
||||||
#[derive(Clone,Default)]
|
#[derive(Clone,Default)]
|
||||||
pub struct CollsData {
|
pub struct CollsData {
|
||||||
pub klouds: KloudStore<Kloud>,
|
pub klouds: KloudStore<Kloud>,
|
||||||
// pub ta: KloudStore<TopographicAnatomy>,
|
|
||||||
// pub tp: KloudStore<TrackingPoint>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CollsData {
|
impl CollsData {
|
||||||
pub fn new(env: AppEnv,verbose: isize) -> Self {
|
pub fn new(env: AppEnv,verbose: isize) -> Self {
|
||||||
// dbg!(&env.contexts);
|
// dbg!(&env.contexts);
|
||||||
let (klouds_frmt, klouds_content) = load_from_module(env.to_owned(),"klouds");
|
let (klouds_frmt, klouds_content) = load_from_module(env.to_owned(),"klouds");
|
||||||
// let (ta_frmt, ta_content) = load_from_module(env.to_owned(),"ta");
|
|
||||||
// let (tp_frmt, tp_content) = load_from_module(env.to_owned(),"tp");
|
|
||||||
Self {
|
Self {
|
||||||
klouds: KloudStore::new(
|
klouds: KloudStore::new(
|
||||||
Kloud::entries(&klouds_content,&klouds_frmt),
|
Kloud::entries(&klouds_content,&klouds_frmt),
|
||||||
@ -32,16 +30,6 @@ impl CollsData {
|
|||||||
DataContext::default(),
|
DataContext::default(),
|
||||||
verbose
|
verbose
|
||||||
),
|
),
|
||||||
/*
|
|
||||||
ta: KloudStore::new(
|
|
||||||
TopographicAnatomy::entries(&ta_content,&ta_frmt),
|
|
||||||
"ta".to_owned(),
|
|
||||||
DataContext::default()
|
|
||||||
),
|
|
||||||
tp: KloudStore::new(
|
|
||||||
TrackingPoint::entries(&tp_content,&tp_frmt),
|
|
||||||
"tp".to_owned(), DataContext::default())
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub async fn get_klouds_entries(coll_map: CollsData) -> BTreeMap<String,Kloud> {
|
pub async fn get_klouds_entries(coll_map: CollsData) -> BTreeMap<String,Kloud> {
|
||||||
@ -52,24 +40,6 @@ impl CollsData {
|
|||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
pub async fn get_ta_entries(coll_map: CollsData) -> BTreeMap<String,TopographicAnatomy> {
|
|
||||||
let mut result = BTreeMap::new();
|
|
||||||
let cur = coll_map.ta.entries.read();
|
|
||||||
for (key,value) in cur.iter() {
|
|
||||||
result.insert(key.to_owned(), value.to_owned());
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
pub async fn get_tp_entries(coll_map: CollsData) -> BTreeMap<String,TrackingPoint> {
|
|
||||||
let mut result = BTreeMap::new();
|
|
||||||
let cur = coll_map.tp.entries.read();
|
|
||||||
for (key,value) in cur.iter() {
|
|
||||||
result.insert(key.to_owned(), value.to_owned());
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -83,6 +53,7 @@ pub struct DataDBs {
|
|||||||
pub colls: CollsData,
|
pub colls: CollsData,
|
||||||
pub app: AppStore,
|
pub app: AppStore,
|
||||||
pub auth: AuthStore,
|
pub auth: AuthStore,
|
||||||
|
pub conns: Arc<Mutex<AppDataConn>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn load_cloud_env(cloud: &mut Cloud) {
|
pub async fn load_cloud_env(cloud: &mut Cloud) {
|
||||||
|
Loading…
Reference in New Issue
Block a user