-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcache.rs
More file actions
38 lines (31 loc) · 813 Bytes
/
cache.rs
File metadata and controls
38 lines (31 loc) · 813 Bytes
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
pub(crate) mod datagram;
pub(crate) mod subgroup_stream;
use datagram::DatagramCache;
use subgroup_stream::SubgroupStreamsCache;
type GroupId = u64;
pub(crate) type SubgroupId = u64;
pub(crate) type SubgroupStreamId = (GroupId, SubgroupId);
#[derive(Eq, Hash, PartialEq, Debug, Clone)]
pub(crate) struct CacheKey {
session_id: usize,
subscribe_id: u64,
}
impl CacheKey {
pub(crate) fn new(session_id: usize, subscribe_id: u64) -> Self {
CacheKey {
session_id,
subscribe_id,
}
}
pub(crate) fn session_id(&self) -> usize {
self.session_id
}
pub(crate) fn subscribe_id(&self) -> u64 {
self.subscribe_id
}
}
#[derive(Clone)]
pub(crate) enum Cache {
Datagram(DatagramCache),
SubgroupStream(SubgroupStreamsCache),
}