|
@ -1,4 +1,4 @@ |
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
|
use std::collections::BTreeMap;
|
|
|
|
|
|
|
|
|
use crate::entity::account::*;
|
|
|
use crate::entity::account::*;
|
|
|
use crate::entity::character::*;
|
|
|
use crate::entity::character::*;
|
|
@ -9,19 +9,19 @@ use std::sync::{Arc, Mutex}; |
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
#[derive(Clone)]
|
|
|
pub struct InMemoryGateway {
|
|
|
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 {
|
|
|
impl InMemoryGateway {
|
|
|
pub fn new() -> InMemoryGateway {
|
|
|
pub fn new() -> InMemoryGateway {
|
|
|
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())),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|