Skip to content

Commit 213a10f

Browse files
Merge pull request #5 from johnburbridge/feature/class-diagram
docs: add class hierarchy diagram
2 parents 62726e5 + 247934e commit 213a10f

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

time_based_storage/docs/architecture.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,75 @@ time_based_storage/
1818
└── thread_safe_heap.py # Thread-safe wrapper for heap implementation
1919
```
2020

21+
## Class Hierarchy
22+
23+
The following diagram illustrates the class inheritance structure of the library:
24+
25+
```mermaid
26+
classDiagram
27+
class Generic~T~ {
28+
<<interface>>
29+
}
30+
31+
class TimeBasedStorage~T~ {
32+
-Dict~datetime, T~ _storage
33+
+add(timestamp, value): void
34+
+add_unique_timestamp(timestamp, value, max_offset_microseconds): datetime
35+
+get_range(start_time, end_time): List~T~
36+
+get_duration(duration): List~T~
37+
+get_value_at(timestamp): Optional~T~
38+
+remove(timestamp): bool
39+
+clear(): void
40+
+get_all(): List~T~
41+
+get_timestamps(): List~datetime~
42+
+size(): int
43+
+is_empty(): bool
44+
}
45+
46+
class TimeBasedStorageHeap~T~ {
47+
-List~Tuple~datetime, T~~ _heap
48+
+add(timestamp, value): void
49+
+get_range(start_time, end_time): List~T~
50+
+get_duration(duration): List~T~
51+
+get_earliest(): Optional~Tuple~datetime, T~~
52+
+get_latest(): Optional~Tuple~datetime, T~~
53+
+get_value_at(timestamp): Optional~T~
54+
+remove(timestamp): bool
55+
+clear(): void
56+
+get_all(): List~T~
57+
+get_timestamps(): List~datetime~
58+
+size(): int
59+
+is_empty(): bool
60+
}
61+
62+
class ThreadSafeTimeBasedStorage~T~ {
63+
-RLock _lock
64+
-Condition _condition
65+
+add(timestamp, value): void
66+
+get_range(start_time, end_time): List~T~
67+
+get_duration(duration): List~T~
68+
+wait_for_data(timeout): bool
69+
+notify_data_available(): void
70+
}
71+
72+
class ThreadSafeTimeBasedStorageHeap~T~ {
73+
-RLock _lock
74+
-Condition _condition
75+
+add(timestamp, value): void
76+
+get_range(start_time, end_time): List~T~
77+
+get_duration(duration): List~T~
78+
+wait_for_data(timeout): bool
79+
+notify_data_available(): void
80+
}
81+
82+
Generic~T~ <|-- TimeBasedStorage~T~
83+
Generic~T~ <|-- TimeBasedStorageHeap~T~
84+
TimeBasedStorage~T~ <|-- ThreadSafeTimeBasedStorage~T~
85+
TimeBasedStorageHeap~T~ <|-- ThreadSafeTimeBasedStorageHeap~T~
86+
Generic~T~ <|-- ThreadSafeTimeBasedStorage~T~
87+
Generic~T~ <|-- ThreadSafeTimeBasedStorageHeap~T~
88+
```
89+
2190
### Core Components
2291

2392
1. **`TimeBasedStorage` (core/base.py)**

0 commit comments

Comments
 (0)