1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#[cfg(feature = "location")]
use crate::locations::LocationStore;
#[cfg(feature = "schema")]
use crate::schemas::SchemaStore;
#[cfg(feature = "track-and-trace")]
use crate::track_and_trace::TrackAndTraceStore;
#[cfg(feature = "pike")]
use crate::{
agents::AgentStore, organizations::MemoryOrganizationStore, organizations::OrganizationStore,
};
use crate::{commits::CommitStore, commits::MemoryCommitStore};
use super::StoreFactory;
#[derive(Default)]
pub struct MemoryStoreFactory {
grid_commit_store: MemoryCommitStore,
#[cfg(feature = "pike")]
grid_organization_store: MemoryOrganizationStore,
}
impl MemoryStoreFactory {
pub fn new() -> Self {
let grid_commit_store = MemoryCommitStore::new();
#[cfg(feature = "pike")]
let grid_organization_store = MemoryOrganizationStore::new();
Self {
grid_commit_store,
#[cfg(feature = "pike")]
grid_organization_store,
}
}
}
impl StoreFactory for MemoryStoreFactory {
#[cfg(feature = "pike")]
fn get_grid_agent_store(&self) -> Box<dyn AgentStore> {
unimplemented!()
}
fn get_grid_commit_store(&self) -> Box<dyn CommitStore> {
Box::new(self.grid_commit_store.clone())
}
#[cfg(feature = "pike")]
fn get_grid_organization_store(&self) -> Box<dyn OrganizationStore> {
Box::new(self.grid_organization_store.clone())
}
#[cfg(feature = "location")]
fn get_grid_location_store(&self) -> Box<dyn LocationStore> {
unimplemented!()
}
#[cfg(feature = "product")]
fn get_grid_product_store(&self) -> Box<dyn crate::products::ProductStore> {
unimplemented!()
}
#[cfg(feature = "schema")]
fn get_grid_schema_store(&self) -> Box<dyn SchemaStore> {
unimplemented!()
}
#[cfg(feature = "track-and-trace")]
fn get_grid_track_and_trace_store(&self) -> Box<dyn TrackAndTraceStore> {
unimplemented!()
}
}