Repository navigation
Expand file tree
/
Copy pathDATA_MODEL_CAST.puml
More file actions
343 lines (337 loc) · 9.42 KB
/
Copy pathDATA_MODEL_CAST.puml
File metadata and controls
343 lines (337 loc) · 9.42 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
' SPDX-FileCopyrightText: 2025 Husamettin ARABACI
' SPDX-License-Identifier: MIT
@startuml DATA_MODEL_CAST
' =====================
' Cast Module (HexaCast)
' =====================
' --- Domain Layer ---
package "Domain Layer" {
class Topic {
+name: String
+description: String
+created_at: DateTime
+retention_policy: RetentionPolicy
+new(name: String): Result<Topic, HexaError>
+with_description(description: String): Topic
+is_valid(): bool
+name(): &str
+description(): &str
+created_at(): DateTime
+retention_policy(): &RetentionPolicy
}6
class RetentionPolicy {
+max_events: u64
+ttl: Option<Duration>
}
interface Publisher {
+publish(topic: Topic, message: Any): Result<_, HexaError>
+publish_batch(topic: Topic, messages: Vec<Any>): Result<_, HexaError>
+get_published_count(): u64
}
interface Subscriber {
+subscribe(topic: Topic, callback: fn(Any)): Result<_, HexaError>
+unsubscribe(topic: Topic): Result<_, HexaError>
+get_subscriptions(): Vec<Topic>
+is_subscribed(topic: Topic): bool
+acknowledge(message_id: String): Result<_, HexaError>
+replay(topic: Topic, from: DateTime): Result<_, HexaError>
+lifecycle_state(): SubscriberLifecycle
}
enum SubscriberLifecycle {
Active
Inactive
Pending
Error
}
class Message {
+id: String
+topic: String
+payload: serde_json::Value
+timestamp: DateTime
+metadata: HashMap<String, String>
+delivery_status: DeliveryStatus
}
enum DeliveryStatus {
Pending
Delivered
Failed
Retrying
}
class MessageDeliveredEvent {
+message_id: String
+subscriber_id: String
+timestamp: DateTime
+status: DeliveryStatus
}
class TopicCreatedEvent {
+topic_name: String
+timestamp: DateTime
}
class TopicRetentionPolicyChangedEvent {
+topic_name: String
+old_policy: RetentionPolicy
+new_policy: RetentionPolicy
+timestamp: DateTime
}
class CastAuditTrail {
+cast_id: String
+events: Vec<CastAuditEvent>
}
class CastLock {
+acquire(id: String): Result<_, HexaError>
+release(id: String): Result<_, HexaError>
+is_locked(id: String): bool
}
class CastDependencyGraph {
+add_dependency(from: String, to: String)
+remove_dependency(from: String, to: String)
+get_dependencies(id: String): Vec<String>
}
class CastRollbackPoint {
+cast_id: String
+stage_index: u32
+state: serde_json::Value
}
class CastTag {
+name: String
+color: String
}
class CastAccessControl {
+cast_id: String
+allowed_roles: Vec<String>
+is_allowed(user: String): bool
}
class TopicPartitioning {
+topic: String
+partitions: u32
}
class TopicACL {
+topic: String
+acl_rules: Vec<AclRule>
}
class TopicVersioning {
+topic: String
+version: String
}
class TopicCompaction {
+topic: String
+compaction_policy: String
}
class TopicReplayWindow {
+topic: String
+window_start: DateTime
+window_end: DateTime
}
class SubscriberGroup {
+group_id: String
+subscribers: Vec<Subscriber>
}
class SubscriberOffsetManagement {
+subscriber_id: String
+offset: u64
}
class SubscriberDeadLetterQueue {
+subscriber_id: String
+dlq_messages: Vec<Message>
}
class MessageEncryption {
+message_id: String
+encryption_metadata: HashMap<String, String>
}
class MessageCompression {
+message_id: String
+compression_type: String
}
class MessageOrderingGuarantee {
+topic: String
+ordering_policy: String
}
class MessageDeduplication {
+message_id: String
+deduplication_id: String
}
class MessageAuditTrail {
+message_id: String
+delivery_history: Vec<DeliveryStatus>
}
Publisher --> Topic
Subscriber --> Topic
Subscriber --> Message
Message --> DeliveryStatus
MessageDeliveredEvent --> Message
TopicCreatedEvent --> Topic
TopicRetentionPolicyChangedEvent --> Topic
CastAuditTrail --> CastAuditEvent
CastDependencyGraph --> CastTag
CastRollbackPoint --> CastAuditTrail
CastAccessControl --> CastTag
SubscriberGroup --> Subscriber
SubscriberOffsetManagement --> Subscriber
SubscriberDeadLetterQueue --> Message
MessageAuditTrail --> DeliveryStatus
}
' --- Application Layer ---
package "Application Layer" {
interface TopicManagementPort {
+create_topic(config: TopicConfig): Result<_, HexaError>
+delete_topic(name: String): Result<_, HexaError>
+set_retention(name: String, policy: RetentionPolicy): Result<_, HexaError>
+list_topics(): Vec<Topic>
}
interface PublisherPort {
+publish(topic: String, message: serde_json::Value): Result<_, HexaError>
+publish_batch(topic: String, messages: Vec<serde_json::Value>): Result<_, HexaError>
}
interface SubscriberPort {
+subscribe(topic: String, filter: Option<TopicFilter>): Result<_, HexaError>
+unsubscribe(topic: String): Result<_, HexaError>
+list_subscribers(topic: String): Vec<Subscriber>
}
class CastService {
+register_subscriber(subscriber: Subscriber): Result<_, HexaError>
+remove_subscriber(id: String): Result<_, HexaError>
+list_topics(): Vec<Topic>
+list_subscribers(): Vec<Subscriber>
+publish_message(topic: String, message: serde_json::Value): Result<_, HexaError>
+replay_messages(topic: String, from: DateTime): Result<_, HexaError>
}
class TopicConfigLoader {
+load_from_file(path: String): Result<Vec<TopicConfig>, HexaError>
}
class TopicConfig {
+name: String
+description: String
+retention_policy: RetentionPolicy
}
class TopicFilter {
+field: String
+value: serde_json::Value
+operator: String
}
class CastCommand {
+CreateTopic
+DeleteTopic
+SetRetention
+ReplayMessages
}
class CastQuery {
+ListTopics
+ListSubscribers
}
class CastValidator {
+validate_topic(config: TopicConfig): Result<_, HexaError>
}
class CastAuditService {
+record_event(cast_id: String, event: CastAuditEvent)
+get_audit_trail(cast_id: String): CastAuditTrail
}
class CastLockService {
+lock(cast_id: String): Result<_, HexaError>
+unlock(cast_id: String): Result<_, HexaError>
+is_locked(cast_id: String): bool
}
class CastDependencyService {
+resolve_dependencies(cast_id: String): Vec<String>
}
class CastRollbackService {
+create_rollback_point(cast_id: String, stage_index: u32)
+rollback_to_point(cast_id: String, point: CastRollbackPoint)
}
class CastTaggingService {
+add_tag(cast_id: String, tag: CastTag)
+remove_tag(cast_id: String, tag: CastTag)
+list_tags(cast_id: String): Vec<CastTag>
}
class CastAccessControlService {
+grant_access(cast_id: String, user: String)
+revoke_access(cast_id: String, user: String)
+check_access(cast_id: String, user: String): bool
}
TopicManagementPort --> Topic
PublisherPort --> Topic
SubscriberPort --> Topic
CastService --> TopicManagementPort
CastService --> PublisherPort
CastService --> SubscriberPort
TopicConfigLoader --> TopicConfig
CastValidator --> TopicConfig
CastAuditService --> CastAuditTrail
CastRollbackService --> CastRollbackPoint
CastTaggingService --> CastTag
CastAccessControlService --> CastTag
}
' --- Infrastructure Layer ---
package "Infrastructure Layer" {
class CastRepository {
+save_topic(topic: Topic): Result<_, HexaError>
+load_topic(name: String): Result<Option<Topic>, HexaError>
+list_topics(): Result<Vec<Topic>, HexaError>
+save_subscriber(subscriber: Subscriber): Result<_, HexaError>
+list_subscribers(): Result<Vec<Subscriber>, HexaError>
}
class CastEventBus {
+publish(event: MessageDeliveredEvent): Result<_, HexaError>
+subscribe(event_type: String, handler: fn(MessageDeliveredEvent))
}
class CastCli {
+run(args: Vec<String>): Result<_, HexaError>
+list_topics(): Result<Vec<Topic>, HexaError>
+list_subscribers(): Result<Vec<Subscriber>, HexaError>
}
class CastDto {
+topic: String
+message: String
+timestamp: DateTime
+metadata: HashMap<String, String>
}
class CastMapper {
+to_dto(message: Message): CastDto
+from_dto(dto: CastDto): Message
}
interface OutputForwarder {
+forward(output: serde_json::Value, target: OutputTarget): Result<_, HexaError>
}
enum OutputTarget {
Http
Cast
File
Kafka
WebSocket
}
class CastAuditRepository {
+save(trail: CastAuditTrail)
+load(cast_id: String): Option<CastAuditTrail>
}
class CastLockManager {
+acquire_lock(cast_id: String)
+release_lock(cast_id: String)
+is_locked(cast_id: String): bool
}
class CastDependencyAdapter {
+fetch_dependencies(cast_id: String): Vec<String>
}
class CastRollbackAdapter {
+save_point(point: CastRollbackPoint)
+load_points(cast_id: String): Vec<CastRollbackPoint>
}
class CastTagStore {
+add(cast_id: String, tag: CastTag)
+remove(cast_id: String, tag: CastTag)
+list(cast_id: String): Vec<CastTag>
}
class CastAccessControlAdapter {
+set_access(cast_id: String, user: String, allowed: bool)
+get_access(cast_id: String, user: String): bool
}
CastRepository --> Topic
CastRepository --> Subscriber
CastEventBus --> MessageDeliveredEvent
CastMapper --> CastDto
CastMapper --> Message
OutputForwarder --> OutputTarget
CastAuditRepository --> CastAuditTrail
CastRollbackAdapter --> CastRollbackPoint
CastTagStore --> CastTag
CastAccessControlAdapter --> CastTag
}
@enduml