|
|
@ -1,4 +1,4 @@ |
|
|
|
use std::collections::HashMap;
|
|
|
|
use std::collections::BTreeMap;
|
|
|
|
|
|
|
|
use crate::entity::account::*;
|
|
|
|
use crate::entity::character::*;
|
|
|
@ -9,19 +9,19 @@ use std::sync::{Arc, Mutex}; |
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct InMemoryGateway {
|
|
|
|
users: Arc<Mutex<HashMap<UserAccountId, UserAccountEntity>>>,
|
|
|
|
user_settings: Arc<Mutex<HashMap<UserSettingsId, UserSettingsEntity>>>,
|
|
|
|
characters: Arc<Mutex<HashMap<CharacterEntityId, CharacterEntity>>>,
|
|
|
|
items: Arc<Mutex<HashMap<ItemEntityId, ItemEntity>>>,
|
|
|
|
users: Arc<Mutex<BTreeMap<UserAccountId, UserAccountEntity>>>,
|
|
|
|
user_settings: Arc<Mutex<BTreeMap<UserSettingsId, UserSettingsEntity>>>,
|
|
|
|
characters: Arc<Mutex<BTreeMap<CharacterEntityId, CharacterEntity>>>,
|
|
|
|
items: Arc<Mutex<BTreeMap<ItemEntityId, ItemEntity>>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl InMemoryGateway {
|
|
|
|
pub fn new() -> InMemoryGateway {
|
|
|
|
InMemoryGateway {
|
|
|
|
users: Arc::new(Mutex::new(HashMap::new())),
|
|
|
|
user_settings: Arc::new(Mutex::new(HashMap::new())),
|
|
|
|
characters: Arc::new(Mutex::new(HashMap::new())),
|
|
|
|
items: Arc::new(Mutex::new(HashMap::new())),
|
|
|
|
users: Arc::new(Mutex::new(BTreeMap::new())),
|
|
|
|
user_settings: Arc::new(Mutex::new(BTreeMap::new())),
|
|
|
|
characters: Arc::new(Mutex::new(BTreeMap::new())),
|
|
|
|
items: Arc::new(Mutex::new(BTreeMap::new())),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|